a8/test/main.cc
2018-08-26 20:34:01 +08:00

57 lines
1017 B
C++

#include <unistd.h>
#include <a8/a8.h>
#include <a8/pyengine.h>
#include <a8/stringlist.h>
#include "websocket_test.h"
#include "xml_test.h"
#include <Python.h>
void testpy()
{
Py_Initialize();
static struct PyModuleDef SWIG_module = {
PyModuleDef_HEAD_INIT,
(char *) "_game",
NULL,
-1,
nullptr,
NULL,
NULL,
NULL,
NULL
};
auto m = PyModule_Create(&SWIG_module);
PyRun_SimpleString("print('hello')");
}
int main(int argc, char* argv[])
{
testpy();
#if 0
a8::PyEngine pyengine;
pyengine.Init();
pyengine.LoadModule("test");
a8::XObject xobj;
a8::StringList sl;
sl.LoadFromFile("test.json");
xobj.ReadFromJsonString(sl.Text());
std::string data;
xobj.ToJsonStr(data);
printf("%s\r\n", data.c_str());
WebSocket_Test::Instance()->Init();
XMLTest::Instance()->Init();
#endif
while (true) {
printf("....\n");
::sleep(1);
}
return 0;
}