Skip to content

Commit

Permalink
try print different strtoul on windows and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
trdthg committed Apr 26, 2024
1 parent d342847 commit c50c149
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/machine/instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ uint16_t parse_csr_address(const QString &field_token, uint &chars_taken) {
chars_taken = r - str;
printf("aaaaaaaaaaaaa----------------------------------------------------------------\n");
printf(
"system - strtoul - function: { ori_str: %s, str: %s, chars_taken: %d, val: %x }\n",
"system - strtoul - function: { ori_str: %s, str: %s, chars_taken: %d, val: %lx }\n",
qPrintable(field_token), str, chars_taken, val);
return val;
}
Expand Down
12 changes: 7 additions & 5 deletions src/machine/instruction.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ void TestInstruction::instruction_code_from_str() {
code_to_string[i].code, qPrintable(test_string_data), code);
QCOMPARE(code, code_to_string[i].code);
} catch (const Instruction::ParseError &e) {

TokenizedInstruction inst = TokenizedInstruction::from_line(test_string_data, Address(0x0), nullptr, 0);
TokenizedInstruction inst
= TokenizedInstruction::from_line(test_string_data, Address(0x0), nullptr, 0);

printf(
"test_case: { base: %s, len: %d code: %x, test_string_data: %s}, output: { code: %x "
"test_case: { base: %s, len: %d code: %x, test_string_data: %s}, output: { code: "
"%x "
"}\n",
qPrintable(inst.base), code_to_string[i].str.length(),
code_to_string[i].code, qPrintable(test_string_data), code);
qPrintable(inst.base), code_to_string[i].str.length(), code_to_string[i].code,
qPrintable(test_string_data), code);

printf("exception: %s\n", qPrintable(e.message));
QFAIL(qPrintable(e.message));
Expand All @@ -114,6 +115,7 @@ void TestInstruction::instruction_code_from_str() {
uint32_t code = 0;
Instruction::code_from_string(&code, 100, "csrrw x0, 0x1, x1", Address(0x0));

QCOMPARE(1, 2);
// RelocExpressionList reloc = {};
// for (size_t i = 0; i < sizeof(pesude_code_to_string) / sizeof(pesude_code_to_string[0]); i++)
// {
Expand Down

0 comments on commit c50c149

Please sign in to comment.