Browse Source

add overloaded versions of all assert procedures with report string parameter added

pull/1/head
T. Meissner 10 years ago
parent
commit
31bc032b82
1 changed files with 83 additions and 10 deletions
  1. +83
    -10
      sim/AssertP.vhd

+ 83
- 10
sim/AssertP.vhd View File

@ -8,15 +8,25 @@ use work.StringP.all;
package AssertP is package AssertP is
procedure assert_true (a : boolean);
procedure assert_false (a : boolean);
procedure assert_true (a : in boolean);
procedure assert_true (a : in boolean; str : in string);
procedure assert_equal (a : in integer; b : in integer);
procedure assert_equal (a : in std_logic_vector; b : in std_logic_vector);
procedure assert_equal (a : in string; b : in string);
procedure assert_false (a : in boolean);
procedure assert_false (a : in boolean; str : in string);
procedure assert_equal (a : in integer; b : in integer);
procedure assert_equal (a : in integer; b : in integer; str : in string);
procedure assert_equal (a : in std_logic_vector; b : in std_logic_vector);
procedure assert_equal (a : in std_logic_vector; b : in std_logic_vector; str : in string);
procedure assert_equal (a : in string; b : in string);
procedure assert_equal (a : in string; b : in string; str : in string);
procedure assert_unequal (a : in integer; b : in integer); procedure assert_unequal (a : in integer; b : in integer);
procedure assert_unequal (a : in integer; b : in integer; str : in string);
procedure assert_unequal (a : in std_logic_vector; b : in std_logic_vector); procedure assert_unequal (a : in std_logic_vector; b : in std_logic_vector);
procedure assert_unequal (a : in std_logic_vector; b : in std_logic_vector; str : in string);
procedure assert_unequal (a : in string; b : in string);
procedure assert_unequal (a : in string; b : in string; str : in string);
end package AssertP; end package AssertP;
@ -26,20 +36,34 @@ end package AssertP;
package body AssertP is package body AssertP is
procedure assert_true (a : boolean) is
procedure assert_true (a : in boolean) is
begin begin
assert a assert a
report "FAILURE: a should be evaluate to true" report "FAILURE: a should be evaluate to true"
severity failure; severity failure;
end procedure assert_true; end procedure assert_true;
procedure assert_false (a : boolean) is
procedure assert_true (a : in boolean; str : in string) is
begin
assert a
report "FAILURE: " & str
severity failure;
end procedure assert_true;
procedure assert_false (a : in boolean) is
begin begin
assert not(a) assert not(a)
report "FAILURE: a should be evaluate to false" report "FAILURE: a should be evaluate to false"
severity failure; severity failure;
end procedure assert_false; end procedure assert_false;
procedure assert_false (a : in boolean; str : in string) is
begin
assert not(a)
report "FAILURE: " & str
severity failure;
end procedure assert_false;
procedure assert_equal (a : in integer; b : in integer) is procedure assert_equal (a : in integer; b : in integer) is
begin begin
assert a = b assert a = b
@ -47,6 +71,13 @@ package body AssertP is
severity failure; severity failure;
end procedure assert_equal; end procedure assert_equal;
procedure assert_equal (a : in integer; b : in integer; str : in string) is
begin
assert a = b
report "FAILURE: " & str
severity failure;
end procedure assert_equal;
procedure assert_equal (a : in std_logic_vector; b : in std_logic_vector) is procedure assert_equal (a : in std_logic_vector; b : in std_logic_vector) is
begin begin
assert a = b assert a = b
@ -54,13 +85,27 @@ package body AssertP is
severity failure; severity failure;
end procedure assert_equal; end procedure assert_equal;
procedure assert_equal (a : in string; b : in string) is
begin
procedure assert_equal (a : in std_logic_vector; b : in std_logic_vector; str : in string) is
begin
assert a = b
report "FAILURE: " & str
severity failure;
end procedure assert_equal;
procedure assert_equal (a : in string; b : in string) is
begin
assert a = b assert a = b
report "FAILURE: " & a & " should be equal to " & b report "FAILURE: " & a & " should be equal to " & b
severity failure; severity failure;
end procedure assert_equal; end procedure assert_equal;
procedure assert_equal (a : in string; b : in string; str : in string) is
begin
assert a = b
report "FAILURE: " & str
severity failure;
end procedure assert_equal;
procedure assert_unequal (a : in integer; b : in integer) is procedure assert_unequal (a : in integer; b : in integer) is
begin begin
assert a /= b assert a /= b
@ -68,6 +113,13 @@ package body AssertP is
severity failure; severity failure;
end procedure assert_unequal; end procedure assert_unequal;
procedure assert_unequal (a : in integer; b : in integer; str : in string) is
begin
assert a /= b
report "FAILURE: " & str
severity failure;
end procedure assert_unequal;
procedure assert_unequal (a : in std_logic_vector; b : in std_logic_vector) is procedure assert_unequal (a : in std_logic_vector; b : in std_logic_vector) is
begin begin
assert a /= b assert a /= b
@ -75,5 +127,26 @@ package body AssertP is
severity failure; severity failure;
end procedure assert_unequal; end procedure assert_unequal;
procedure assert_unequal (a : in std_logic_vector; b : in std_logic_vector; str : in string) is
begin
assert a /= b
report "FAILURE: " & str
severity failure;
end procedure assert_unequal;
procedure assert_unequal (a : in string; b : in string) is
begin
assert a /= b
report "FAILURE: " & a & " should be unequal to " & b
severity failure;
end procedure assert_unequal;
procedure assert_unequal (a : in string; b : in string; str : in string) is
begin
assert a /= b
report "FAILURE: " & str
severity failure;
end procedure assert_unequal;
end package body AssertP;
end package body AssertP;

Loading…
Cancel
Save