diff options
Diffstat (limited to 'tests/csgtermtest.cc')
-rw-r--r-- | tests/csgtermtest.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 80b9b9c..643a64f 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -47,6 +47,7 @@ #include <assert.h> #include <iostream> #include <sstream> +#include <fstream> using std::cout; @@ -57,12 +58,13 @@ QString librarydir; int main(int argc, char **argv) { - if (argc != 2) { - fprintf(stderr, "Usage: %s <file.scad>\n", argv[0]); + if (argc != 3) { + fprintf(stderr, "Usage: %s <file.scad> <output.txt>\n", argv[0]); exit(1); } const char *filename = argv[1]; + const char *outfilename = argv[2]; int rc = 0; @@ -161,12 +163,15 @@ int main(int argc, char **argv) // if (evaluator.background) cout << "Background terms: " << evaluator.background->size() << "\n"; // if (evaluator.highlights) cout << "Highlights terms: " << evaluator.highlights->size() << "\n"; + std::ofstream outfile; + outfile.open(outfilename); if (root_term) { - cout << root_term->dump() << "\n"; + outfile << root_term->dump() << "\n"; } else { - cout << "No top-level CSG object\n"; + outfile << "No top-level CSG object\n"; } + outfile.close(); destroy_builtin_functions(); destroy_builtin_modules(); |