Skip to content

Commit

Permalink
updated testcase for new bug
Browse files Browse the repository at this point in the history
  • Loading branch information
udif committed Jan 25, 2024
1 parent a060f15 commit acfb543
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/unittests/parsing/ExpressionParsingTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,12 +918,25 @@ shortint a = -16'sd32769;
int b = -32'sd2147483649;
int c = 32'd4294967297;
int d = 9'so777;
shortint e = 16'sd32768;
)";
parseCompilationUnit(text);

REQUIRE(diagnostics.size() == 4);
REQUIRE(diagnostics.size() == 5);
CHECK(diagnostics[0].code == diag::VectorLiteralOverflow);
CHECK(diagnostics[1].code == diag::VectorLiteralOverflow);
CHECK(diagnostics[2].code == diag::VectorLiteralOverflow);
CHECK(diagnostics[3].code == diag::VectorLiteralOverflow);
CHECK(diagnostics[4].code == diag::VectorLiteralOverflow);
}

TEST_CASE("Vector literal bounary value parsing not overflowing") {
auto& text = R"(
shortint a0 = -16'sd32767;
shortint a1 = -16'sd32768;
shortint a2 = 16'sd32767;
)";
parseCompilationUnit(text);

REQUIRE(diagnostics.size() == 0);
}

0 comments on commit acfb543

Please sign in to comment.