2022-06-10 11:34:46 +08:00
|
|
|
#include "test_common.h"
|
|
|
|
|
2022-07-11 03:14:14 +00:00
|
|
|
#if PIKA_SYNTAX_SLICE_ENABLE
|
2022-06-10 11:34:46 +08:00
|
|
|
TEST(ctypes, test1) {
|
|
|
|
/* init */
|
|
|
|
pikaMemInfo.heapUsedMax = 0;
|
|
|
|
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
|
|
|
|
/* run */
|
2022-07-14 13:50:05 +08:00
|
|
|
pikaVM_runSingleFile(pikaMain, "../../examples/BuiltIn/ctypes.py");
|
2022-06-10 11:34:46 +08:00
|
|
|
/* collect */
|
|
|
|
/* assert */
|
2022-09-04 21:19:41 +08:00
|
|
|
EXPECT_STREQ(log_buff[18], "16\r\n");
|
2022-06-10 11:34:46 +08:00
|
|
|
/* deinit */
|
|
|
|
obj_deinit(pikaMain);
|
|
|
|
EXPECT_EQ(pikaMemNow(), 0);
|
|
|
|
}
|
2022-06-11 14:56:51 +00:00
|
|
|
#endif
|
2022-06-10 11:34:46 +08:00
|
|
|
|
|
|
|
TEST(ctypes, test2) {
|
|
|
|
/* init */
|
|
|
|
pikaMemInfo.heapUsedMax = 0;
|
|
|
|
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
|
|
|
|
/* run */
|
|
|
|
obj_run(pikaMain,
|
2022-06-11 14:56:51 +00:00
|
|
|
"len(b'test\\x0')\n"
|
|
|
|
"len(str(b'test\\x0'))\n");
|
2022-06-10 11:34:46 +08:00
|
|
|
/* collect */
|
|
|
|
/* assert */
|
|
|
|
EXPECT_STREQ(log_buff[0], "4\r\n");
|
|
|
|
EXPECT_STREQ(log_buff[1], "5\r\n");
|
|
|
|
/* deinit */
|
|
|
|
obj_deinit(pikaMain);
|
|
|
|
EXPECT_EQ(pikaMemNow(), 0);
|
2022-06-11 14:56:51 +00:00
|
|
|
}
|