@@ -90,13 +90,30 @@ void TestInstruction::instruction_code_from_str() {
90
90
code_to_string[i].code , qPrintable (test_string_data), code);
91
91
Instruction::code_from_string (
92
92
&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);
93
98
QCOMPARE (code, code_to_string[i].code );
94
99
} 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
+
95
109
printf (" exception: %s\n " , qPrintable (e.message ));
96
110
QFAIL (qPrintable (e.message ));
97
111
} catch (...) { QFAIL (" code_from_string throw unexpected exception" ); }
98
112
}
99
113
114
+ uint32_t code = 0 ;
115
+ Instruction::code_from_string (&code, 100 , " csrrw x0, 0x1, x1" , Address (0x0 ));
116
+
100
117
// RelocExpressionList reloc = {};
101
118
// for (size_t i = 0; i < sizeof(pesude_code_to_string) / sizeof(pesude_code_to_string[0]); i++)
102
119
// {
0 commit comments