Skip to content

Commit 46a8e08

Browse files
committed
try fix
1 parent 35b8d6a commit 46a8e08

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/machine/instruction.test.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,30 @@ void TestInstruction::instruction_code_from_str() {
9090
code_to_string[i].code, qPrintable(test_string_data), code);
9191
Instruction::code_from_string(
9292
&code, code_to_string[i].str.length(), test_string_data, Address(0x0));
93+
printf(
94+
"test_case: { str: %s, len: %d code: %x, test_string_data: %s}, output: { code: %x "
95+
"}\n",
96+
qPrintable(code_to_string[i].str), code_to_string[i].str.length(),
97+
code_to_string[i].code, qPrintable(test_string_data), code);
9398
QCOMPARE(code, code_to_string[i].code);
9499
} catch (const Instruction::ParseError &e) {
100+
101+
TokenizedInstruction inst = TokenizedInstruction::from_line(test_string_data, Address(0x0), nullptr, 0);
102+
103+
printf(
104+
"test_case: { base: %s, len: %d code: %x, test_string_data: %s}, output: { code: %x "
105+
"}\n",
106+
qPrintable(inst.base), code_to_string[i].str.length(),
107+
code_to_string[i].code, qPrintable(test_string_data), code);
108+
95109
printf("exception: %s\n", qPrintable(e.message));
96110
QFAIL(qPrintable(e.message));
97111
} catch (...) { QFAIL("code_from_string throw unexpected exception"); }
98112
}
99113

114+
uint32_t code = 0;
115+
Instruction::code_from_string(&code, 100, "csrrw x0, 0x1, x1", Address(0x0));
116+
100117
// RelocExpressionList reloc = {};
101118
// for (size_t i = 0; i < sizeof(pesude_code_to_string) / sizeof(pesude_code_to_string[0]); i++)
102119
// {

0 commit comments

Comments
 (0)