> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.1.71 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jan 5 14:18:41 UTC 2024 x86_64 GNU/Linux 22:34:52 up 2 days 11:29, 2 users, load average: 0.89, 0.70, 0.50
This commit is contained in:
parent
3ed490ab52
commit
3a1d39bebf
2 changed files with 13 additions and 13 deletions
|
@ -12,5 +12,5 @@ $$?[a-zA-Z]{2,3} { yylval = isa_reg_str2val(yytext + 1, &success); if(!success)
|
|||
[0-9]+ { yylval = strtoul(yytext, NULL, 10); return NUMBER; }
|
||||
[+\-*/()] { return *yytext; }
|
||||
[ \t] { }
|
||||
. { printf("Unexpected character: %s\n", yytext); }
|
||||
. { fprintf(stderr, "Unexpected character: %s\n", yytext); return YYerror; }
|
||||
%%
|
||||
|
|
|
@ -181,17 +181,17 @@ START_TEST(test_expr_plain_register) {
|
|||
}
|
||||
END_TEST
|
||||
|
||||
// START_TEST(test_expr_register) {
|
||||
// yy_scan_string(reg_exprs[_i].expr);
|
||||
// uint32_t value;
|
||||
// ck_assert(!yyparse(&value));
|
||||
// yylex_destroy();
|
||||
START_TEST(test_expr_register) {
|
||||
yy_scan_string(reg_exprs[_i].expr);
|
||||
uint32_t value;
|
||||
ck_assert(!yyparse(&value));
|
||||
yylex_destroy();
|
||||
|
||||
// ck_assert_msg(value == reg_exprs[_i].reference,
|
||||
// "\n\texpr = %s\n\t(addr = %u) != (reference = %u)\n", reg_exprs[_i].expr,
|
||||
// value, reg_exprs[_i].reference);
|
||||
// }
|
||||
// END_TEST
|
||||
ck_assert_msg(value == reg_exprs[_i].reference,
|
||||
"\n\texpr = %s\n\t(addr = %u) != (reference = %u)\n", reg_exprs[_i].expr,
|
||||
value, reg_exprs[_i].reference);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
Suite *expr_suite(void) {
|
||||
Suite *s;
|
||||
|
@ -203,8 +203,8 @@ Suite *expr_suite(void) {
|
|||
tcase_add_loop_test(tc_core, test_expr_random_100, 0, 20);
|
||||
tcase_add_loop_test(tc_core, test_expr_negative_operand, 0,
|
||||
sizeof(exprs) / sizeof(exprs[0]));
|
||||
// tcase_add_loop_test(tc_core, test_expr_register, 0,
|
||||
// sizeof(reg_exprs) / sizeof(reg_exprs[0]));
|
||||
tcase_add_loop_test(tc_core, test_expr_register, 0,
|
||||
sizeof(reg_exprs) / sizeof(reg_exprs[0]));
|
||||
tcase_add_test(tc_core, test_expr_plain_register);
|
||||
suite_add_tcase(s, tc_core);
|
||||
|
||||
|
|
Loading…
Reference in a new issue