aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/python-console/test_python_interpreter.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/python-console/test_python_interpreter.cpp')
-rw-r--r--3rdparty/python-console/test_python_interpreter.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/3rdparty/python-console/test_python_interpreter.cpp b/3rdparty/python-console/test_python_interpreter.cpp
new file mode 100644
index 00000000..69e16ed1
--- /dev/null
+++ b/3rdparty/python-console/test_python_interpreter.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include "Interpreter.h"
+
+int main( int argc, char *argv[] )
+{
+ std::string commands[] = {
+ "from time import time,ctime\n",
+ "print 'Today is',ctime(time())\n"
+ };
+ Interpreter::Initialize( );
+ Interpreter* interpreter = new Interpreter;
+ for ( int i = 0; i < 2; ++i )
+ {
+ int err;
+ std::string res = interpreter->interpret( commands[i], &err );
+ std::cout << res;
+ }
+ delete interpreter;
+
+ Interpreter::Finalize( );
+ return 0;
+}