Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: TEST_PRINTF(): printing 64-bit hex numbers or pointers #694

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/unity.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,15 +2031,29 @@ static void UnityPrintFVA(const char* format, va_list va)
UNITY_EXTRACT_ARG(UNITY_UINT, number, length_mod, va, unsigned int);
UNITY_OUTPUT_CHAR('0');
UNITY_OUTPUT_CHAR('x');
UnityPrintNumberHex(number, 8);
if (length_mod == UNITY_LENGTH_MODIFIER_LONG_LONG)
{
UnityPrintNumberHex(number, 16);
}
else
{
UnityPrintNumberHex(number, 8);
}
break;
}
case 'p':
{
const unsigned int number = va_arg(va, unsigned int);
UNITY_UINT number;
char nibbles_to_print = 8;
if (UNITY_POINTER_WIDTH == 64)
{
length_mod = UNITY_LENGTH_MODIFIER_LONG_LONG;
nibbles_to_print = 16;
}
UNITY_EXTRACT_ARG(UNITY_UINT, number, length_mod, va, unsigned int);
UNITY_OUTPUT_CHAR('0');
UNITY_OUTPUT_CHAR('x');
UnityPrintNumberHex((UNITY_UINT)number, 8);
UnityPrintNumberHex((UNITY_UINT)number, nibbles_to_print);
break;
}
case 'c':
Expand Down
Loading