diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tests/cgalpngtest.cc | 21 | ||||
-rw-r--r-- | tests/cgaltest.cc | 21 | ||||
-rw-r--r-- | tests/csgtermtest.cc | 21 | ||||
-rw-r--r-- | tests/csgtestcore.cc | 16 | ||||
-rw-r--r-- | tests/csgtexttest.cc | 21 | ||||
-rw-r--r-- | tests/dumptest.cc | 16 | ||||
-rw-r--r-- | tests/echotest.cc | 16 | ||||
-rw-r--r-- | tests/regression/echotest/builtin-tests-expected.txt | 1 | ||||
-rw-r--r-- | tests/regression/echotest/parser-tests-expected.txt | 5 |
10 files changed, 28 insertions, 114 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 259ec76..3167792 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -353,7 +353,9 @@ list(APPEND DUMPTEST_FILES ${MINIMAL_FILES} list(APPEND ECHO_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/minimal/echo.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/features/echo-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/features/echo-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parser-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/builtin-tests.scad) # Add echotest tests to CTest add_cmdline_test(echotest txt ${ECHO_FILES}) diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index 734f6eb..bb65fa0 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -127,21 +128,7 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index 2c83cc8..242b7b7 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,21 +112,7 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 98134f7..08002e2 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,21 +97,7 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 2390f06..8460a59 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -106,21 +106,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index fe94497..afa5bbe 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,21 +100,7 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 8e48d24..7344f95 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -118,21 +118,7 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; diff --git a/tests/echotest.cc b/tests/echotest.cc index 046f883..329aac2 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -104,21 +104,7 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; diff --git a/tests/regression/echotest/builtin-tests-expected.txt b/tests/regression/echotest/builtin-tests-expected.txt new file mode 100644 index 0000000..e8b2027 --- /dev/null +++ b/tests/regression/echotest/builtin-tests-expected.txt @@ -0,0 +1 @@ +ECHO: 3.141592653589793 diff --git a/tests/regression/echotest/parser-tests-expected.txt b/tests/regression/echotest/parser-tests-expected.txt new file mode 100644 index 0000000..fb04907 --- /dev/null +++ b/tests/regression/echotest/parser-tests-expected.txt @@ -0,0 +1,5 @@ +ECHO: 0.1 +ECHO: 2 +ECHO: 1100 +ECHO: 0.021 +ECHO: 1.1e-13 |