1 line
27 KiB
Plaintext
Raw Normal View History

2022-06-24 00:19:04 +08:00
Compiler { dist_path: "pikascript-api/", source_path: "", class_list: {"PikaDebug": ClassInfo { this_class_name: "PikaDebug", this_class_name_without_file: "PikaDebug", super_class_name: "TinyObj", method_list: {"Debuger": MethodInfo { class_name: "PikaDebug", name: "Debuger", arg_list: None, return_type: Some(PyType { type_name: "any" }), is_constructor: true }}, object_list: {}, import_list: {}, script_list: Script { content: "" }, is_package: true }, "PikaDebug_Debuger": ClassInfo { this_class_name: "PikaDebug_Debuger", this_class_name_without_file: "Debuger", super_class_name: "TinyObj", method_list: {"__init__": MethodInfo { class_name: "PikaDebug_Debuger", name: "__init__", arg_list: None, return_type: None, is_constructor: false }, "set_trace": MethodInfo { class_name: "PikaDebug_Debuger", name: "set_trace", arg_list: None, return_type: None, is_constructor: false }}, object_list: {}, import_list: {}, script_list: Script { content: "" }, is_package: false }, "PikaMain": ClassInfo { this_class_name: "PikaMain", this_class_name_without_file: "PikaMain", super_class_name: "PikaStdLib_SysObj", method_list: {}, object_list: {"PikaStdData": ObjectInfo { class_name: "PikaMain", name: "PikaStdData", import_class_name: "PikaStdData" }, "PikaStdLib": ObjectInfo { class_name: "PikaMain", name: "PikaStdLib", import_class_name: "PikaStdLib" }}, import_list: {}, script_list: Script { content: "@BEGIN@import PikaStdLib@END@@BEGIN@import PikaStdData@END@@BEGIN@@END@@BEGIN@mem = PikaStdLib.MemChecker()@END@@BEGIN@mem.resetMax()@END@@BEGIN@def EXPECT_EQ(test_name, input, expected):@END@@BEGIN@ print('-----TEST-----')@END@@BEGIN@ print(test_name)@END@@BEGIN@ if input != expected:@END@@BEGIN@ print('[Error]')@END@@BEGIN@ print(test_name)@END@@BEGIN@ print('[info] Expected:')@END@@BEGIN@ print(expected)@END@@BEGIN@ print('[info] Input:')@END@@BEGIN@ print(input)@END@@BEGIN@ # error@END@@BEGIN@ while True:@END@@BEGIN@ is_error = 1@END@@BEGIN@ else:@END@@BEGIN@ print('[ OK ]')@END@@BEGIN@@END@@BEGIN@a = 0@END@@BEGIN@for i in range(0, 10):@END@@BEGIN@ if i == 5:@END@@BEGIN@ continue@END@@BEGIN@ a = a + i@END@@BEGIN@EXPECT_EQ('for_if_continue', a, 40)@END@@BEGIN@ @END@@BEGIN@a = 0@END@@BEGIN@for i in range(0, 10):@END@@BEGIN@ if i == 5:@END@@BEGIN@ break@END@@BEGIN@ a = a + i@END@@BEGIN@EXPECT_EQ('for_if_break', a, 10)@END@@BEGIN@@END@@BEGIN@a = 0@END@@BEGIN@for i in range(0, 10):@END@@BEGIN@ for k in range(0, 3):@END@@BEGIN@ # print(k)@END@@BEGIN@ a = a + k@END@@BEGIN@EXPECT_EQ('for_for_in_range', a, 30)@END@@BEGIN@@END@@BEGIN@a = 0@END@@BEGIN@for i in range(0, 10):@END@@BEGIN@ # print(i)@END@@BEGIN@ a = a + i@END@@BEGIN@EXPECT_EQ('for_in_range', a, 45)@END@@BEGIN@@END@@BEGIN@list = PikaStdData.List()@END@@BEGIN@list.append(7)@END@@BEGIN@list.append('eee')@END@@BEGIN@len = list.len()@END@@BEGIN@for item in list:@END@@BEGIN@ # print(item)@END@@BEGIN@ a = item@END@@BEGIN@EXPECT_EQ('list_for_loop', a, 'eee')@END@@BEGIN@@END@@BEGIN@@END@@BEGIN@list = PikaStdData.List()@END@@BEGIN@list.append(7)@END@@BEGIN@list.append('eee')@END@@BEGIN@len = list.len()@END@@BEGIN@a1 = list.get(0)@END@@BEGIN@a2 = list.get(1)@END@@BEGIN@res = iter(list)@END@@BEGIN@EXPECT_EQ('iter', res, list)@END@@BEGIN@@END@@BEGIN@dict = PikaStdData.Dict()@END@@BEGIN@dict.set('a', 1)@END@@BEGIN@dict.set('b', 2)@END@@BEGIN@dict.remove('b')@END@@BEGIN@a = dict.get('a')@END@@BEGIN@b = dict.get('b')@END@@BEGIN@EXPECT_EQ('PikaStdData', a, 1)@END@@BEGIN@EXPECT_EQ('PikaStdData_2', b, 0)@END@@BEGIN@@END@@BEGIN@num = 0@END@@BEGIN@i = 2@END@@BEGIN@for i in range(2,30):@END@@BEGIN@ j=2@END@@BEGIN@ is_prime = 1@END@@BEGIN@ for j in range(2,i):@END@@BEGIN@ if i%j==0 :@END@@BEGIN@ is_prime = 0@END@@BEGIN@ break@END@@BEGIN@ if is_prime:@END@@BEGIN@ num = num + i@END@@BEGIN@EXPECT_EQ('prime_number_30', num, 129)@END@@BEGIN@@END@@BEGIN@@END@@BEGIN@print('====================')@END@@BEGIN@print('[Un