Skip to content

Commit

Permalink
Added unit test for combinatorial UDP with conflicting outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
udif committed Apr 4, 2024
1 parent 7e80d8a commit 2e1d5ea
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/unittests/ast/PrimitiveTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,22 @@ primitive p14 (a, b, c);
xx:0:0;
endtable
endprimitive
primitive p15 (a, b);
output a;
input b;
table
0:0;
0:1;
endtable
endprimitive
)");

Compilation compilation;
compilation.addSyntaxTree(tree);

auto& diags = compilation.getAllDiagnostics();
REQUIRE(diags.size() == 24);
REQUIRE(diags.size() == 25);
CHECK(diags[0].code == diag::PrimitiveOutputFirst);
CHECK(diags[1].code == diag::PrimitiveAnsiMix);
CHECK(diags[2].code == diag::DuplicateDefinition);
Expand All @@ -207,6 +216,7 @@ endprimitive
CHECK(diags[21].code == diag::UdpWrongInputCount);
CHECK(diags[22].code == diag::UdpDupDiffOutput);
CHECK(diags[23].code == diag::UdpAllX);
CHECK(diags[24].code == diag::UdpDupDiffOutput);
}

TEST_CASE("UDP instances error checking") {
Expand Down

0 comments on commit 2e1d5ea

Please sign in to comment.