mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
all test passed for globls
This commit is contained in:
parent
b432190c3b
commit
0f4c55ab9d
@ -1,32 +1,32 @@
|
||||
// #include "gtest/gtest.h"
|
||||
// extern "C" {
|
||||
// #include "BaseObj.h"
|
||||
// #include "PikaStdLib_SysObj.h"
|
||||
// #include "TinyObj.h"
|
||||
// }
|
||||
#include "gtest/gtest.h"
|
||||
extern "C" {
|
||||
#include "BaseObj.h"
|
||||
#include "PikaStdLib_SysObj.h"
|
||||
#include "TinyObj.h"
|
||||
}
|
||||
|
||||
// TEST(sysObj, print) {
|
||||
// PikaObj* obj = newRootObj((char*)"test", New_PikaStdLib_SysObj);
|
||||
// Args* res = obj_runDirect(obj, (char*)"print('hello world')");
|
||||
// char* sysOut = args_getSysOut(res);
|
||||
// int errCode = args_getErrorCode(res);
|
||||
// printf("sysout = %s\r\n", sysOut);
|
||||
// ASSERT_STREQ((char*)"hello world", sysOut);
|
||||
// ASSERT_EQ(0, errCode);
|
||||
// args_deinit(res);
|
||||
// obj_deinit(obj);
|
||||
// EXPECT_EQ(pikaMemNow(), 0);
|
||||
// }
|
||||
TEST(sysObj, print) {
|
||||
PikaObj* obj = newRootObj((char*)"test", New_PikaStdLib_SysObj);
|
||||
PikaObj* globals = obj_runDirect(obj, (char*)"print('hello world')");
|
||||
char* sysOut = args_getSysOut(globals->attributeList);
|
||||
int errCode = args_getErrorCode(globals->attributeList);
|
||||
printf("sysout = %s\r\n", sysOut);
|
||||
ASSERT_STREQ((char*)"hello world", sysOut);
|
||||
ASSERT_EQ(0, errCode);
|
||||
obj_deinit(globals);
|
||||
obj_deinit(obj);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
|
||||
// TEST(sysObj, noMethod) {
|
||||
// PikaObj* obj = newRootObj((char*)"test", New_PikaStdLib_SysObj);
|
||||
// Args* res = obj_runDirect(obj, (char*)"printttt('hello world')");
|
||||
// char* sysOut = args_getSysOut(res);
|
||||
// int errCode = args_getErrorCode(res);
|
||||
// printf("sysout = %s\r\n", sysOut);
|
||||
// ASSERT_EQ(1, strEqu((char*)"[error] runner: method no found.", sysOut));
|
||||
// ASSERT_EQ(2, errCode);
|
||||
// args_deinit(res);
|
||||
// obj_deinit(obj);
|
||||
// EXPECT_EQ(pikaMemNow(), 0);
|
||||
// }
|
||||
TEST(sysObj, noMethod) {
|
||||
PikaObj* obj = newRootObj((char*)"test", New_PikaStdLib_SysObj);
|
||||
PikaObj* globals = obj_runDirect(obj, (char*)"printttt('hello world')");
|
||||
char* sysOut = args_getSysOut(globals->attributeList);
|
||||
int errCode = args_getErrorCode(globals->attributeList);
|
||||
printf("sysout = %s\r\n", sysOut);
|
||||
ASSERT_EQ(1, strEqu((char*)"[error] runner: method no found.", sysOut));
|
||||
ASSERT_EQ(2, errCode);
|
||||
obj_deinit(globals);
|
||||
obj_deinit(obj);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user