Add regression tests for comments in macros
Add regression tests for some corner cases for handling comments in macros. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
c4daf11fac
commit
109b794253
|
|
@ -0,0 +1,16 @@
|
|||
// Check that a '*' or '/' following a C-style comment is supported in a macro
|
||||
|
||||
`define x(a, b) a /* comment */ * b
|
||||
`define y(a, b) a /* comment */ / b
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
if (`x(2, 3) === 6 && `y(8, 2) === 4) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// Check that another comment directly following a C-style comment is
|
||||
// supported in a macro.
|
||||
|
||||
`define x(a, b) a /* comment */// * b
|
||||
`define y(a, b) a /* comment *//*/ b*/
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
if (`x(2, 3) === 2 && `y(8, 2) === 8) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// Check that a '/' directly after opening a C-style comment gets handled
|
||||
// correctly in a macro.
|
||||
|
||||
`define x(a, b) a /*/ b */ + b
|
||||
|
||||
module test;
|
||||
|
||||
initial begin
|
||||
if (`x(2, 3) === 5) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -635,6 +635,9 @@ localparam_type normal ivltests gold=parameter_type.gold
|
|||
long_div normal ivltests gold=long_div.gold
|
||||
macro2 normal ivltests
|
||||
macro_args CO,-yivltests ivltests
|
||||
macro_comment1 normal ivltests
|
||||
macro_comment2 normal ivltests
|
||||
macro_comment3 normal ivltests
|
||||
macro_redefinition normal,-Wmacro-redefinition ivltests gold=macro_redefinition.gold
|
||||
macro_replacement normal,-Wmacro-replacement ivltests gold=macro_replacement.gold
|
||||
macsub normal ivltests
|
||||
|
|
|
|||
Loading…
Reference in New Issue