diff --git a/wrap/Makefile.am b/wrap/Makefile.am index 46702b312..9b63da720 100644 --- a/wrap/Makefile.am +++ b/wrap/Makefile.am @@ -18,7 +18,7 @@ noinst_HEADERS = geometry.h utilities.h Argument.h Constructor.h Method.h Class. noinst_PROGRAMS = wrap wrap_SOURCES = ${common} wrap.cpp -AM_CPPFLAGS = -I$(boost) -I$(top_srcdir) +AM_CPPFLAGS = -I$(boost) -I$(top_srcdir) -DTOPSRCDIR="\"$(top_srcdir)\"" AM_CXXFLAGS = -MMD AM_LDFLAGS = -L../CppUnitLite -lCppUnitLite $(BOOST_LDFLAGS) diff --git a/wrap/testWrap.cpp b/wrap/testWrap.cpp index 6d2c7f269..527a86c91 100644 --- a/wrap/testWrap.cpp +++ b/wrap/testWrap.cpp @@ -13,6 +13,11 @@ using namespace std; static bool verbose = false; +#ifdef TOPSRCDIR +static string topdir = TOPSRCDIR; +#else +static string topdir = ".."; +#endif /* ************************************************************************* */ TEST( wrap, ArgumentList ) { @@ -33,7 +38,9 @@ TEST( wrap, check_exception ) { /* ************************************************************************* */ TEST( wrap, parse ) { - Module module(".", "geometry",verbose); + string path = topdir + "/wrap"; + + Module module(path.c_str(), "geometry",verbose); CHECK(module.classes.size()==3); // check second class, Point3 @@ -64,32 +71,33 @@ TEST( wrap, parse ) { /* ************************************************************************* */ TEST( wrap, matlab_code ) { // Parse into class object - Module module(".","geometry",verbose); + string path = topdir + "/wrap"; + Module module(path,"geometry",verbose); // emit MATLAB code // make_geometry will not compile, use make testwrap to generate real make module.matlab_code("actual", "", "-O5"); - 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(path + "/expected/@Point2/Point2.m" , path + "/actual/@Point2/Point2.m" )); + CHECK(files_equal(path + "/expected/@Point2/x.cpp" , path + "/actual/@Point2/x.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(path + "/expected/@Point3/Point3.m" , path + "/actual/@Point3/Point3.m" )); + CHECK(files_equal(path + "/expected/new_Point3_ddd.m" , path + "/actual/new_Point3_ddd.m" )); + CHECK(files_equal(path + "/expected/new_Point3_ddd.cpp", path + "/actual/new_Point3_ddd.cpp")); + CHECK(files_equal(path + "/expected/@Point3/norm.m" , path + "/actual/@Point3/norm.m" )); + CHECK(files_equal(path + "/expected/@Point3/norm.cpp" , path + "/actual/@Point3/norm.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(path + "/expected/new_Test_.cpp" , path + "/actual/new_Test_.cpp" )); + CHECK(files_equal(path + "/expected/@Test/Test.m" , path + "/actual/@Test/Test.m" )); + CHECK(files_equal(path + "/expected/@Test/return_string.cpp" , path + "/actual/@Test/return_string.cpp" )); + CHECK(files_equal(path + "/expected/@Test/return_pair.cpp" , path + "/actual/@Test/return_pair.cpp" )); + CHECK(files_equal(path + "/expected/@Test/return_field.cpp" , path + "/actual/@Test/return_field.cpp" )); + CHECK(files_equal(path + "/expected/@Test/return_TestPtr.cpp", path + "/actual/@Test/return_TestPtr.cpp")); + CHECK(files_equal(path + "/expected/@Test/return_ptrs.cpp" , path + "/actual/@Test/return_ptrs.cpp" )); + CHECK(files_equal(path + "/expected/@Test/print.m" , path + "/actual/@Test/print.m" )); + CHECK(files_equal(path + "/expected/@Test/print.cpp" , path + "/actual/@Test/print.cpp" )); - CHECK(files_equal("expected/make_geometry.m" , "actual/make_geometry.m" )); + CHECK(files_equal(path + "/expected/make_geometry.m" , path + "/actual/make_geometry.m" )); } /* ************************************************************************* */