1 |
|
|
// The purpose of this unit test is to evaluate the memory consumption |
2 |
|
|
// when call the interpreter. |
3 |
|
|
#include "dynamic-graph/python/interpreter.hh" |
4 |
|
|
|
5 |
|
1 |
int main(int argc, char** argv) { |
6 |
|
1 |
int numTest = 1; |
7 |
✗✓ |
1 |
if (argc > 1) numTest = atoi(argv[1]); |
8 |
|
|
|
9 |
✓✗ |
2 |
dynamicgraph::python::Interpreter interp; |
10 |
|
2 |
std::string command; |
11 |
|
2 |
std::string result; |
12 |
|
2 |
std::string out; |
13 |
|
1 |
std::string err; |
14 |
|
|
|
15 |
✓✓ |
2 |
for (int i = 0; i < numTest; ++i) { |
16 |
|
|
// correct input |
17 |
✓✗✓✗
|
1 |
interp.python("print('I am the interpreter')", result, out, err); |
18 |
✗✓ |
1 |
assert(out.compare("I am the interpreter")); |
19 |
✗✓ |
1 |
assert(err.length() == 0); |
20 |
|
|
// incorrect input |
21 |
✓✗✓✗
|
1 |
interp.python("print I am the interpreter", result, out, err); |
22 |
✗✓ |
1 |
assert(result.length() == 0); |
23 |
✗✓ |
1 |
assert(out.length() == 0); |
24 |
✗✓ |
1 |
assert(err.length() > 50); |
25 |
|
|
} |
26 |
|
1 |
return 0; |
27 |
|
|
} |