Tests: Better virtual test

This commit is contained in:
Wilson Snyder 2020-08-23 11:50:42 -04:00
parent 1dce6b2500
commit fefe731105
2 changed files with 36 additions and 2 deletions

View File

@ -1,4 +1,7 @@
%Error-UNSUPPORTED: t/t_class_virtual.v:8:25: Unsupported: 'virtual' class method
8 | virtual function int hello;
| ^~~~~
%Error-UNSUPPORTED: t/t_class_virtual.v:7:9: Unsupported: virtual class
7 | virtual class VC;
7 | virtual class VBase;
| ^~~~~
%Error: Exiting due to

View File

@ -4,5 +4,36 @@
// any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
virtual class VC;
virtual class VBase;
virtual function int hello;
return 1;
endfunction
endclass
`ifndef VERILATOR
virtual class VA extends VBase;
virtual function int hello;
return 2;
endfunction
endclass
virtual class VB extends VBase;
virtual function int hello;
return 3;
endfunction
endclass
module t;
initial begin
VA va = new;
VB vb = new;
VBase b;
b = va;
if (b.hello() != 2) $stop;
b = vb;
if (b.hello() != 3) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule
`endif