@@ -1110,99 +1110,4 @@ void cli_init(CEDAModule *mod) {
11101110 LOG_INFO ("cli ok\n" );
11111111 initialized = true;
11121112}
1113-
1114- #ifdef CEDA_TEST
1115-
1116- #include <criterion/criterion.h>
1117-
1118- struct test {
1119- bool input ; // true => is user input line,
1120- // false => is emulator expected response
1121- const char * text ;
1122- };
1123-
1124- static void cli_test_setup (void ) {
1125- FIFO_INIT (& tx_fifo );
1126- }
1127-
1128- static void run_tests (struct test * tests , size_t n ) {
1129- // static bool prompt = false;
1130-
1131- for (size_t i = 0 ; i < n ; ++ i ) {
1132- struct test * tst = & tests [i ];
1133-
1134- #if 0
1135- LOG_DEBUG ("test %s %s\n" , tst -> input ? "=>" : "<=" , tst -> text );
1136- #endif
1137-
1138- if (tst -> input ) {
1139- ceda_string_t * text = ceda_string_new (0 );
1140- ceda_string_cpy (text , tst -> text );
1141- cli_handle_line (text );
1142- ceda_string_delete (text );
1143- } else {
1144- const char * expected = tst -> text ? tst -> text : USER_PROMPT_STR ;
1145- cr_assert (!FIFO_ISEMPTY (& tx_fifo ));
1146- ceda_string_t * message = FIFO_POP (& tx_fifo );
1147- cr_assert_str_eq (ceda_string_data (message ), expected );
1148- ceda_string_delete (message );
1149- }
1150- }
1151- }
1152-
1153- Test (cli , break , .init = cli_test_setup ) {
1154- /* clang-format off */
1155- struct test tests [] = {
1156- {true, "break" },
1157- {false, "no breakpoint set\n" },
1158- {false, USER_PROMPT_STR },
1159- {true, "break c000" },
1160- {false, USER_PROMPT_STR },
1161- {true, "break" },
1162- {false, "0\tc000\n" },
1163- {false, USER_PROMPT_STR },
1164- {true, "break c030" },
1165- {false, USER_PROMPT_STR },
1166- {true, "break" },
1167- {false, "0\tc000\n1\tc030\n" },
1168- {false, USER_PROMPT_STR },
1169- };
1170- /* clang-format on */
1171- run_tests (tests , ARRAY_SIZE (tests ));
1172- }
1173-
1174- Test (cli , delete , .init = cli_test_setup ) {
1175- /* clang-format off */
1176- struct test tests [] = {
1177- {true, "break c000" },
1178- {false, USER_PROMPT_STR },
1179- {true, "break c030" },
1180- {false, USER_PROMPT_STR },
1181- {true, "delete" },
1182- {false, USER_BAD_ARG_STR "missing delete target\n" },
1183- {false, USER_PROMPT_STR },
1184- {true, "delete breakpoint" },
1185- {false, USER_BAD_ARG_STR "missing index\n" },
1186- {false, USER_PROMPT_STR },
1187- {true, "delete brekpoi 1" },
1188- {false, USER_BAD_ARG_STR "unknown delete target\n" },
1189- {false, USER_PROMPT_STR },
1190- {true, "delete breakpoint -1" },
1191- {false, "can't delete breakpoint\n" },
1192- {false, USER_PROMPT_STR },
1193- {true, "delete breakpoint xx" },
1194- {false, USER_BAD_ARG_STR "bad index format\n" },
1195- {false, USER_PROMPT_STR },
1196- {true, "delete breakpoint 0" },
1197- {false, USER_PROMPT_STR },
1198- {true, "break" },
1199- {false, "1\tc030\n" },
1200- {false, USER_PROMPT_STR },
1201- };
1202- /* clang-format on */
1203- run_tests (tests , ARRAY_SIZE (tests ));
1204- }
1205-
1206- #endif
1207- //NOLINTEND
1208-
1113+ // NOLINTEND
0 commit comments