summaryrefslogtreecommitdiff
path: root/i/marvin/src/tester/test_tester.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/tester/test_tester.cc')
-rw-r--r--i/marvin/src/tester/test_tester.cc57
1 files changed, 9 insertions, 48 deletions
diff --git a/i/marvin/src/tester/test_tester.cc b/i/marvin/src/tester/test_tester.cc
index 6e1c208..3075552 100644
--- a/i/marvin/src/tester/test_tester.cc
+++ b/i/marvin/src/tester/test_tester.cc
@@ -24,10 +24,6 @@
// }}}
#include "tester.hh"
-#include <iostream>
-#include <algorithm>
-#include <iterator>
-
class TestTester
{
Tester t;
@@ -35,7 +31,7 @@ class TestTester
// Constructor
TestTester (int argc, char ** argv)
: t (argc, argv) { }
- bool funcA (const Tester::Args &a)
+ bool funcA (const Interpreter::Args &a)
{
std::cout << " a " << a << std::endl;
return true;
@@ -60,52 +56,17 @@ class TestTester
std::cout << " e ( " << i << ' ' << s << ' ' << d << " )" << std::endl;
return true;
}
- void call (const std::string &s, const Tester::Args &a)
- {
- try
- {
- std::cout << "call " << s << ' ' << a << std::endl;
- t.call (s, a);
- }
- catch (const std::exception &e)
- {
- // Do not use std::cerr as there should be only normal errors.
- std::cout << ' ' << e.what () << std::endl;
- }
- }
- int run (void)
+ int main (void)
{
- t.add ("m", Tester::memFunc (*this, &TestTester::main));
+ // Add functions.
+ t.add ("a", Interpreter::memFunc (*this, &TestTester::funcA));
+ t.add ("b", Interpreter::memFunc (*this, &TestTester::funcB));
+ t.add ("c", Interpreter::memFunc (*this, &TestTester::funcC));
+ t.add ("d", Interpreter::memFunc (*this, &TestTester::funcD));
+ t.add ("e", Interpreter::memFunc (*this, &TestTester::funcE));
t.run ();
return 0;
}
- bool main (void)
- {
- Tester::Args a[4];
- // Add functions.
- t.add ("a", Tester::memFunc (*this, &TestTester::funcA));
- t.add ("b", Tester::memFunc (*this, &TestTester::funcB));
- t.add ("c", Tester::memFunc (*this, &TestTester::funcC));
- t.add ("d", Tester::memFunc (*this, &TestTester::funcD));
- t.add ("e", Tester::memFunc (*this, &TestTester::funcE));
- // Make argument lists.
- a[1].push_back (71117);
- a[2].push_back (std::string ("robert"));
- a[3].push_back (42);
- a[3].push_back (std::string ("merguez"));
- a[3].push_back (51.1664);
- // Call all those wonderful functions.
- call ("unknown", a[0]);
- for (unsigned int i = 0; i < sizeof (a) / sizeof (a[0]); ++i)
- {
- call ("a", a[i]);
- call ("b", a[i]);
- call ("c", a[i]);
- call ("d", a[i]);
- call ("e", a[i]);
- }
- return true;
- }
};
int
@@ -114,7 +75,7 @@ main (int argc, char **argv)
TestTester tt (argc, argv);
try
{
- return tt.run ();
+ return tt.main ();
}
catch (const std::exception &e)
{