This commit is contained in:
pikastech 2022-07-01 09:37:09 +08:00
parent 5a2696f4db
commit 43f11f26b6
2 changed files with 11 additions and 5 deletions

View File

@ -2,8 +2,12 @@ class Test:
a = 1
b = 'test'
def __init__(self):
a = 2
b = 'pewq'
self.a = 2
self.b = 'pewq'
print(Test.a)
print(Test.b)
test = Test()
print(test.a)
print(test.b)

View File

@ -23,9 +23,11 @@ TEST(class, classpar1) {
__platform_printf("BEGIN\r\n");
pikaVM_runSingleFile(self, "../../examples/Class/classpar1.py");
/* assert */
EXPECT_STREQ(log_buff[0], "test\r\n");
EXPECT_STREQ(log_buff[1], "1\r\n");
EXPECT_STREQ(log_buff[2], "BEGIN\r\n");
EXPECT_STREQ(log_buff[4], "BEGIN\r\n");
EXPECT_STREQ(log_buff[3], "1\r\n");
EXPECT_STREQ(log_buff[2], "test\r\n");
EXPECT_STREQ(log_buff[1], "2\r\n");
EXPECT_STREQ(log_buff[0], "pewq\r\n");
/* deinit */
obj_deinit(self);
EXPECT_EQ(pikaMemNow(), 0);