summaryrefslogtreecommitdiff
path: root/i/marvin/src/interpreter/test_interpreter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/interpreter/test_interpreter.cc')
-rw-r--r--i/marvin/src/interpreter/test_interpreter.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/i/marvin/src/interpreter/test_interpreter.cc b/i/marvin/src/interpreter/test_interpreter.cc
index d51357d..631d10d 100644
--- a/i/marvin/src/interpreter/test_interpreter.cc
+++ b/i/marvin/src/interpreter/test_interpreter.cc
@@ -86,11 +86,20 @@ class TestInterpreter
int main (void)
{
// Add functions.
- t.add ("a", Interpreter::memFunc (*this, &TestInterpreter::funcA));
- t.add ("b", Interpreter::memFunc (*this, &TestInterpreter::funcB));
- t.add ("c", Interpreter::memFunc (*this, &TestInterpreter::funcC));
- t.add ("d", Interpreter::memFunc (*this, &TestInterpreter::funcD));
- t.add ("e", Interpreter::memFunc (*this, &TestInterpreter::funcE));
+ t.add ("a", Interpreter::memFunc (*this, &TestInterpreter::funcA),
+ "a ARGS...\n"
+ "the wonderful `a' function taking any number of any arguments");
+ t.add ("b", Interpreter::memFunc (*this, &TestInterpreter::funcB),
+ "b\ntakes no argument");
+ t.add ("c", Interpreter::memFunc (*this, &TestInterpreter::funcC),
+ "c THE_MIGHTY_NUMBER\n"
+ "takes one integer");
+ t.add ("d", Interpreter::memFunc (*this, &TestInterpreter::funcD),
+ "d THE_STRING\n"
+ "takes one string");
+ t.add ("e", Interpreter::memFunc (*this, &TestInterpreter::funcE),
+ "e INT STRING DOUBLE\n"
+ "takes one integer, one string and one double");
// Make argument lists.
Interpreter::Args a[4];
a[1].push_back (71117);
@@ -98,6 +107,8 @@ class TestInterpreter
a[3].push_back (42);
a[3].push_back (std::string ("merguez"));
a[3].push_back (51.1664);
+ // Need help?
+ std::cout << t.help () << std::endl;
// Call all those wonderful functions.
call ("unknown", a[0]);
for (unsigned int i = 0; i < sizeof (a) / sizeof (a[0]); ++i)