fixed testWrap unit test
parent
03efd69079
commit
3a8e7de5e3
|
@ -3,7 +3,12 @@ INSTALL = install
|
|||
AM_CXXFLAGS = -MMD -I$(boost) -I.. -O5
|
||||
|
||||
noinst_PROGRAMS = wrap
|
||||
wrap_SOURCES = utilities.cpp Argument.cpp Constructor.cpp Method.cpp Class.cpp Module.cpp wrap.cpp
|
||||
common = utilities.cpp Argument.cpp Constructor.cpp Method.cpp Class.cpp Module.cpp
|
||||
wrap_SOURCES = ${common} wrap.cpp
|
||||
|
||||
check_PROGRAMS = testSpirit testWrap
|
||||
testSpirit_SOURCES = testSpirit.cpp
|
||||
testWrap_SOURCES = testWrap.cpp ${common}
|
||||
|
||||
# generate local toolbox dir
|
||||
interfacePath = ../cpp
|
||||
|
@ -19,6 +24,11 @@ include_HEADERS = utilities.h Argument.h Constructor.h Method.h Class.h Module.h
|
|||
|
||||
install: all
|
||||
|
||||
AM_CXXFLAGS += -I..
|
||||
AM_LDFLAGS = -L../CppUnitLite -lCppUnitLite $(BOOST_LDFLAGS)
|
||||
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
# clean local toolbox dir
|
||||
clean:
|
||||
@test -z "wrap" || rm -f wrap
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
classdef Point2
|
||||
properties
|
||||
self = 0
|
||||
end
|
||||
methods
|
||||
function obj = Point2(varargin)
|
||||
if nargin == 0, obj.self = new_Point2_(); end
|
||||
if nargin == 2, obj.self = new_Point2_dd(varargin{1},varargin{2}); end
|
||||
if nargin ~= 13 && obj.self == 0, error('Point2 constructor failed'); end
|
||||
end
|
||||
function display(obj), obj.print(''); end
|
||||
function disp(obj), obj.display; end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Point2.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("dim",nargout,nargin-1,0);
|
||||
shared_ptr<Point2> self = unwrap_shared_ptr< Point2 >(in[0],"Point2");
|
||||
int result = self->dim();
|
||||
out[0] = wrap< int >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.dim()
|
||||
function result = dim(obj)
|
||||
error('need to compile dim.cpp');
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Point2.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("x",nargout,nargin-1,0);
|
||||
shared_ptr<Point2> self = unwrap_shared_ptr< Point2 >(in[0],"Point2");
|
||||
double result = self->x();
|
||||
out[0] = wrap< double >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.x()
|
||||
function result = x(obj)
|
||||
error('need to compile x.cpp');
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Point2.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("y",nargout,nargin-1,0);
|
||||
shared_ptr<Point2> self = unwrap_shared_ptr< Point2 >(in[0],"Point2");
|
||||
double result = self->y();
|
||||
out[0] = wrap< double >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.y()
|
||||
function result = y(obj)
|
||||
error('need to compile y.cpp');
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
classdef Point3
|
||||
properties
|
||||
self = 0
|
||||
end
|
||||
methods
|
||||
function obj = Point3(varargin)
|
||||
if nargin == 3, obj.self = new_Point3_ddd(varargin{1},varargin{2},varargin{3}); end
|
||||
if nargin ~= 13 && obj.self == 0, error('Point3 constructor failed'); end
|
||||
end
|
||||
function display(obj), obj.print(''); end
|
||||
function disp(obj), obj.display; end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Point3.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("norm",nargout,nargin-1,0);
|
||||
shared_ptr<Point3> self = unwrap_shared_ptr< Point3 >(in[0],"Point3");
|
||||
double result = self->norm();
|
||||
out[0] = wrap< double >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.norm()
|
||||
function result = norm(obj)
|
||||
error('need to compile norm.cpp');
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
classdef Test
|
||||
properties
|
||||
self = 0
|
||||
end
|
||||
methods
|
||||
function obj = Test(varargin)
|
||||
if nargin == 0, obj.self = new_Test_(); end
|
||||
if nargin ~= 13 && obj.self == 0, error('Test constructor failed'); end
|
||||
end
|
||||
function display(obj), obj.print(''); end
|
||||
function disp(obj), obj.display; end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("create_ptrs",nargout,nargin-1,0);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
pair< shared_ptr<Test>, shared_ptr<Test> > result = self->create_ptrs();
|
||||
out[0] = wrap_shared_ptr(result.first,"Test");
|
||||
out[1] = wrap_shared_ptr(result.second,"Test");
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.create_ptrs()
|
||||
function [first,second] = create_ptrs(obj)
|
||||
error('need to compile create_ptrs.cpp');
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("print",nargout,nargin-1,0);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
self->print();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.print()
|
||||
function result = print(obj)
|
||||
error('need to compile print.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_TestPtr",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
shared_ptr<Test> value = unwrap_shared_ptr< Test >(in[1], "Test");
|
||||
shared_ptr<Test> result = self->return_TestPtr(value);
|
||||
out[0] = wrap_shared_ptr(result,"Test");
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_TestPtr(value)
|
||||
function result = return_TestPtr(obj,value)
|
||||
error('need to compile return_TestPtr.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_bool",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
bool value = unwrap< bool >(in[1]);
|
||||
bool result = self->return_bool(value);
|
||||
out[0] = wrap< bool >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_bool(value)
|
||||
function result = return_bool(obj,value)
|
||||
error('need to compile return_bool.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_double",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
double value = unwrap< double >(in[1]);
|
||||
double result = self->return_double(value);
|
||||
out[0] = wrap< double >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_double(value)
|
||||
function result = return_double(obj,value)
|
||||
error('need to compile return_double.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_field",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
Test& t = *unwrap_shared_ptr< Test >(in[1], "Test");
|
||||
bool result = self->return_field(t);
|
||||
out[0] = wrap< bool >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_field(t)
|
||||
function result = return_field(obj,t)
|
||||
error('need to compile return_field.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_int",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
int value = unwrap< int >(in[1]);
|
||||
int result = self->return_int(value);
|
||||
out[0] = wrap< int >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_int(value)
|
||||
function result = return_int(obj,value)
|
||||
error('need to compile return_int.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_matrix1",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
Matrix result = self->return_matrix1(value);
|
||||
out[0] = wrap< Matrix >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_matrix1(value)
|
||||
function result = return_matrix1(obj,value)
|
||||
error('need to compile return_matrix1.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_matrix2",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
Matrix result = self->return_matrix2(value);
|
||||
out[0] = wrap< Matrix >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_matrix2(value)
|
||||
function result = return_matrix2(obj,value)
|
||||
error('need to compile return_matrix2.cpp');
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_pair",nargout,nargin-1,2);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
Vector v = unwrap< Vector >(in[1]);
|
||||
Matrix A = unwrap< Matrix >(in[2]);
|
||||
pair< Vector, Matrix > result = self->return_pair(v,A);
|
||||
out[0] = wrap< Vector >(result.first);
|
||||
out[1] = wrap< Matrix >(result.second);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_pair(v,A)
|
||||
function [first,second] = return_pair(obj,v,A)
|
||||
error('need to compile return_pair.cpp');
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_ptrs",nargout,nargin-1,2);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
shared_ptr<Test> p1 = unwrap_shared_ptr< Test >(in[1], "Test");
|
||||
shared_ptr<Test> p2 = unwrap_shared_ptr< Test >(in[2], "Test");
|
||||
pair< shared_ptr<Test>, shared_ptr<Test> > result = self->return_ptrs(p1,p2);
|
||||
out[0] = wrap_shared_ptr(result.first,"Test");
|
||||
out[1] = wrap_shared_ptr(result.second,"Test");
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_ptrs(p1,p2)
|
||||
function [first,second] = return_ptrs(obj,p1,p2)
|
||||
error('need to compile return_ptrs.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_size_t",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
size_t value = unwrap< size_t >(in[1]);
|
||||
size_t result = self->return_size_t(value);
|
||||
out[0] = wrap< size_t >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_size_t(value)
|
||||
function result = return_size_t(obj,value)
|
||||
error('need to compile return_size_t.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_string",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
string value = unwrap< string >(in[1]);
|
||||
string result = self->return_string(value);
|
||||
out[0] = wrap< string >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_string(value)
|
||||
function result = return_string(obj,value)
|
||||
error('need to compile return_string.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_vector1",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
Vector value = unwrap< Vector >(in[1]);
|
||||
Vector result = self->return_vector1(value);
|
||||
out[0] = wrap< Vector >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_vector1(value)
|
||||
function result = return_vector1(obj,value)
|
||||
error('need to compile return_vector1.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_vector2",nargout,nargin-1,1);
|
||||
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
|
||||
Vector value = unwrap< Vector >(in[1]);
|
||||
Vector result = self->return_vector2(value);
|
||||
out[0] = wrap< Vector >(result);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
% usage: obj.return_vector2(value)
|
||||
function result = return_vector2(obj,value)
|
||||
error('need to compile return_vector2.cpp');
|
||||
end
|
|
@ -0,0 +1,44 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
echo on
|
||||
|
||||
toolboxpath = pwd
|
||||
addpath(toolboxpath);
|
||||
|
||||
cd(toolboxpath)
|
||||
mex -O5 new_Point2_.cpp
|
||||
mex -O5 new_Point2_dd.cpp
|
||||
|
||||
cd @Point2
|
||||
mex -O5 x.cpp
|
||||
mex -O5 y.cpp
|
||||
mex -O5 dim.cpp
|
||||
|
||||
cd(toolboxpath)
|
||||
mex -O5 new_Point3_ddd.cpp
|
||||
|
||||
cd @Point3
|
||||
mex -O5 norm.cpp
|
||||
|
||||
cd(toolboxpath)
|
||||
mex -O5 new_Test_.cpp
|
||||
|
||||
cd @Test
|
||||
mex -O5 return_bool.cpp
|
||||
mex -O5 return_size_t.cpp
|
||||
mex -O5 return_int.cpp
|
||||
mex -O5 return_double.cpp
|
||||
mex -O5 return_string.cpp
|
||||
mex -O5 return_vector1.cpp
|
||||
mex -O5 return_matrix1.cpp
|
||||
mex -O5 return_vector2.cpp
|
||||
mex -O5 return_matrix2.cpp
|
||||
mex -O5 return_pair.cpp
|
||||
mex -O5 return_field.cpp
|
||||
mex -O5 return_TestPtr.cpp
|
||||
mex -O5 create_ptrs.cpp
|
||||
mex -O5 return_ptrs.cpp
|
||||
mex -O5 print.cpp
|
||||
|
||||
cd(toolboxpath)
|
||||
|
||||
echo off
|
|
@ -0,0 +1,9 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Point2.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("new_Point2_",nargout,nargin,0);
|
||||
Point2* self = new Point2();
|
||||
out[0] = wrap_constructed(self,"Point2");
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
function result = new_Point2_(obj)
|
||||
error('need to compile new_Point2_.cpp');
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Point2.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("new_Point2_dd",nargout,nargin,2);
|
||||
double x = unwrap< double >(in[0]);
|
||||
double y = unwrap< double >(in[1]);
|
||||
Point2* self = new Point2(x,y);
|
||||
out[0] = wrap_constructed(self,"Point2");
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
function result = new_Point2_dd(obj,x,y)
|
||||
error('need to compile new_Point2_dd.cpp');
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Point3.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("new_Point3_ddd",nargout,nargin,3);
|
||||
double x = unwrap< double >(in[0]);
|
||||
double y = unwrap< double >(in[1]);
|
||||
double z = unwrap< double >(in[2]);
|
||||
Point3* self = new Point3(x,y,z);
|
||||
out[0] = wrap_constructed(self,"Point3");
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
function result = new_Point3_ddd(obj,x,y,z)
|
||||
error('need to compile new_Point3_ddd.cpp');
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
// automatically generated by wrap on 2010-Feb-23
|
||||
#include <wrap/matlab.h>
|
||||
#include <Test.h>
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("new_Test_",nargout,nargin,0);
|
||||
Test* self = new Test();
|
||||
out[0] = wrap_constructed(self,"Test");
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
% automatically generated by wrap on 2010-Feb-23
|
||||
function result = new_Test_(obj)
|
||||
error('need to compile new_Test_.cpp');
|
||||
end
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
class Point2 {
|
||||
Point2();
|
||||
Point2(double x, double y);
|
||||
double x();
|
||||
double y();
|
||||
int dim() const;
|
||||
};
|
||||
|
||||
class Point3 {
|
||||
Point3(double x, double y, double z);
|
||||
double norm() const;
|
||||
};
|
||||
|
||||
class Test {
|
||||
Test();
|
||||
|
||||
bool return_bool (bool value);
|
||||
size_t return_size_t (size_t value);
|
||||
int return_int (int value);
|
||||
double return_double (double value);
|
||||
|
||||
string return_string (string value);
|
||||
Vector return_vector1(Vector value);
|
||||
Matrix return_matrix1(Matrix value);
|
||||
Vector return_vector2(Vector value);
|
||||
Matrix return_matrix2(Matrix value);
|
||||
|
||||
pair<Vector,Matrix> return_pair (Vector v, Matrix A);
|
||||
|
||||
bool return_field(const Test& t) const;
|
||||
|
||||
Test* return_TestPtr(Test* value);
|
||||
|
||||
pair<Test*,Test*> create_ptrs ();
|
||||
pair<Test*,Test*> return_ptrs (Test* p1, Test* p2);
|
||||
|
||||
void print();
|
||||
};
|
|
@ -27,7 +27,7 @@ TEST( wrap, ArgumentList ) {
|
|||
|
||||
/* ************************************************************************* */
|
||||
TEST( wrap, parse ) {
|
||||
Module module("../interfaces", "geometry");
|
||||
Module module(".", "geometry");
|
||||
CHECK(module.classes.size()==3);
|
||||
|
||||
// check second class, Point3
|
||||
|
@ -58,32 +58,32 @@ TEST( wrap, parse ) {
|
|||
/* ************************************************************************* */
|
||||
TEST( wrap, matlab_code ) {
|
||||
// Parse into class object
|
||||
Module module("../interfaces","geometry");
|
||||
Module module(".","geometry");
|
||||
|
||||
// emit MATLAB code
|
||||
// make_geometry will not compile, use make testwrap to generate real make
|
||||
module.matlab_code("/Users/dellaert/projects/gtsam/matlab", "", "-O5");
|
||||
module.matlab_code("actual", "", "-O5");
|
||||
|
||||
CHECK(files_equal("../matlab/@Point2/Point2.m" , "../matlab/@Point2/Point2-expected.m" ));
|
||||
CHECK(files_equal("../matlab/@Point2/x.cpp" , "../matlab/@Point2/x-expected.cpp" ));
|
||||
CHECK(files_equal("expected/@Point2/Point2.m" , "actual/@Point2/Point2.m" ));
|
||||
CHECK(files_equal("expected/@Point2/x.cpp" , "actual/@Point2/x.cpp" ));
|
||||
|
||||
CHECK(files_equal("../matlab/@Point3/Point3.m" , "../matlab/@Point3/Point3-expected.m" ));
|
||||
CHECK(files_equal("../matlab/new_Point3_ddd.m" , "../matlab/new_Point3_ddd-expected.m" ));
|
||||
CHECK(files_equal("../matlab/new_Point3_ddd.cpp", "../matlab/new_Point3_ddd-expected.cpp"));
|
||||
CHECK(files_equal("../matlab/@Point3/norm.m" , "../matlab/@Point3/norm-expected.m" ));
|
||||
CHECK(files_equal("../matlab/@Point3/norm.cpp" , "../matlab/@Point3/norm-expected.cpp" ));
|
||||
CHECK(files_equal("expected/@Point3/Point3.m" , "actual/@Point3/Point3.m" ));
|
||||
CHECK(files_equal("expected/new_Point3_ddd.m" , "actual/new_Point3_ddd.m" ));
|
||||
CHECK(files_equal("expected/new_Point3_ddd.cpp", "actual/new_Point3_ddd.cpp"));
|
||||
CHECK(files_equal("expected/@Point3/norm.m" , "actual/@Point3/norm.m" ));
|
||||
CHECK(files_equal("expected/@Point3/norm.cpp" , "actual/@Point3/norm.cpp" ));
|
||||
|
||||
CHECK(files_equal("../matlab/new_Test_.cpp" , "../matlab/new_Test_-expected.cpp" ));
|
||||
CHECK(files_equal("../matlab/@Test/Test.m" , "../matlab/@Test/Test-expected.m" ));
|
||||
CHECK(files_equal("../matlab/@Test/return_string.cpp" , "../matlab/@Test/return_string-expected.cpp" ));
|
||||
CHECK(files_equal("../matlab/@Test/return_pair.cpp" , "../matlab/@Test/return_pair-expected.cpp" ));
|
||||
CHECK(files_equal("../matlab/@Test/return_field.cpp" , "../matlab/@Test/return_field-expected.cpp" ));
|
||||
CHECK(files_equal("../matlab/@Test/return_TestPtr.cpp", "../matlab/@Test/return_TestPtr-expected.cpp"));
|
||||
CHECK(files_equal("../matlab/@Test/return_ptrs.cpp" , "../matlab/@Test/return_ptrs-expected.cpp" ));
|
||||
CHECK(files_equal("../matlab/@Test/print.m" , "../matlab/@Test/print-expected.m" ));
|
||||
CHECK(files_equal("../matlab/@Test/print.cpp" , "../matlab/@Test/print-expected.cpp" ));
|
||||
CHECK(files_equal("expected/new_Test_.cpp" , "actual/new_Test_.cpp" ));
|
||||
CHECK(files_equal("expected/@Test/Test.m" , "actual/@Test/Test.m" ));
|
||||
CHECK(files_equal("expected/@Test/return_string.cpp" , "actual/@Test/return_string.cpp" ));
|
||||
CHECK(files_equal("expected/@Test/return_pair.cpp" , "actual/@Test/return_pair.cpp" ));
|
||||
CHECK(files_equal("expected/@Test/return_field.cpp" , "actual/@Test/return_field.cpp" ));
|
||||
CHECK(files_equal("expected/@Test/return_TestPtr.cpp", "actual/@Test/return_TestPtr.cpp"));
|
||||
CHECK(files_equal("expected/@Test/return_ptrs.cpp" , "actual/@Test/return_ptrs.cpp" ));
|
||||
CHECK(files_equal("expected/@Test/print.m" , "actual/@Test/print.m" ));
|
||||
CHECK(files_equal("expected/@Test/print.cpp" , "actual/@Test/print.cpp" ));
|
||||
|
||||
CHECK(files_equal("../matlab/make_geometry.m" , "../matlab/make_geometry_expected.m" ));
|
||||
CHECK(files_equal("expected/make_geometry.m" , "actual/make_geometry.m" ));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
Loading…
Reference in New Issue