Skip to content

Commit

Permalink
Include comparison of opaque fields in test case
Browse files Browse the repository at this point in the history
Ref: #964
  • Loading branch information
rssen committed Apr 29, 2022
1 parent adba049 commit 601b0a8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
5 changes: 4 additions & 1 deletion tests/data/specs/aggregate_in_relation.rflx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ package Aggregate_In_Relation is
if Fld_C = [16#CC#, 16#CC#]
then null
if Fld_C /= [16#CC#, 16#CC#];
Fld_D : D;
Fld_D : Opaque
with Size => 16
then null
if Fld_D = Fld_A;
end message;

end Aggregate_In_Relation;
23 changes: 18 additions & 5 deletions tests/unit/expression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,8 @@ def test_relation_simplified() -> None:
)
assert_equal(Equal(String("Foo Bar"), String("Foo Bar")).simplified(), TRUE)
assert_equal(
Equal(String("Foo"), Aggregate(Number(70), Number(111), Number(111))).simplified(), TRUE
Equal(String("Foo"), Aggregate(Number(70), Number(111), Number(111))).simplified(),
TRUE,
)
assert_equal(
Equal(
Expand All @@ -1097,10 +1098,22 @@ def test_relation_simplified() -> None:
).simplified(),
FALSE,
)
assert_equal(Equal(Number(0), Aggregate(Number(0), Number(1), Number(2))).simplified(), FALSE)
assert_equal(Equal(Aggregate(Number(0), Number(1), Number(2)), Number(0)).simplified(), FALSE)
assert_equal(NotEqual(Number(4), Aggregate(Number(0), Number(1), Number(2))).simplified(), TRUE)
assert_equal(NotEqual(Number(0), Aggregate(Number(0), Number(1), Number(2))).simplified(), TRUE)
assert_equal(
Equal(Number(0), Aggregate(Number(0), Number(1), Number(2))).simplified(),
FALSE,
)
assert_equal(
Equal(Aggregate(Number(0), Number(1), Number(2)), Number(0)).simplified(),
FALSE,
)
assert_equal(
NotEqual(Number(4), Aggregate(Number(0), Number(1), Number(2))).simplified(),
TRUE,
)
assert_equal(
NotEqual(Number(0), Aggregate(Number(0), Number(1), Number(2))).simplified(),
TRUE,
)
assert Equal(TRUE, TRUE).simplified() == TRUE
assert Equal(TRUE, FALSE).simplified() == FALSE
assert NotEqual(TRUE, TRUE).simplified() == FALSE
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/pyrflx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,6 @@ def test_low_order(low_order_package: Package) -> None:

def test_aggregate_in_relation_valid(aggregate_in_relation_package: Package) -> None:
msg = aggregate_in_relation_package.new_message("Aggregate_In_Relation_Msg")
msg.parse(b"\xAA\xAA\xBB\xCC\xCC\xDD")
assert msg.bytestring == b"\xAA\xAA\xBB\xCC\xCC\xDD"
msg.parse(b"\xAA\xAA\xBB\xCC\xCC\xAA\xAA")
assert msg.bytestring == b"\xAA\xAA\xBB\xCC\xCC\xAA\xAA"
assert msg.valid_message

0 comments on commit 601b0a8

Please sign in to comment.