> 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
 17:09:34  up 2 days  6:04,  2 users,  load average: 1.21, 0.99, 0.84
This commit is contained in:
tracer-ysyx 2024-01-15 17:09:34 +08:00 committed by xinyangli
parent f8b8ae50b7
commit 1cd32d4968

View file

@ -147,6 +147,8 @@ struct {
{"-0x1", 0xFFFFFFFFU},
{"0--1", 0x1},
{"0--0x1", 0x1},
}, reg_exprs[] = {
{"$$0", 0x0},
};
START_TEST(test_expr_negative_operand) {
yy_scan_string(exprs[_i].expr);
@ -160,6 +162,18 @@ START_TEST(test_expr_negative_operand) {
}
END_TEST
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
Suite *expr_suite(void) {
Suite *s;
TCase *tc_core;
@ -170,6 +184,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]));
suite_add_tcase(s, tc_core);
return s;