interpreter-test.cc 786 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// The purpose of this unit test is to evaluate the memory consumption 
// when call the interpreter.
#include "dynamic-graph/python/interpreter.hh"

int main(int argc, char ** argv)
{
  int numTest = 1;
  if (argc > 1)
    numTest = atoi(argv[1]);

  dynamicgraph::python::Interpreter interp;
  std::string command;

  for (int i=0; i<numTest; ++i)
  {
    //correct input
    command = "print \"Hello world\"";
    interp.python(command);

    //incorrect input
    command = "print Hello";
    interp.python(command);

    std::string result;
    std::string out;
    std::string err;
    //correct input
    interp.python("print \"I am the interpreter\"", result, out, err);
    //incorrect input
    interp.python("print I am the interpreter", result, out, err);
  }
  return 0;
}