pikapython/port/linux/test/VM-test.cpp

35 lines
921 B
C
Raw Normal View History

2021-10-14 15:52:01 +08:00
#include "gtest/gtest.h"
extern "C" {
#include "BaseObj.h"
#include "PikaParser.h"
2021-10-14 15:58:32 +08:00
#include "PikaStdLib_SysObj.h"
2021-10-14 15:52:01 +08:00
#include "PikaVM.h"
#include "dataMemory.h"
#include "dataQueue.h"
2021-10-14 15:52:01 +08:00
#include "dataStrs.h"
}
2021-10-14 20:44:50 +08:00
TEST(VM, num1) {
char* line = (char*)"1";
2021-10-14 15:52:01 +08:00
Args* buffs = New_strBuff();
char* pikaAsm = pikaParseToAsm(buffs, line);
printf("%s", pikaAsm);
PikaObj* self = newRootObj((char*)"root", New_PikaStdLib_SysObj);
pikaVM_runAsm(self, pikaAsm);
obj_deinit(self);
2021-10-14 15:52:01 +08:00
args_deinit(buffs);
EXPECT_EQ(pikaMemNow(), 0);
2021-10-14 20:44:50 +08:00
}
// TEST(VM, a_1) {
// char* line = (char*)"a = 1";
// Args* buffs = New_strBuff();
// char* pikaAsm = pikaParseToAsm(buffs, line);
// printf("%s", pikaAsm);
// PikaObj* self = newRootObj((char*)"root", New_PikaStdLib_SysObj);
// pikaVM_runAsm(self, pikaAsm);
// obj_deinit(self);
// args_deinit(buffs);
// EXPECT_EQ(pikaMemNow(), 0);
// }