summaryrefslogtreecommitdiff
path: root/i/marvin/src/tester/tester.hh
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/tester/tester.hh')
-rw-r--r--i/marvin/src/tester/tester.hh48
1 files changed, 5 insertions, 43 deletions
diff --git a/i/marvin/src/tester/tester.hh b/i/marvin/src/tester/tester.hh
index e38967d..c476125 100644
--- a/i/marvin/src/tester/tester.hh
+++ b/i/marvin/src/tester/tester.hh
@@ -24,71 +24,33 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// }}}
-#include "utils/any.hh"
#include "config/config.hh"
+#include "interpreter/interpreter.hh"
-#include <map>
#include <string>
class Tester
{
- public:
- /// Test function argument.
- typedef any Arg;
- /// Test function argument list.
- typedef std::list<Arg> Args;
- /// Test functions must inherit from this type.
- class Func
- {
- public:
- /// Mandatory virtual destructor.
- virtual ~Func (void)
- { }
- /// Called on function invocation, getting the argument list and
- /// returning true on success.
- virtual bool operator() (const Args &) = 0;
- };
- private:
- /// Func class construction helper.
- template<class T, typename F>
- class MemFunc;
private:
- /// Type of the private function map.
- typedef std::map<std::string, Func *> Funcs;
- /// The function map itself.
- Funcs funcs_;
/// The config.
Config config_;
+ /// The interperter
+ Interpreter interpreter_;
/// Program name.
std::string program_;
/// Commands to parse.
std::string commands_;
/// Getopt command line.
void getOpt (int argc, char **argv);
- /// Run command list.
- /// If check is true, the command list will be checked, otherwise, it
- /// will be executed. If check failed, it throw an exception.
- void parse (const std::string &command, bool check);
/// Print usage to stdout.
- void usage (void);
+ void usage (void) const;
public:
/// Constructor.
Tester (int argc, char ** argv);
- /// Destructor.
- ~Tester (void);
/// Add a test function, Tester owns f.
- void add (const std::string &s, Func *f);
- /// Call a test function by name.
- bool call (const std::string &s, const Args &a) const;
- /// Check function exists.
- bool exist (const std::string &s);
- /// Take all the template sophistications out of the programmer hands.
- template<class T, typename F>
- static Func *memFunc (T &i, F f);
+ void add (const std::string &s, Interpreter::Func *f);
/// Run commands.
void run (void);
};
-#include "tester.tcc"
-
#endif // tester_hh