Skip to content

Commit

Permalink
Always use FINAL field constant
Browse files Browse the repository at this point in the history
Ref. #282
  • Loading branch information
Alexander Senier committed Jun 27, 2020
1 parent e4128c5 commit 546dd03
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/test_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ def test_aggregate_equal_valid_length() -> None:
Link(INITIAL, Field("Magic"), length=Number(40)),
Link(
Field("Magic"),
Field("Final"),
FINAL,
condition=Equal(
Variable("Magic"), Aggregate(Number(1), Number(2), Number(3), Number(4), Number(4)),
),
Expand All @@ -977,7 +977,7 @@ def test_aggregate_equal_invalid_length1() -> None:
Link(INITIAL, Field("Magic"), length=Number(40)),
Link(
Field("Magic"),
Field("Final"),
FINAL,
condition=Equal(Variable("Magic"), Aggregate(Number(1), Number(2))),
),
]
Expand All @@ -1000,7 +1000,7 @@ def test_aggregate_equal_invalid_length2() -> None:
Link(INITIAL, Field("Magic"), length=Number(40)),
Link(
Field("Magic"),
Field("Final"),
FINAL,
condition=Equal(Aggregate(Number(1), Number(2)), Variable("Magic")),
),
]
Expand All @@ -1023,7 +1023,7 @@ def test_aggregate_inequal_valid_length() -> None:
Link(INITIAL, Field("Magic"), length=Number(40)),
Link(
Field("Magic"),
Field("Final"),
FINAL,
condition=NotEqual(
Variable("Magic"), Aggregate(Number(1), Number(2), Number(3), Number(4), Number(4)),
),
Expand All @@ -1040,7 +1040,7 @@ def test_aggregate_inequal_invalid_length() -> None:
Link(INITIAL, Field("Magic"), length=Number(40)),
Link(
Field("Magic"),
Field("Final"),
FINAL,
condition=NotEqual(Variable("Magic"), Aggregate(Number(1), Number(2))),
),
]
Expand All @@ -1063,7 +1063,7 @@ def test_aggregate_equal_array_valid_length() -> None:
Link(INITIAL, Field("Magic"), length=Number(14)),
Link(
Field("Magic"),
Field("Final"),
FINAL,
condition=NotEqual(Variable("Magic"), Aggregate(Number(1), Number(2))),
),
]
Expand All @@ -1075,12 +1075,11 @@ def test_aggregate_equal_array_valid_length() -> None:

def test_aggregate_equal_array_invalid_length() -> None:
magic = Field(ID("Magic", Location((3, 5))))
final = Field(ID("Final", Location((10, 7))))
structure = [
Link(INITIAL, magic, length=Number(40, location=Location((19, 17)))),
Link(
magic,
final,
FINAL,
condition=NotEqual(
Variable("Magic"), Aggregate(Number(1), Number(2)), Location((17, 3))
),
Expand Down Expand Up @@ -1162,11 +1161,10 @@ def test_no_contradiction_multi() -> None:


def test_opaque_equal_scalar() -> None:
final = Field(ID("Final", Location((10, 7))))
structure = [
Link(INITIAL, Field("Length")),
Link(Field("Length"), Field("Data"), length=Variable("Length")),
Link(Field("Data"), final, condition=Equal(Variable("Data"), Number(42))),
Link(Field("Data"), FINAL, condition=Equal(Variable("Data"), Number(42))),
]
types = {Field("Length"): RANGE_INTEGER, Field("Data"): Opaque()}
assert_message_model_error(
Expand Down

0 comments on commit 546dd03

Please sign in to comment.