mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
e6a33c058e
* print list as '[x,x,x]' * support __str__ for Dict * support __str__ for dict_keys()
28 lines
845 B
C
28 lines
845 B
C
#include "test_common.h"
|
|
|
|
|
|
#if PIKA_SYNTEX_ITEM_SLICE_ENABLE
|
|
TEST(stddata, test1) {
|
|
/* init */
|
|
pikaMemInfo.heapUsedMax = 0;
|
|
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain);
|
|
/* run */
|
|
__platform_printf("BEGIN\r\n");
|
|
pikaVM_runSingleFile(pikaMain, "../../examples/BuiltIn/dict.py");
|
|
/* collect */
|
|
/* assert */
|
|
EXPECT_STREQ(log_buff[0], "dict_keys([c, b, a])\r\n");
|
|
EXPECT_STREQ(log_buff[1], "a\r\n");
|
|
EXPECT_STREQ(log_buff[2], "b\r\n");
|
|
EXPECT_STREQ(log_buff[3], "c\r\n");
|
|
EXPECT_STREQ(log_buff[4], "1\r\n");
|
|
EXPECT_STREQ(log_buff[5], "2\r\n");
|
|
EXPECT_STREQ(log_buff[6], "test\r\n");
|
|
EXPECT_STREQ(log_buff[7], "{'c': test, 'b': 2, 'a': 1}\r\n");
|
|
EXPECT_STREQ(log_buff[8], "BEGIN\r\n");
|
|
/* deinit */
|
|
obj_deinit(pikaMain);
|
|
EXPECT_EQ(pikaMemNow(), 0);
|
|
}
|
|
#endif
|