diff options
Diffstat (limited to 'tests')
65 files changed, 877 insertions, 202 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5eecaae..39dc341 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -13,7 +13,11 @@ include(CMakeParseArguments.cmake) # Detect Lion and force gcc IF (APPLE) EXECUTE_PROCESS(COMMAND sw_vers -productVersion OUTPUT_VARIABLE MACOSX_VERSION) - IF (NOT ${MACOSX_VERSION} VERSION_LESS "10.7.0") + IF (NOT ${MACOSX_VERSION} VERSION_LESS "10.8.0") + message("Detected Mountain Lion or later") + set(CMAKE_C_COMPILER "gcc") + set(CMAKE_CXX_COMPILER "g++") + ELSEIF (NOT ${MACOSX_VERSION} VERSION_LESS "10.7.0") message("Detected Lion or later") set(CMAKE_C_COMPILER "gcc") set(CMAKE_CXX_COMPILER "g++") @@ -97,7 +101,7 @@ endif() # Clang compiler -if(CMAKE_CXX_COMPILER MATCHES ".*clang.*") +if(${CMAKE_CXX_COMPILER} MATCHES ".*clang.*") # disable enormous amount of warnings about CGAL set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") @@ -179,28 +183,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") FIND_LIBRARY(COCOA_LIBRARY Cocoa REQUIRED) endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -# Qt4 - -set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON) -find_package(OpenGL REQUIRED) -if ( "${OPENGL_glu_LIBRARY}" MATCHES "NOTFOUND" ) - # GLU and Mesa split in late 2012 so some systems dont have GLU - find_library(OPENGL_glu_LIBRARY GLU HINTS "$ENV{OPENSCAD_LIBRARIES}/lib" REQUIRED) - set( OPENGL_LIBRARY ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARY} ) -endif() - -if (MINGW_CROSS_ENV_DIR) - mingw_cross_env_find_qt() - mingw_cross_env_info() - include_directories( ${QT_INCLUDE_DIRS} ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QT_CFLAGS_OTHER}") -else() - find_package(Qt4 COMPONENTS QtCore REQUIRED) - include(${QT_USE_FILE}) -endif() - -set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF) - # Eigen @@ -268,6 +250,20 @@ else() inclusion(EIGEN_DIR EIGEN_INCLUDE_DIR) endif() +# OpenGL +find_package(OpenGL REQUIRED) +if (NOT OPENGL_GLU_FOUND) + message(STATUS "GLU not found in system paths...searching $ENV{OPENSCAD_LIBRARIES} ") + find_library(OPENGL_glu_LIBRARY GLU HINTS $ENV{OPENSCAD_LIBRARIES}/lib) + if (NOT OPENGL_glu_LIBRARY) + message(FATAL "GLU library not found") + endif() + set(OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES}) + message(STATUS "OpenGL LIBRARIES: ") + foreach(GLLIB ${OPENGL_LIBRARIES}) + message(STATUS " " ${GLLIB}) + endforeach() +endif() # OpenCSG if (NOT $ENV{OPENCSGDIR} STREQUAL "") @@ -374,7 +370,7 @@ if("${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}" VERSION_LESS 3.6) endif() inclusion(CGAL_DIR CGAL_INCLUDE_DIRS) -if(CMAKE_CXX_COMPILER MATCHES ".*clang.*") +if(${CMAKE_CXX_COMPILER} MATCHES ".*clang.*" AND NOT ${CGAL_CXX_FLAGS_INIT} STREQUAL "" ) string(REPLACE "-frounding-math" "" CGAL_CXX_FLAGS_INIT ${CGAL_CXX_FLAGS_INIT}) string(REPLACE "--param=ssp-buffer-size=4" "" CGAL_CXX_FLAGS_INIT ${CGAL_CXX_FLAGS_INIT}) endif() @@ -422,10 +418,13 @@ set(CORE_SOURCES ../src/value.cc ../src/expr.cc ../src/func.cc + ../src/localscope.cc ../src/module.cc ../src/ModuleCache.cc ../src/node.cc ../src/context.cc + ../src/modcontext.cc + ../src/evalcontext.cc ../src/csgterm.cc ../src/csgtermnormalizer.cc ../src/polyset.cc @@ -443,7 +442,9 @@ set(CORE_SOURCES ../src/linearextrude.cc ../src/rotateextrude.cc ../src/printutils.cc + ../src/fileutils.cc ../src/progress.cc + ../src/boost-utils.cc ${FLEX_OpenSCADlexer_OUTPUTS} ${BISON_OpenSCADparser_OUTPUTS}) @@ -604,6 +605,10 @@ else() set(GUI_BINPATH "${CMAKE_CURRENT_SOURCE_DIR}/../openscad") endif() +if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/openscad") + set(GUI_BINPATH "${CMAKE_CURRENT_BINARY_DIR}/openscad") +endif() + if(EXISTS "${GUI_BINPATH}") message(STATUS "Found OpenSCAD GUI binary: ${GUI_BINPATH}") else() @@ -764,17 +769,24 @@ list(APPEND ECHO_FILES ${FUNCTION_FILES} ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/vector-values.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/search-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/recursion-tests.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/value-reassignment-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/value-reassignment-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/variable-scope-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/lookup-tests.scad) list(APPEND DUMPTEST_FILES ${MINIMAL_FILES} ${FEATURES_FILES} ${EXAMPLE_FILES}) list(APPEND DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-tests.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles-test.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad) list(APPEND CGALPNGTEST_FILES ${FEATURES_FILES} ${SCAD_DXF_FILES} ${EXAMPLE_FILES}) list(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles-test.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad) + list(APPEND OPENCSGTEST_FILES ${CGALPNGTEST_FILES}) list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/bbox-transform-bug.scad) list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/intersection-prune-test.scad) diff --git a/tests/cgalcachetest.cc b/tests/cgalcachetest.cc index 3a0a855..67d3313 100644 --- a/tests/cgalcachetest.cc +++ b/tests/cgalcachetest.cc @@ -30,7 +30,7 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" @@ -40,7 +40,6 @@ #include "PolySetCGALEvaluator.h" #include "CGALCache.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -57,7 +56,6 @@ namespace po = boost::program_options; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::string; @@ -124,19 +122,18 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); - currentdir = boosty::stringy( fs::current_path() ); + currentdir = boosty::stringy(fs::current_path()); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); root_module = parsefile(filename); if (!root_module) { @@ -148,7 +145,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); + AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst); AbstractNode *root_node; // Do we have an explicit root node (! modifier)? if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node; diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index 52205fd..7b958de 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -30,7 +30,7 @@ #include "node.h" #include "module.h" #include "polyset.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" @@ -43,7 +43,6 @@ #include "cgal.h" #include "OffscreenView.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -57,7 +56,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::string; @@ -97,31 +95,31 @@ int main(int argc, char **argv) #endif Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); root_module = parsefile(filename); if (!root_module) { exit(1); } - if (fs::path(filename).has_parent_path()) { - fs::current_path(fs::path(filename).parent_path()); - } + fs::path fpath = boosty::absolute(fs::path(filename)); + fs::path fparent = fpath.parent_path(); + fs::current_path(fparent); + top_ctx.setDocumentPath(fparent.string()); AbstractNode::resetIndexCounter(); - AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); + AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst); AbstractNode *root_node; // Do we have an explicit root node (! modifier)? if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node; diff --git a/tests/cgalstlsanitytest.cc b/tests/cgalstlsanitytest.cc index 2815463..4be7767 100644 --- a/tests/cgalstlsanitytest.cc +++ b/tests/cgalstlsanitytest.cc @@ -29,7 +29,7 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" @@ -38,11 +38,6 @@ #include "CGALEvaluator.h" #include "PolySetCGALEvaluator.h" -#include <QCoreApplication> -#include <QFile> -#include <QDir> -#include <QSet> -#include <QTextStream> #ifndef _MSC_VER #include <getopt.h> #endif @@ -56,7 +51,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::string; @@ -83,19 +77,18 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); root_module = parsefile(filename); if (!root_module) { @@ -107,7 +100,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); + AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst); AbstractNode *root_node; // Do we have an explicit root node (! modifier)? if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node; diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index 4a15050..d750da9 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -29,7 +29,7 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" @@ -38,7 +38,6 @@ #include "CGALEvaluator.h" #include "PolySetCGALEvaluator.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -52,7 +51,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::string; @@ -76,19 +74,18 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); root_module = parsefile(filename); if (!root_module) { @@ -100,7 +97,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); + AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst); AbstractNode *root_node; // Do we have an explicit root node (! modifier)? if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node; diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index e793c4a..1460bbd 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -31,14 +31,13 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" #include "Tree.h" #include "csgterm.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -53,7 +52,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::cout; @@ -71,19 +69,18 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); const AbstractNode *root_node; root_module = parsefile(filename); @@ -96,7 +93,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - root_node = root_module->evaluate(&root_ctx, &root_inst); + root_node = root_module->instantiate(&top_ctx, &root_inst); Tree tree(root_node); diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 7583a41..7b9dbab 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -6,7 +6,7 @@ #include "openscad.h" #include "parsersettings.h" #include "builtin.h" -#include "context.h" +#include "modcontext.h" #include "node.h" #include "module.h" #include "polyset.h" @@ -23,9 +23,6 @@ #include "csgtermnormalizer.h" #include "OffscreenView.h" -#include <QCoreApplication> -#include <QTimer> - #include <sstream> #include <vector> @@ -128,20 +125,18 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); - fs::path original_path = fs::current_path(); std::string currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); if (sysinfo_dump) root_module = parse("sphere();","",false); @@ -153,13 +148,14 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } if (!sysinfo_dump) { - if (fs::path(filename).has_parent_path()) { - fs::current_path(fs::path(filename).parent_path()); - } + fs::path fpath = boosty::absolute(fs::path(filename)); + fs::path fparent = fpath.parent_path(); + fs::current_path(fparent); + top_ctx.setDocumentPath(fparent.string()); } AbstractNode::resetIndexCounter(); - AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); + AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst); AbstractNode *root_node; // Do we have an explicit root node (! modifier)? if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node; diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index e050232..97902f6 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -31,13 +31,12 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" #include "Tree.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -52,7 +51,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; void csgTree(CSGTextCache &cache, const AbstractNode &root) { @@ -75,19 +73,18 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); AbstractNode *root_node; root_module = parsefile(filename); @@ -100,7 +97,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - root_node = root_module->evaluate(&root_ctx, &root_inst); + root_node = root_module->instantiate(&top_ctx, &root_inst); Tree tree; tree.setRoot(root_node); diff --git a/tests/dumptest.cc b/tests/dumptest.cc index b75a2e2..4477703 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -29,13 +29,12 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" #include "Tree.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -50,7 +49,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::string; @@ -76,24 +74,22 @@ int main(int argc, char **argv) const char *filename = argv[1]; const char *outfilename = argv[2]; - int rc = 0; Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy(fs::current_path()); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); AbstractNode *root_node; root_module = parsefile(filename); @@ -101,12 +97,13 @@ int main(int argc, char **argv) exit(1); } - if (fs::path(filename).has_parent_path()) { - fs::current_path(fs::path(filename).parent_path()); - } + fs::path fpath = boosty::absolute(fs::path(filename)); + fs::path fparent = fpath.parent_path(); + fs::current_path(fparent); + top_ctx.setDocumentPath(fparent.string()); AbstractNode::resetIndexCounter(); - root_node = root_module->evaluate(&root_ctx, &root_inst); + root_node = root_module->instantiate(&top_ctx, &root_inst); Tree tree; tree.setRoot(root_node); @@ -121,27 +118,32 @@ int main(int argc, char **argv) fs::current_path(original_path); std::ofstream outfile; outfile.open(outfilename); + if (!outfile.is_open()) { + fprintf(stderr, "Error: Unable to open output file %s\n", outfilename); + exit(1); + } + std::cout << "Opened " << outfilename << "\n"; outfile << dumpstdstr << "\n"; outfile.close(); + if (outfile.fail()) fprintf(stderr, "Failed to close file\n"); delete root_node; delete root_module; - root_module = parsefile(outfilename); + fs::current_path(original_path); + root_module = parsefile(outfilename, fparent.string().c_str()); if (!root_module) { fprintf(stderr, "Error: Unable to read back dumped file\n"); exit(1); } - if (fs::path(filename).has_parent_path()) { - fs::current_path(fs::path(filename).parent_path()); - } - AbstractNode::resetIndexCounter(); - root_node = root_module->evaluate(&root_ctx, &root_inst); + root_node = root_module->instantiate(&top_ctx, &root_inst); tree.setRoot(root_node); + fs::current_path(fparent); + string readbackstr = dumptree(tree, *root_node); if (dumpstdstr != readbackstr) { fprintf(stderr, "Error: Readback is different from original dump:\n"); diff --git a/tests/echotest.cc b/tests/echotest.cc index bf2f4a4..3051751 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -29,12 +29,11 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "builtin.h" #include "printutils.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -49,7 +48,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::string; @@ -83,19 +81,18 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); AbstractNode *root_node; root_module = parsefile(filename); @@ -108,7 +105,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - root_node = root_module->evaluate(&root_ctx, &root_inst); + root_node = root_module->instantiate(&top_ctx, &root_inst); delete root_node; delete root_module; diff --git a/tests/modulecachetest.cc b/tests/modulecachetest.cc index 0028114..5531461 100644 --- a/tests/modulecachetest.cc +++ b/tests/modulecachetest.cc @@ -29,13 +29,12 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" #include "Tree.h" -#include <QCoreApplication> #ifndef _MSC_VER #include <getopt.h> #endif @@ -50,7 +49,6 @@ namespace fs = boost::filesystem; std::string commandline_commands; std::string currentdir; -QString examplesdir; using std::string; @@ -71,22 +69,20 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); fs::path original_path = fs::current_path(); currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + ModuleInstantiation root_inst("group"); AbstractNode *root_node; - root_module = parsefile(filename); + FileModule *root_module = parsefile(filename); if (!root_module) { fprintf(stderr, "Error: Unable to parse input file\n"); exit(1); @@ -97,7 +93,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - root_node = root_module->evaluate(&root_ctx, &root_inst); + root_node = root_module->instantiate(&top_ctx, &root_inst); delete root_node; delete root_module; @@ -112,7 +108,7 @@ int main(int argc, char **argv) } AbstractNode::resetIndexCounter(); - root_node = root_module->evaluate(&root_ctx, &root_inst); + root_node = root_module->instantiate(&top_ctx, &root_inst); delete root_node; delete root_module; diff --git a/tests/regression/cgalpngtest/child-child-test-expected.png b/tests/regression/cgalpngtest/child-child-test-expected.png Binary files differnew file mode 100644 index 0000000..80b70ba --- /dev/null +++ b/tests/regression/cgalpngtest/child-child-test-expected.png diff --git a/tests/regression/cgalpngtest/child-tests-expected.png b/tests/regression/cgalpngtest/child-tests-expected.png Binary files differindex ed6207c..eb34f18 100644 --- a/tests/regression/cgalpngtest/child-tests-expected.png +++ b/tests/regression/cgalpngtest/child-tests-expected.png diff --git a/tests/regression/cgalpngtest/linear_extrude-scale-zero-tests-expected.png b/tests/regression/cgalpngtest/linear_extrude-scale-zero-tests-expected.png Binary files differnew file mode 100644 index 0000000..3b1c934 --- /dev/null +++ b/tests/regression/cgalpngtest/linear_extrude-scale-zero-tests-expected.png diff --git a/tests/regression/cgalpngtest/linear_extrude-tests-expected.png b/tests/regression/cgalpngtest/linear_extrude-tests-expected.png Binary files differindex 1486743..c85142e 100644 --- a/tests/regression/cgalpngtest/linear_extrude-tests-expected.png +++ b/tests/regression/cgalpngtest/linear_extrude-tests-expected.png diff --git a/tests/regression/cgalpngtest/localfiles-compatibility-test-expected.png b/tests/regression/cgalpngtest/localfiles-compatibility-test-expected.png Binary files differnew file mode 100644 index 0000000..d0cfd50 --- /dev/null +++ b/tests/regression/cgalpngtest/localfiles-compatibility-test-expected.png diff --git a/tests/regression/cgalpngtest/localfiles-test-expected.png b/tests/regression/cgalpngtest/localfiles-test-expected.png Binary files differnew file mode 100644 index 0000000..d0cfd50 --- /dev/null +++ b/tests/regression/cgalpngtest/localfiles-test-expected.png diff --git a/tests/regression/cgalpngtest/module-recursion-expected.png b/tests/regression/cgalpngtest/module-recursion-expected.png Binary files differnew file mode 100644 index 0000000..3012a12 --- /dev/null +++ b/tests/regression/cgalpngtest/module-recursion-expected.png diff --git a/tests/regression/cgalpngtest/modulevariables-expected.png b/tests/regression/cgalpngtest/modulevariables-expected.png Binary files differnew file mode 100644 index 0000000..0dc18e8 --- /dev/null +++ b/tests/regression/cgalpngtest/modulevariables-expected.png diff --git a/tests/regression/cgalpngtest/surface-simple-expected.png b/tests/regression/cgalpngtest/surface-simple-expected.png Binary files differindex 4152c38..d75cda7 100644 --- a/tests/regression/cgalpngtest/surface-simple-expected.png +++ b/tests/regression/cgalpngtest/surface-simple-expected.png diff --git a/tests/regression/dumptest/allmodules-expected.txt b/tests/regression/dumptest/allmodules-expected.txt index 86bb7fb..e6bd498 100644 --- a/tests/regression/dumptest/allmodules-expected.txt +++ b/tests/regression/dumptest/allmodules-expected.txt @@ -10,8 +10,8 @@ union(); difference(); intersection(); - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 2); rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 2); import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/child-child-test-expected.txt b/tests/regression/dumptest/child-child-test-expected.txt new file mode 100644 index 0000000..13f098d --- /dev/null +++ b/tests/regression/dumptest/child-child-test-expected.txt @@ -0,0 +1,59 @@ + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 1, r1 = 5, r2 = 5, center = false); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 1, r1 = 5, r2 = 5, center = false); + } + } + } + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + color([1, 0, 0, 1]) { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 1, r1 = 5, r2 = 5, center = false); + } + } + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + color([1, 0, 0, 1]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 1, r1 = 5, r2 = 5, center = false); + } + } + } + } + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/child-tests-expected.txt b/tests/regression/dumptest/child-tests-expected.txt index 9a886fe..e1a7557 100644 --- a/tests/regression/dumptest/child-tests-expected.txt +++ b/tests/regression/dumptest/child-tests-expected.txt @@ -37,4 +37,16 @@ multmatrix([[1, 0, 0, 5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { group(); } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 16, $fa = 12, $fs = 2, r = 1); + } + multmatrix([[1, 0, 0, 2.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [1, 1, 1], center = true); + } + } + } + } diff --git a/tests/regression/dumptest/dxf_linear_extrude-expected.txt b/tests/regression/dumptest/dxf_linear_extrude-expected.txt index ec46e66..9ad9e00 100644 --- a/tests/regression/dumptest/dxf_linear_extrude-expected.txt +++ b/tests/regression/dumptest/dxf_linear_extrude-expected.txt @@ -1,2 +1,2 @@ - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/example009-expected.txt b/tests/regression/dumptest/example009-expected.txt index b293224..b4c7bcf 100644 --- a/tests/regression/dumptest/example009-expected.txt +++ b/tests/regression/dumptest/example009-expected.txt @@ -1,20 +1,20 @@ - %linear_extrude(height = 22, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 2) { + %linear_extrude(height = 22, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } %group() { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) { - linear_extrude(height = 2, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } } multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -12], [0, 0, 0, 1]]) { - linear_extrude(height = 2, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } } } intersection() { - linear_extrude(height = 20, center = true, convexity = 10, twist = -57.5288, slices = 4, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = true, convexity = 10, twist = -57.5288, slices = 4, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "fan_top", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } rotate_extrude(file = "example009.dxf", layer = "fan_side", origin = [0, -40], scale = 1, convexity = 10, $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/hull2-tests-expected.txt b/tests/regression/dumptest/hull2-tests-expected.txt index e4c5a5b..c14282f 100644 --- a/tests/regression/dumptest/hull2-tests-expected.txt +++ b/tests/regression/dumptest/hull2-tests-expected.txt @@ -56,4 +56,10 @@ } } } + group() { + hull() { + square(size = [0, 0], center = false); + circle($fn = 0, $fa = 12, $fs = 2, r = 0); + } + } diff --git a/tests/regression/dumptest/hull3-tests-expected.txt b/tests/regression/dumptest/hull3-tests-expected.txt index 4c05e2c..f8def3b 100644 --- a/tests/regression/dumptest/hull3-tests-expected.txt +++ b/tests/regression/dumptest/hull3-tests-expected.txt @@ -27,4 +27,10 @@ } } } + group() { + hull() { + cube(size = [0, 0, 0], center = false); + sphere($fn = 0, $fa = 12, $fs = 2, r = 0); + } + } diff --git a/tests/regression/dumptest/include-tests-expected.txt b/tests/regression/dumptest/include-tests-expected.txt index 47f731e..3f3ecd9 100644 --- a/tests/regression/dumptest/include-tests-expected.txt +++ b/tests/regression/dumptest/include-tests-expected.txt @@ -62,7 +62,7 @@ multmatrix([[1, 0, 0, -6], [0, 1, 0, 0], [0, 0, 1, 19], [0, 0, 0, 1]]) { multmatrix([[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) { group() { - linear_extrude(height = 12, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 12, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { polygon(points = [[0, 0], [18, 0], [0, 4]], paths = [[0, 1, 2]], convexity = 1); } } diff --git a/tests/regression/dumptest/linear_extrude-expected.txt b/tests/regression/dumptest/linear_extrude-expected.txt index ec46e66..9ad9e00 100644 --- a/tests/regression/dumptest/linear_extrude-expected.txt +++ b/tests/regression/dumptest/linear_extrude-expected.txt @@ -1,2 +1,2 @@ - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/linear_extrude-scale-zero-tests-expected.txt b/tests/regression/dumptest/linear_extrude-scale-zero-tests-expected.txt new file mode 100644 index 0000000..950c724 --- /dev/null +++ b/tests/regression/dumptest/linear_extrude-scale-zero-tests-expected.txt @@ -0,0 +1,253 @@ + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/linear_extrude-tests-expected.txt b/tests/regression/dumptest/linear_extrude-tests-expected.txt index cba1189..c867388 100644 --- a/tests/regression/dumptest/linear_extrude-tests-expected.txt +++ b/tests/regression/dumptest/linear_extrude-tests-expected.txt @@ -3,11 +3,11 @@ rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 2) { cube(size = [1, 1, 1], center = false); } - linear_extrude(height = 10, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 10, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } multmatrix([[1, 0, 0, 19], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 10, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 10, center = true, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { difference() { circle($fn = 0, $fa = 12, $fs = 2, r = 5); circle($fn = 0, $fa = 12, $fs = 2, r = 3); @@ -15,17 +15,42 @@ } } multmatrix([[1, 0, 0, 31.5], [0, 1, 0, 2.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 10, center = false, convexity = 1, twist = -45, slices = 3, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 10, center = false, convexity = 1, twist = -45, slices = 3, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { polygon(points = [[-5, -2.5], [5, -2.5], [0, 2.5]], paths = undef, convexity = 1); } } multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 2, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } } multmatrix([[1, 0, 0, 19], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 10, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { + square(size = [10, 10], center = false); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 5, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { + square(size = [10, 10], center = false); + } + } + multmatrix([[1, 0, 0, -25], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 10, center = false, convexity = 1, scale = [2, 2], $fn = 0, $fa = 12, $fs = 2) { + square(size = [5, 5], center = true); + } + } + multmatrix([[1, 0, 0, -15], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { + square(size = [10, 10], center = false); + } + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 15, center = false, convexity = 1, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + square(size = [10, 10], center = true); + } + } + multmatrix([[1, 0, 0, -15], [0, 1, 0, -15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 10, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } } diff --git a/tests/regression/dumptest/localfiles-compatibility-test-expected.txt b/tests/regression/dumptest/localfiles-compatibility-test-expected.txt new file mode 100644 index 0000000..95ba49b --- /dev/null +++ b/tests/regression/dumptest/localfiles-compatibility-test-expected.txt @@ -0,0 +1,20 @@ + group() { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { + import(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, -250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 350], [0, 0, 1, 0], [0, 0, 0, 1]]) { + rotate_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, 250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[200, 0, 0, 0], [0, 200, 0, 0], [0, 0, 50, 0], [0, 0, 0, 1]]) { + surface(file = "localfile.dat", center = false); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -200], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 2, r = 100); + } + } + diff --git a/tests/regression/dumptest/localfiles-test-expected.txt b/tests/regression/dumptest/localfiles-test-expected.txt new file mode 100644 index 0000000..a7e81e5 --- /dev/null +++ b/tests/regression/dumptest/localfiles-test-expected.txt @@ -0,0 +1,20 @@ + group() { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { + import(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, -250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 350], [0, 0, 1, 0], [0, 0, 0, 1]]) { + rotate_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, 250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[200, 0, 0, 0], [0, 200, 0, 0], [0, 0, 50, 0], [0, 0, 0, 1]]) { + surface(file = "localfiles_dir/localfile.dat", center = false); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -200], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 2, r = 100); + } + } + diff --git a/tests/regression/dumptest/module-recursion-expected.txt b/tests/regression/dumptest/module-recursion-expected.txt new file mode 100644 index 0000000..9ad8877 --- /dev/null +++ b/tests/regression/dumptest/module-recursion-expected.txt @@ -0,0 +1,244 @@ + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 1, r1 = 0.2, r2 = 0.2, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 1], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.7, r1 = 0.14, r2 = 0.14, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.7], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.49, r1 = 0.098, r2 = 0.098, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.49], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.49, r1 = 0.098, r2 = 0.098, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.49], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.7, r1 = 0.14, r2 = 0.14, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.7], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.49, r1 = 0.098, r2 = 0.098, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.49], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.49, r1 = 0.098, r2 = 0.098, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.49], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 0.343, r1 = 0.0686, r2 = 0.0686, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.343], [0, 0, 0, 1]]) { + group() { + multmatrix([[-1, 0, 0, 0], [0, -0.76604444311, 0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + multmatrix([[1, 0, 0, 0], [0, 0.76604444311, -0.64278760968, 0], [0, 0.64278760968, 0.76604444311, 0], [0, 0, 0, 1]]) { + group() { + group(); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/modulevariables-expected.txt b/tests/regression/dumptest/modulevariables-expected.txt new file mode 100644 index 0000000..fed4bbc --- /dev/null +++ b/tests/regression/dumptest/modulevariables-expected.txt @@ -0,0 +1,4 @@ + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 10, r1 = 23, r2 = 10, center = false); + } + diff --git a/tests/regression/dumptest/projection-tests-expected.txt b/tests/regression/dumptest/projection-tests-expected.txt index 69cb49c..92e6870 100644 --- a/tests/regression/dumptest/projection-tests-expected.txt +++ b/tests/regression/dumptest/projection-tests-expected.txt @@ -3,13 +3,13 @@ projection(cut = true, convexity = 0) { square(size = [1, 1], center = false); } - linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = false, convexity = 0) { sphere($fn = 0, $fa = 12, $fs = 2, r = 10); } } multmatrix([[1, 0, 0, 22], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 9], [0, 0, 0, 1]]) { sphere($fn = 0, $fa = 12, $fs = 2, r = 10); @@ -18,7 +18,7 @@ } } multmatrix([[1, 0, 0, 44], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7], [0, 0, 0, 1]]) { sphere($fn = 0, $fa = 12, $fs = 2, r = 10); @@ -27,7 +27,7 @@ } } multmatrix([[1, 0, 0, 0], [0, 1, 0, -22], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 5, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 5, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -4.999999], [0, 0, 0, 1]]) { cube(size = [10, 10, 10], center = true); @@ -36,7 +36,7 @@ } } multmatrix([[1, 0, 0, 0], [0, 1, 0, -44], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 5, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 5, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { union() { difference() { diff --git a/tests/regression/dumptest/scale2D-tests-expected.txt b/tests/regression/dumptest/scale2D-tests-expected.txt index 6d4c096..9465b8c 100644 --- a/tests/regression/dumptest/scale2D-tests-expected.txt +++ b/tests/regression/dumptest/scale2D-tests-expected.txt @@ -17,14 +17,14 @@ } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { group() { square(size = [2, 3], center = true); } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { group() { square(size = [2, 3], center = true); diff --git a/tests/regression/dumptest/scale3D-tests-expected.txt b/tests/regression/dumptest/scale3D-tests-expected.txt index c06b2fe..e802117 100644 --- a/tests/regression/dumptest/scale3D-tests-expected.txt +++ b/tests/regression/dumptest/scale3D-tests-expected.txt @@ -19,21 +19,21 @@ } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { group() { cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { group() { cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { group() { cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); diff --git a/tests/regression/dumptest/surface-simple-expected.txt b/tests/regression/dumptest/surface-simple-expected.txt index 3b42fcb..48c918f 100644 --- a/tests/regression/dumptest/surface-simple-expected.txt +++ b/tests/regression/dumptest/surface-simple-expected.txt @@ -1,2 +1,5 @@ surface(file = "surface-simple.dat", center = true); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + surface(file = "surface-simple2.dat", center = true); + } diff --git a/tests/regression/dumptest/use-tests-expected.txt b/tests/regression/dumptest/use-tests-expected.txt index dce0b7d..1095708 100644 --- a/tests/regression/dumptest/use-tests-expected.txt +++ b/tests/regression/dumptest/use-tests-expected.txt @@ -39,10 +39,10 @@ group() { multmatrix([[0, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 0, 0], [0, 0, 0, 1]]) { union() { - linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { circle($fn = 30, $fa = 12, $fs = 2, r = 0.3); } - linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = false, convexity = 0) { multmatrix([[0, 0, -1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.31819805153], [0, 0, 0, 1]]) { @@ -81,7 +81,7 @@ multmatrix([[1, 0, 0, -6], [0, 1, 0, 0], [0, 0, 1, 19], [0, 0, 0, 1]]) { multmatrix([[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) { group() { - linear_extrude(height = 12, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 12, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { polygon(points = [[0, 0], [18, 0], [0, 4]], paths = [[0, 1, 2]], convexity = 1); } } diff --git a/tests/regression/echotest/lookup-tests-expected.txt b/tests/regression/echotest/lookup-tests-expected.txt new file mode 100644 index 0000000..b98ebe2 --- /dev/null +++ b/tests/regression/echotest/lookup-tests-expected.txt @@ -0,0 +1,15 @@ +ECHO: undef +ECHO: undef +ECHO: undef +ECHO: undef +ECHO: 0 +ECHO: 0.5 +ECHO: -55 +ECHO: -55 +ECHO: -54.44444444444 +ECHO: -2.5 +ECHO: 0 +ECHO: 0.9 +ECHO: 6.66666666666 +ECHO: 333 +ECHO: 333 diff --git a/tests/regression/echotest/recursion-tests-expected.txt b/tests/regression/echotest/recursion-tests-expected.txt index f4897ee..e5c99b1 100644 --- a/tests/regression/echotest/recursion-tests-expected.txt +++ b/tests/regression/echotest/recursion-tests-expected.txt @@ -1,2 +1,2 @@ -Recursion detected calling function 'crash' +ERROR: Recursion detected calling function 'crash' ECHO: undef diff --git a/tests/regression/echotest/search-tests-expected.txt b/tests/regression/echotest/search-tests-expected.txt index 64df0b6..0269f43 100644 --- a/tests/regression/echotest/search-tests-expected.txt +++ b/tests/regression/echotest/search-tests-expected.txt @@ -1,9 +1,9 @@ - search term not found: "q" - search term not found: 1000 - search term not found: "zzz" - search term not found: "zzz" - search term not found: 500 - search term not found: "" + WARNING: search term not found: "q" + WARNING: search term not found: 1000 + WARNING: search term not found: "zzz" + WARNING: search term not found: "zzz" + WARNING: search term not found: 500 + WARNING: search term not found: "" ECHO: "Characters in string (\"a\"): [0]" ECHO: "Characters in string (\"adeq\"): [[0, 5], [3, 8], [4], []]" ECHO: "Default string search (\"abe\"): [0, 1, 8]" diff --git a/tests/regression/echotest/variable-scope-tests-expected.txt b/tests/regression/echotest/variable-scope-tests-expected.txt new file mode 100644 index 0000000..92db05d --- /dev/null +++ b/tests/regression/echotest/variable-scope-tests-expected.txt @@ -0,0 +1,16 @@ +ECHO: "special variable inheritance" +ECHO: 23, 5 +WARNING: Ignoring unknown variable 'a'. +ECHO: undef +ECHO: 23, 5 +ECHO: "inner variables shadows parameter" +ECHO: 5, 24 +ECHO: "user-defined special variables as parameter" +ECHO: 7 +ECHO: 7 +ECHO: "assign only visible in children's scope" +WARNING: Ignoring unknown variable 'c'. +ECHO: undef +ECHO: 5 +ECHO: "undeclared variable can still be passed and used" +ECHO: 6 diff --git a/tests/regression/opencsgtest/child-child-test-expected.png b/tests/regression/opencsgtest/child-child-test-expected.png Binary files differnew file mode 100644 index 0000000..07d61c0 --- /dev/null +++ b/tests/regression/opencsgtest/child-child-test-expected.png diff --git a/tests/regression/opencsgtest/child-tests-expected.png b/tests/regression/opencsgtest/child-tests-expected.png Binary files differindex e8ea39b..2ff902c 100644 --- a/tests/regression/opencsgtest/child-tests-expected.png +++ b/tests/regression/opencsgtest/child-tests-expected.png diff --git a/tests/regression/opencsgtest/linear_extrude-scale-zero-tests-expected.png b/tests/regression/opencsgtest/linear_extrude-scale-zero-tests-expected.png Binary files differnew file mode 100644 index 0000000..22e94ad --- /dev/null +++ b/tests/regression/opencsgtest/linear_extrude-scale-zero-tests-expected.png diff --git a/tests/regression/opencsgtest/linear_extrude-tests-expected.png b/tests/regression/opencsgtest/linear_extrude-tests-expected.png Binary files differindex f31b22a..cbbdc11 100644 --- a/tests/regression/opencsgtest/linear_extrude-tests-expected.png +++ b/tests/regression/opencsgtest/linear_extrude-tests-expected.png diff --git a/tests/regression/opencsgtest/localfiles-compatibility-test-expected.png b/tests/regression/opencsgtest/localfiles-compatibility-test-expected.png Binary files differnew file mode 100644 index 0000000..f280efd --- /dev/null +++ b/tests/regression/opencsgtest/localfiles-compatibility-test-expected.png diff --git a/tests/regression/opencsgtest/localfiles-test-expected.png b/tests/regression/opencsgtest/localfiles-test-expected.png Binary files differnew file mode 100644 index 0000000..f280efd --- /dev/null +++ b/tests/regression/opencsgtest/localfiles-test-expected.png diff --git a/tests/regression/opencsgtest/module-recursion-expected.png b/tests/regression/opencsgtest/module-recursion-expected.png Binary files differnew file mode 100644 index 0000000..324c260 --- /dev/null +++ b/tests/regression/opencsgtest/module-recursion-expected.png diff --git a/tests/regression/opencsgtest/modulevariables-expected.png b/tests/regression/opencsgtest/modulevariables-expected.png Binary files differnew file mode 100644 index 0000000..bf23265 --- /dev/null +++ b/tests/regression/opencsgtest/modulevariables-expected.png diff --git a/tests/regression/opencsgtest/surface-simple-expected.png b/tests/regression/opencsgtest/surface-simple-expected.png Binary files differindex 2abef81..08abd5a 100644 --- a/tests/regression/opencsgtest/surface-simple-expected.png +++ b/tests/regression/opencsgtest/surface-simple-expected.png diff --git a/tests/regression/throwntogethertest/child-child-test-expected.png b/tests/regression/throwntogethertest/child-child-test-expected.png Binary files differnew file mode 100644 index 0000000..07d61c0 --- /dev/null +++ b/tests/regression/throwntogethertest/child-child-test-expected.png diff --git a/tests/regression/throwntogethertest/child-tests-expected.png b/tests/regression/throwntogethertest/child-tests-expected.png Binary files differindex 561334e..2ff902c 100644 --- a/tests/regression/throwntogethertest/child-tests-expected.png +++ b/tests/regression/throwntogethertest/child-tests-expected.png diff --git a/tests/regression/throwntogethertest/linear_extrude-scale-zero-tests-expected.png b/tests/regression/throwntogethertest/linear_extrude-scale-zero-tests-expected.png Binary files differnew file mode 100644 index 0000000..22e94ad --- /dev/null +++ b/tests/regression/throwntogethertest/linear_extrude-scale-zero-tests-expected.png diff --git a/tests/regression/throwntogethertest/linear_extrude-tests-expected.png b/tests/regression/throwntogethertest/linear_extrude-tests-expected.png Binary files differindex b672783..cbbdc11 100644 --- a/tests/regression/throwntogethertest/linear_extrude-tests-expected.png +++ b/tests/regression/throwntogethertest/linear_extrude-tests-expected.png diff --git a/tests/regression/throwntogethertest/localfiles-compatibility-test-expected.png b/tests/regression/throwntogethertest/localfiles-compatibility-test-expected.png Binary files differnew file mode 100644 index 0000000..f280efd --- /dev/null +++ b/tests/regression/throwntogethertest/localfiles-compatibility-test-expected.png diff --git a/tests/regression/throwntogethertest/localfiles-test-expected.png b/tests/regression/throwntogethertest/localfiles-test-expected.png Binary files differnew file mode 100644 index 0000000..f280efd --- /dev/null +++ b/tests/regression/throwntogethertest/localfiles-test-expected.png diff --git a/tests/regression/throwntogethertest/module-recursion-expected.png b/tests/regression/throwntogethertest/module-recursion-expected.png Binary files differnew file mode 100644 index 0000000..324c260 --- /dev/null +++ b/tests/regression/throwntogethertest/module-recursion-expected.png diff --git a/tests/regression/throwntogethertest/modulevariables-expected.png b/tests/regression/throwntogethertest/modulevariables-expected.png Binary files differnew file mode 100644 index 0000000..bf23265 --- /dev/null +++ b/tests/regression/throwntogethertest/modulevariables-expected.png diff --git a/tests/regression/throwntogethertest/surface-simple-expected.png b/tests/regression/throwntogethertest/surface-simple-expected.png Binary files differindex 2abef81..08abd5a 100644 --- a/tests/regression/throwntogethertest/surface-simple-expected.png +++ b/tests/regression/throwntogethertest/surface-simple-expected.png diff --git a/tests/test_cmdline_tool.py b/tests/test_cmdline_tool.py index eb01abd..470be1e 100755 --- a/tests/test_cmdline_tool.py +++ b/tests/test_cmdline_tool.py @@ -256,5 +256,6 @@ if __name__ == '__main__': verification = verify_test(options.testname, options.cmd) resultfile = run_test(options.testname, options.cmd, args[1:]) - + if not resultfile: exit(1) + if not verification or not compare_with_expected(resultfile): exit(1) diff --git a/tests/tests-common.cc b/tests/tests-common.cc index 703e1c5..3c66e1b 100644 --- a/tests/tests-common.cc +++ b/tests/tests-common.cc @@ -7,9 +7,14 @@ #include <sstream> #include <fstream> -Module *parsefile(const char *filename) +/*! + fakepath is used to force the parser to believe that the file is + read from this location, in order to ensure that filepaths are + eavluated relative to this path (for testing purposes). +*/ +FileModule *parsefile(const char *filename, const char *fakepath) { - Module *root_module = NULL; + FileModule *root_module = NULL; handle_dep(filename); std::ifstream ifs(filename); @@ -19,7 +24,9 @@ Module *parsefile(const char *filename) else { std::string text((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>()); text += "\n" + commandline_commands; - std::string pathname = boosty::stringy(fs::path(filename).parent_path()); + std::string pathname; + if (fakepath) pathname = fakepath; + else pathname = boosty::stringy(fs::path(filename).parent_path()); root_module = parse(text.c_str(), pathname.c_str(), false); if (root_module) { root_module->handleDependencies(); diff --git a/tests/tests-common.h b/tests/tests-common.h index 0047562..e16bcda 100644 --- a/tests/tests-common.h +++ b/tests/tests-common.h @@ -1,6 +1,8 @@ #ifndef TESTS_COMMON_H_ #define TESTS_COMMON_H_ -class Module *parsefile(const char *filename); +#include <stdlib.h> + +class FileModule *parsefile(const char *filename, const char *fakepath = NULL); #endif |