diff options
author | Marius Kintel <marius@kintel.net> | 2010-04-12 00:16:36 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2010-10-31 00:42:35 (GMT) |
commit | e8e213b3c9ce0580045ea6e7e86b00ab41d4c58b (patch) | |
tree | cb32e67b6334aa1f1dc62aa4a0686a22782e7f77 /test-code/dumptest.cc | |
parent | 53a9953b7dc4ab4a366046c91529b32fb6652551 (diff) |
Another refactoring session:
o mk_cache_id() obsoleted by removing the node index from the dump
o node index output removed from each node and make optional in NodeDumper
o The visitors are no longer global, but associated with a tree
o Added Tree class to manage node trees and the (now implicit) dump cache
o Moved PolySet cache into PolySetRenderer
Diffstat (limited to 'test-code/dumptest.cc')
-rw-r--r-- | test-code/dumptest.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/test-code/dumptest.cc b/test-code/dumptest.cc index 36261b6..e26259c 100644 --- a/test-code/dumptest.cc +++ b/test-code/dumptest.cc @@ -31,12 +31,17 @@ #include "export.h" #include "builtin.h" #include "nodedumper.h" +#include "Tree.h" #include <QApplication> #include <QFile> #include <QDir> #include <QSet> #include <getopt.h> +#include <assert.h> +#include <iostream> + +using std::string; QString commandline_commands; const char *make_command = NULL; @@ -144,23 +149,15 @@ int main(int argc, char **argv) root_node = root_module->evaluate(&root_ctx, &root_inst); // Cache test - QString dumpstr = root_node->dump(); - QString dumpstr_cached = root_node->dump(); - if (dumpstr != dumpstr_cached) rc = 1; - - NodeDumper dumper; - Traverser trav(dumper, *root_node, Traverser::PRE_AND_POSTFIX); - trav.execute(); - std::string dumpstdstr = dumper.getDump() + "\n"; - trav.execute(); - std::string dumpstdstr_cached = dumper.getDump() + "\n"; + QString teststr("test"); + Tree tree; + tree.setRoot(root_node); + + string dumpstdstr = tree.getString(*root_node); + string dumpstdstr_cached = tree.getString(*root_node); if (dumpstdstr != dumpstdstr_cached) rc = 1; - if (QString::fromStdString(dumpstdstr) != dumpstr) { - printf(dumpstr.toUtf8()); - printf(dumpstdstr.c_str()); - rc = 1; - } + std::cout << dumpstdstr << "\n"; destroy_builtin_functions(); destroy_builtin_modules(); |