Tests: Style updates

This commit is contained in:
Wilson Snyder 2026-01-17 12:19:18 -05:00
parent 98114428cb
commit b5fdcdf745
6 changed files with 23 additions and 37 deletions

View File

@ -4,59 +4,59 @@
// any use, without warranty, 2026.
// SPDX-License-Identifier: CC0-1.0
module t_inside_unbounded;
module t;
initial begin
int value;
// Test [$:100] - should match minimum to 100
value = 50;
if (!(value inside {[$:100]})) $stop;
if (!(value inside {[$ : 100]})) $stop;
value = 100;
if (!(value inside {[$:100]})) $stop;
if (!(value inside {[$ : 100]})) $stop;
value = 101;
if (value inside {[$:100]}) $stop; // Should NOT match
if (value inside {[$ : 100]}) $stop; // Should NOT match
// Test [0:$] - should match 0 to maximum
value = 50;
if (!(value inside {[0:$]})) $stop;
if (!(value inside {[0 : $]})) $stop;
value = 0;
if (!(value inside {[0:$]})) $stop;
if (!(value inside {[0 : $]})) $stop;
// Test [100:$] - should match 100 to maximum
value = 100;
if (!(value inside {[100:$]})) $stop;
if (!(value inside {[100 : $]})) $stop;
value = 200;
if (!(value inside {[100:$]})) $stop;
if (!(value inside {[100 : $]})) $stop;
value = 50;
if (value inside {[100:$]}) $stop; // Should NOT match
if (value inside {[100 : $]}) $stop; // Should NOT match
// Test mixed with other ranges
value = 5;
if (!(value inside {[$:10], [90:$]})) $stop;
if (!(value inside {[$ : 10], [90 : $]})) $stop;
value = 95;
if (!(value inside {[$:10], [90:$]})) $stop;
if (!(value inside {[$ : 10], [90 : $]})) $stop;
value = 50;
if (value inside {[$:10], [90:$]}) $stop; // Should NOT match
if (value inside {[$ : 10], [90 : $]}) $stop; // Should NOT match
// Test with function
if (!(get_value(50) inside {[$:100]})) $stop;
if (!(get_value(50) inside {[0:$]})) $stop;
if (get_value(50) inside {[100:$]}) $stop; // Should NOT match
if (!(get_value(50) inside {[$ : 100]})) $stop;
if (!(get_value(50) inside {[0 : $]})) $stop;
if (get_value(50) inside {[100 : $]}) $stop; // Should NOT match
// Test with increment
value = 49;
if (!(++value inside {[$:100]})) $stop; // value becomes 50
if (!(++value inside {[$ : 100]})) $stop; // value becomes 50
if (value != 50) $stop;
value = -1;
if (!(++value inside {[0:$]})) $stop; // value becomes 0
if (!(++value inside {[0 : $]})) $stop; // value becomes 0
if (value != 0) $stop;
$write("*-* All Finished *-*\n");

View File

@ -1,15 +0,0 @@
// DESCRIPTION: Verilator: Test for unsupported [$:$] in inside range
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2026.
// SPDX-License-Identifier: CC0-1.0
module t_inside_unbounded_bad;
initial begin
int value;
value = 50;
// [$:$] should warn - always true
if (value inside {[$:$]}) $display("PASS");
$finish;
end
endmodule

View File

@ -4,12 +4,12 @@
// any use, without warranty, 2026.
// SPDX-License-Identifier: CC0-1.0
module t_inside_unbounded_nowarn;
module t;
initial begin
int value;
value = 50;
// [$:$] is always true - warning suppressed with -Wno-INSIDETRUE
if (!(value inside {[$:$]})) $stop;
if (!(value inside {[$ : $]})) $stop;
$write("*-* All Finished *-*\n");
$finish;
end

View File

@ -1,6 +1,6 @@
%Warning-INSIDETRUE: t/t_inside_unbounded_bad.v:12:23: Unbounded on both sides of inside range [$:$] is always true
12 | if (value inside {[$:$]}) $display("PASS");
| ^
%Warning-INSIDETRUE: t/t_inside_unbounded_both.v:12:25: Unbounded on both sides of inside range [$:$] is always true
12 | if (!(value inside {[$ : $]})) $stop;
| ^
... For warning description see https://verilator.org/warn/INSIDETRUE?v=latest
... Use "/* verilator lint_off INSIDETRUE */" and lint_on around source to disable this message.
%Error: Exiting due to

View File

@ -10,6 +10,7 @@
import vltest_bootstrap
test.scenarios('vlt')
test.top_filename = 't/t_inside_unbounded_both.v'
test.lint(fails=True, expect_filename=test.golden_filename)