mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
RET is ok
This commit is contained in:
parent
5114193890
commit
b9adda11b1
@ -329,13 +329,11 @@ TEST(VM, DEF_instruct) {
|
||||
"0 JMP 1\n"
|
||||
"B1\n"
|
||||
"0 NUM 1\n"
|
||||
"0 OUT a\n"
|
||||
"0 RET\n"
|
||||
"B0\n";
|
||||
char* methodCode = (char*)
|
||||
"B1\n"
|
||||
"0 NUM 1\n"
|
||||
"0 OUT a\n"
|
||||
"0 RET\n"
|
||||
"B0\n";
|
||||
PikaObj* self = New_TinyObj(NULL);
|
||||
@ -346,4 +344,23 @@ TEST(VM, DEF_instruct) {
|
||||
EXPECT_STREQ(methodCode, methodPtr);
|
||||
obj_deinit(self);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
|
||||
TEST(VM, RET_instruct) {
|
||||
char* pikaAsm = (char*)
|
||||
"B1\n"
|
||||
"0 NUM 13\n"
|
||||
"0 RET\n"
|
||||
"0 NUM 2\n"
|
||||
"0 RET\n"
|
||||
"B0\n";
|
||||
PikaObj* self = New_TinyObj(NULL);
|
||||
int lineAddr = 0;
|
||||
int size = strGetSize(pikaAsm);
|
||||
Args* runRes = pikaVM_runAsm(self, pikaAsm);
|
||||
Arg* returnArg = args_getArg(runRes, (char*)"return");
|
||||
int num = arg_getInt(returnArg);
|
||||
obj_deinit(self);
|
||||
args_deinit(runRes);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user