pikapython/port/linux/test/builtin-test.cpp
李昂 4a943b479c !41 Support chain invoke like < String('test').split() >
* support chain invoke ok
* add test for S(S.replace()).replace()
* parse to RUN .split
* try to support chain invoke, not ok
* can devide a chain
2022-07-05 06:23:49 +00:00

38 lines
991 B
C

#include "test_common.h"
#if PIKA_SYNTEX_SLICE_ENABLE
TEST(builtin, bytes) {
/* init */
pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
pikaVM_runSingleFile(pikaMain, "../../examples/BuiltIn/bytes.py");
/* collect */
uint8_t* res = obj_getBytes(pikaMain, "res");
/* assert */
EXPECT_EQ(res[1], 1);
/* deinit */
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
#endif
#if PIKA_BUILTIN_LIST_ENABLE
TEST(builtin, type1) {
/* init */
pikaMemInfo.heapUsedMax = 0;
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
/* run */
__platform_printf("BEGIN\r\n");
pikaVM_runSingleFile(pikaMain, "../../examples/BuiltIn/type.py");
/* collect */
/* assert */
EXPECT_STREQ(log_buff[1], "BEGIN\r\n");
EXPECT_STREQ(log_buff[0], "OK\r\n");
/* deinit */
obj_deinit(pikaMain);
EXPECT_EQ(pikaMemNow(), 0);
}
#endif