From eaca4d39f176acbcc567d0cb18dd9fb6c92ad60d Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Tue, 10 Jul 2012 13:02:28 +1000 Subject: A few other changes that were needed for tests I must have forgotten to commit them earlier. How annoying. --- impl/EquationSystem.g | 1 + impl/TODO.org | 9 +++++---- impl/main.cpp | 17 ++++++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/impl/EquationSystem.g b/impl/EquationSystem.g index 3a6598a..07e8e71 100644 --- a/impl/EquationSystem.g +++ b/impl/EquationSystem.g @@ -30,6 +30,7 @@ expr : '(' expr GREATER_EQUAL expr QUESTION_MARK expr ')' -> ^(GUARD expr expr e term : NUMBER | VARIABLE + | '-'^ term | '('! expr ')'! ; diff --git a/impl/TODO.org b/impl/TODO.org index 4d14b64..a33f685 100644 --- a/impl/TODO.org +++ b/impl/TODO.org @@ -33,14 +33,15 @@ - [ ] info print the initial system we're working with -* TODO make test [0/4] -- [ ] write test cases [/] +* TODO make test [2/4] +- [-] write test cases [1/4] + - [X] examples from paper - [ ] best cases - [ ] worst cases - [ ] average cases - [ ] work out correct outputs for each test case -- [ ] write a script to run over each test case and return pass/fail -- [ ] consolidate into makefile as `make test` +- [X] write a script to run over each test case and return pass/fail +- [X] consolidate into makefile as `make test` * TODO Parametrise EquationSystem for Variable, too [0/1] - [ ] Give EquationSystem a template parameter for Variable diff --git a/impl/main.cpp b/impl/main.cpp index 726fa3e..2b7a9a1 100644 --- a/impl/main.cpp +++ b/impl/main.cpp @@ -98,7 +98,7 @@ void treeToSystem(pANTLR3_BASE_TREE node, EquationSystem& system) { typedef Complete ZBar; int main (int argc, char* argv[]) { if (argc <= 3) { - cout << "Usage: " << argv[0] << " filename fixpoint strategy [log]" << endl + cerr << "Usage: " << argv[0] << " filename fixpoint strategy [log]" << endl << " fixpoint: naive | smart" << endl << " strategy: naive | repeat | smart" << endl << " log: section[,section[,section[...]]]" << endl; @@ -135,12 +135,12 @@ int main (int argc, char* argv[]) { FixpointAlgorithm* algorithm = NULL; if (!strcmp(argv[2], "naive")) { algorithm = new NaiveFixpointAlgorithm(system); - cout << "Naive fixpoint" << endl; + log::info << "Naive fixpoint" << endl; } else if (!strcmp(argv[2], "smart")) { algorithm = new SmartFixpointAlgorithm(system); - cout << "Smart fixpoint" << endl; + log::info << "Smart fixpoint" << endl; } else { - cout << "Unknown fixpoint algorithm." << endl; + cerr << "Unknown fixpoint algorithm." << endl; } // PARSE ARGUMENTS - strat improvement @@ -148,15 +148,15 @@ int main (int argc, char* argv[]) { ImprovementOperator* improvement = NULL; if (!strcmp(argv[3], "repeat")) { improvement = new RepeatedImprovementOperator(*naiveImprovement); - cout << "Repeated strategy improvement" << endl; + log::info << "Repeated strategy improvement" << endl; } else if (!strcmp(argv[3], "naive")) { improvement = naiveImprovement; - cout << "Naive strategy improvement" << endl; + log::info << "Naive strategy improvement" << endl; } else if (!strcmp(argv[3], "smart")) { improvement = new SmartImprovementOperator(system); - cout << "Smart strategy improvement" << endl; + log::info << "Smart strategy improvement" << endl; } else { - cout << "Unknown strategy improvement algorithm." << endl; + cerr << "Unknown strategy improvement algorithm." << endl; } if (!improvement || !algorithm) { exit(1); @@ -182,7 +182,6 @@ int main (int argc, char* argv[]) { log::debug << "Changed: " << (changed ? "true" : "false") << std::endl; } while(changed); - cout << endl; for (unsigned int i = 0, size = system.variableCount(); i < size; ++i) { Variable& var = system.variable(i); cout << var.name() << " = " << result[var] << endl; -- cgit v1.2.3