Skip to content

Commit

Permalink
Fix different format styles on different simulators
Browse files Browse the repository at this point in the history
Set a format style for `to_string(real)` so that we get a consistent
string format for each simulator. Format now defaults to `"%f"`.
  • Loading branch information
abaebae committed Feb 25, 2024
1 parent f22ef02 commit 42b1345
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 139 deletions.
40 changes: 20 additions & 20 deletions vunit/vhdl/check/src/check-2008p.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check passed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
path_offset + 1, line_num, file_name);
else
passing_check(checker);
Expand All @@ -80,8 +80,8 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check failed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
"Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
"Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & "."),
level, path_offset + 1, line_num, file_name);
end if;
-- pragma translate_on
Expand Down Expand Up @@ -157,8 +157,8 @@ package body check_2008p_pkg is
msg => msg,
std_pass_msg => "Equality check passed",
std_fail_msg => "Equality check failed",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & ".",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & ".",
level => level,
path_offset => path_offset + 1,
line_num => line_num,
Expand Down Expand Up @@ -234,7 +234,7 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check passed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
path_offset + 1, line_num, file_name);
else
passing_check(checker);
Expand All @@ -245,8 +245,8 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check failed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
"Expected " & to_string(expected) & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
"Expected " & to_string(expected, "%f") & "."),
level, path_offset + 1, line_num, file_name);
end if;
-- pragma translate_on
Expand Down Expand Up @@ -322,8 +322,8 @@ package body check_2008p_pkg is
msg => msg,
std_pass_msg => "Equality check passed",
std_fail_msg => "Equality check failed",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & ".",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected, "%f") & ".",
level => level,
path_offset => path_offset + 1,
line_num => line_num,
Expand Down Expand Up @@ -399,7 +399,7 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check passed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
path_offset + 1, line_num, file_name);
else
passing_check(checker);
Expand All @@ -410,8 +410,8 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check failed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
"Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
"Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & "."),
level, path_offset + 1, line_num, file_name);
end if;
-- pragma translate_on
Expand Down Expand Up @@ -487,8 +487,8 @@ package body check_2008p_pkg is
msg => msg,
std_pass_msg => "Equality check passed",
std_fail_msg => "Equality check failed",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & ".",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & ".",
level => level,
path_offset => path_offset + 1,
line_num => line_num,
Expand Down Expand Up @@ -564,7 +564,7 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check passed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
path_offset + 1, line_num, file_name);
else
passing_check(checker);
Expand All @@ -575,8 +575,8 @@ package body check_2008p_pkg is
checker,
p_std_msg(
"Equality check failed", msg,
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
"Expected " & to_string(expected) & "."),
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
"Expected " & to_string(expected, "%f") & "."),
level, path_offset + 1, line_num, file_name);
end if;
-- pragma translate_on
Expand Down Expand Up @@ -652,8 +652,8 @@ package body check_2008p_pkg is
msg => msg,
std_pass_msg => "Equality check passed",
std_fail_msg => "Equality check failed",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & ".",
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected, "%f") & ".",
level => level,
path_offset => path_offset + 1,
line_num => line_num,
Expand Down
Loading

0 comments on commit 42b1345

Please sign in to comment.