pikapython/port/linux/test/py-test.cpp

101 lines
4.5 KiB
C
Raw Normal View History

2023-06-18 13:05:45 +08:00
#include "test_common.h"
TEST_START
#if !PIKA_NANO_ENABLE
TEST_RUN_SINGLE_FILE(thread, test2, "test/python/_thread/test2.py")
TEST_RUN_SINGLE_FILE(eventloop, test1, "test/python/eventloop/test1.py")
TEST_RUN_SINGLE_FILE(eventloop, test2, "test/python/eventloop/test2.py")
TEST_RUN_SINGLE_FILE(eventloop, test3, "test/python/eventloop/test3.py")
TEST_RUN_SINGLE_FILE(eventloop, delay1, "test/python/eventloop/delay1.py")
TEST_RUN_SINGLE_FILE(eventloop, once1, "test/python/eventloop/once1.py")
TEST_RUN_SINGLE_FILE(eventloop, once2, "test/python/eventloop/once2.py")
TEST_RUN_SINGLE_FILE(fsm, test1, "test/python/fsm/test1.py")
TEST_RUN_SINGLE_FILE_PASS(builtin,
list_tuple_equ,
"test/python/builtins/list_tuple_equ.py")
2023-06-18 13:05:45 +08:00
TEST_RUN_SINGLE_FILE_PASS(builtin,
fn_default1,
"test/python/builtins/fn_default1.py")
2023-06-18 13:05:45 +08:00
TEST_RUN_SINGLE_FILE_PASS(builtin,
fn_default_tuple,
"test/python/builtins/fn_default_tuple.py")
TEST_RUN_SINGLE_FILE_PASS(builtin, max_min, "test/python/builtins/max_min.py")
TEST_RUN_SINGLE_FILE_PASS(builtin, split, "test/python/builtins/split.py")
2023-06-18 13:05:45 +08:00
TEST_RUN_LINES_EXCEPT_OUTPUT(builtin,
split_slice,
"'test'.split('e')[0]",
"'t'\r\n")
TEST_RUN_LINES_EXCEPT_OUTPUT(builtin,
split_slice_1,
"'test'.split('e')[1]",
"'st'\r\n")
TEST_RUN_LINES_EXCEPT_OUTPUT(builtin,
replace_split_0,
"'a b c d'.replace(' ', ',').split(',')[0]",
"'a'\r\n")
TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(builtin,
class_script,
"test/python/builtins/class_script.py",
2023-06-18 13:05:45 +08:00
"Obj1.test\r\n")
TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(builtin,
class_hint,
"test/python/builtins/class_hint.py",
2023-06-18 13:05:45 +08:00
"1\r\n")
TEST_RUN_SINGLE_FILE_PASS(builtin,
isinstance,
"test/python/builtins/isinstance.py")
TEST_RUN_SINGLE_FILE_PASS(builtin, getitem, "test/python/builtins/getitem.py")
2023-06-18 13:05:45 +08:00
TEST_RUN_SINGLE_FILE_PASS(lua, eval, "test/python/pika_lua/eval.py")
TEST_RUN_SINGLE_FILE_PASS(lua, require, "test/python/pika_lua/require.py")
TEST_RUN_LINES(vm, dot_issue, ".")
TEST_RUN_LINES(vm, char_issue1, "~")
TEST_RUN_LINES(vm, char_issue2, "/")
TEST_RUN_LINES(vm, char_issue3, "%")
TEST_RUN_LINES(vm, char_issue4, "=")
TEST_RUN_SINGLE_FILE(vm,
issue_star_dict,
"test/python/issue/issue_star_dict.py")
TEST_RUN_SINGLE_FILE_PASS(vm, proxy2, "test/python/proxy/proxy2.py")
TEST_RUN_LINES(vm, abs_none, "abs(None)")
TEST_RUN_LINES(vm, abs_str, "abs('test')")
TEST_RUN_SINGLE_FILE_PASS(datastruct,
circlequeue,
"test/python/datastruct/circlequeue.py")
TEST_RUN_LINES_EXCEPT_OUTPUT(vm, single_tuple, "(1,)", "(1,)\r\n")
TEST_RUN_LINES_EXCEPT_OUTPUT(vm, single_tuple_str, "('test',)", "('test',)\r\n")
TEST_RUN_SINGLE_FILE_PASS(vm, is_not, "test/python/builtins/is_not.py")
2023-06-18 13:05:45 +08:00
TEST_RUN_LINES(vm,
var_global,
"import PikaStdLib\n"
"mem = PikaStdLib.MemChecker()\n"
"mem.clear\n")
TEST_RUN_LINES(vm,
var_global_run,
"import PikaStdLib\n"
"mem = PikaStdLib.MemChecker()\n"
"mem.clear()\n")
TEST_RUN_LINES(vm,
var_global_module,
"import configparser\n"
"configparser.clear\n")
TEST_RUN_LINES(vm, import_void, "import \n")
TEST_RUN_SINGLE_FILE_PASS(vm, fn_fn, "test/python/builtins/fn_fn.py")
2023-06-18 13:05:45 +08:00
TEST_RUN_LINES_EXCEPT_OUTPUT(vm, isinstance, "isinstance(1, int)\n", "True\r\n")
TEST_RUN_SINGLE_FILE_PASS(except,
try_while_return,
"test/python/except/try_while_return.py");
TEST_RUN_SINGLE_FILE_PASS(except,
isinstance,
"test/python/except/except_isinstance.py");
2023-07-06 02:39:57 +08:00
TEST_RUN_SINGLE_FILE_PASS(zlib, zlib1, "test/python/zlib/zlib1.py")
TEST_RUN_SINGLE_FILE(zlib, zlib_err, "test/python/zlib/zlib_err.py")
TEST_RUN_SINGLE_FILE(modbus, rtu_request, "test/python/modbus/rtu_request.py")
2023-07-06 02:39:57 +08:00
2023-06-18 13:05:45 +08:00
#endif
TEST_END