Skip to content

Commit 7c87606

Browse files
abaebaeLarsAsplund
authored andcommitted
Fix different format styles on different simulators
Set a format style for `to_string(real)` so that we get a consistent string format for each simulator. Format now defaults to `"%f"`.
1 parent 7f84a8f commit 7c87606

File tree

3 files changed

+139
-139
lines changed

3 files changed

+139
-139
lines changed

vunit/vhdl/check/src/check-2008p.vhd

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ package body check_2008p_pkg is
6969
checker,
7070
p_std_msg(
7171
"Equality check passed", msg,
72-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
72+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
7373
path_offset + 1, line_num, file_name);
7474
else
7575
passing_check(checker);
@@ -80,8 +80,8 @@ package body check_2008p_pkg is
8080
checker,
8181
p_std_msg(
8282
"Equality check failed", msg,
83-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
84-
"Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & "."),
83+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
84+
"Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & "."),
8585
level, path_offset + 1, line_num, file_name);
8686
end if;
8787
-- pragma translate_on
@@ -157,8 +157,8 @@ package body check_2008p_pkg is
157157
msg => msg,
158158
std_pass_msg => "Equality check passed",
159159
std_fail_msg => "Equality check failed",
160-
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
161-
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & ".",
160+
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
161+
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & ".",
162162
level => level,
163163
path_offset => path_offset + 1,
164164
line_num => line_num,
@@ -234,7 +234,7 @@ package body check_2008p_pkg is
234234
checker,
235235
p_std_msg(
236236
"Equality check passed", msg,
237-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
237+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
238238
path_offset + 1, line_num, file_name);
239239
else
240240
passing_check(checker);
@@ -245,8 +245,8 @@ package body check_2008p_pkg is
245245
checker,
246246
p_std_msg(
247247
"Equality check failed", msg,
248-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
249-
"Expected " & to_string(expected) & "."),
248+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
249+
"Expected " & to_string(expected, "%f") & "."),
250250
level, path_offset + 1, line_num, file_name);
251251
end if;
252252
-- pragma translate_on
@@ -322,8 +322,8 @@ package body check_2008p_pkg is
322322
msg => msg,
323323
std_pass_msg => "Equality check passed",
324324
std_fail_msg => "Equality check failed",
325-
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
326-
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & ".",
325+
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
326+
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected, "%f") & ".",
327327
level => level,
328328
path_offset => path_offset + 1,
329329
line_num => line_num,
@@ -399,7 +399,7 @@ package body check_2008p_pkg is
399399
checker,
400400
p_std_msg(
401401
"Equality check passed", msg,
402-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
402+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
403403
path_offset + 1, line_num, file_name);
404404
else
405405
passing_check(checker);
@@ -410,8 +410,8 @@ package body check_2008p_pkg is
410410
checker,
411411
p_std_msg(
412412
"Equality check failed", msg,
413-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
414-
"Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & "."),
413+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
414+
"Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & "."),
415415
level, path_offset + 1, line_num, file_name);
416416
end if;
417417
-- pragma translate_on
@@ -487,8 +487,8 @@ package body check_2008p_pkg is
487487
msg => msg,
488488
std_pass_msg => "Equality check passed",
489489
std_fail_msg => "Equality check failed",
490-
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
491-
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected)) & ")" & ".",
490+
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
491+
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected) & " (" & to_string(to_real(expected), "%f") & ")" & ".",
492492
level => level,
493493
path_offset => path_offset + 1,
494494
line_num => line_num,
@@ -564,7 +564,7 @@ package body check_2008p_pkg is
564564
checker,
565565
p_std_msg(
566566
"Equality check passed", msg,
567-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & "."),
567+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & "."),
568568
path_offset + 1, line_num, file_name);
569569
else
570570
passing_check(checker);
@@ -575,8 +575,8 @@ package body check_2008p_pkg is
575575
checker,
576576
p_std_msg(
577577
"Equality check failed", msg,
578-
"Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". " &
579-
"Expected " & to_string(expected) & "."),
578+
"Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". " &
579+
"Expected " & to_string(expected, "%f") & "."),
580580
level, path_offset + 1, line_num, file_name);
581581
end if;
582582
-- pragma translate_on
@@ -652,8 +652,8 @@ package body check_2008p_pkg is
652652
msg => msg,
653653
std_pass_msg => "Equality check passed",
654654
std_fail_msg => "Equality check failed",
655-
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ".",
656-
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got)) & ")" & ". Expected " & to_string(expected) & ".",
655+
std_pass_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ".",
656+
std_fail_ctx => "Got " & to_string(got) & " (" & to_string(to_real(got), "%f") & ")" & ". Expected " & to_string(expected, "%f") & ".",
657657
level => level,
658658
path_offset => path_offset + 1,
659659
line_num => line_num,

0 commit comments

Comments
 (0)