Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Oct 25, 2023
1 parent 35f20a4 commit f042cf2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test_regress/t/t_randomize_method.v
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ class DeriveAndContainClsWithInt extends ClsWithInt;
endfunction
endclass

class ClsUsedOnlyHere;
rand int a;
endclass

typedef ClsUsedOnlyHere cls_used_only_here_t;

class ClsContainUsedOnlyHere;
rand cls_used_only_here_t c;
function new;
c = new;
endfunction
endclass

module t (/*AUTOARG*/);

DerivedCls derived;
Expand All @@ -121,6 +134,7 @@ module t (/*AUTOARG*/);
ContainsNull cont;
DeriveClsWithInt der_int;
DeriveAndContainClsWithInt der_contain;
ClsContainUsedOnlyHere cls_cont_used;

initial begin
int rand_result;
Expand All @@ -130,6 +144,7 @@ module t (/*AUTOARG*/);
der_int = new;
der_contain = new;
base = derived;
cls_cont_used = new;
for (int i = 0; i < 10; i++) begin
rand_result = base.randomize();
rand_result = other.randomize();
Expand Down Expand Up @@ -166,6 +181,7 @@ module t (/*AUTOARG*/);
`check_rand(der_int, der_int.a);
`check_rand(der_contain, der_contain.cls1.a);
`check_rand(der_contain, der_contain.a);
`check_rand(cls_cont_used, cls_cont_used.c.a);

$write("*-* All Finished *-*\n");
$finish;
Expand Down

0 comments on commit f042cf2

Please sign in to comment.