add stdtask test on REPL

This commit is contained in:
lyon 2022-10-25 13:54:21 +08:00
parent 1964761ef8
commit 581281ff8e
3 changed files with 25 additions and 0 deletions

View File

@ -7,6 +7,7 @@ def __init__(self): ...
class Task(PikaStdTask.Task):
def __init__(self): ...
def platformGetTick(self): ...
def returnNullString(self) -> str: ...

View File

@ -9,6 +9,12 @@ void GTestTask_Task_platformGetTick(PikaObj* self) {
obj_setInt(self, "tick", tick_ms);
}
void PikaStdTask_Task___init__(PikaObj* self);
void GTestTask_Task___init__(PikaObj *self){
PikaStdTask_Task___init__(self);
tick_ms = 0;
}
void GTestTask___init__(PikaObj* self) {
if (!obj_isArgExist(self, "testval")) {
obj_setInt(self, "testval", 8848);

View File

@ -472,4 +472,22 @@ TEST(module, REPL_big_script) {
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
TEST(module, REPL_stdtask) {
/* init */
pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(pikaMain, pikaModules_py_a);
/* run */
__platform_printf("BEGIN\r\n");
f_getchar_fp = fopen("test/python/std/stdtask.py", "rb");
pikaScriptShell_withGetchar(pikaMain, f_getchar);
fclose((FILE*)f_getchar_fp);
/* collect */
/* assert */
/* deinit */
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
#endif