Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
fnhartmann committed Jan 23, 2024
1 parent 1a5186a commit 60cb317
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/util/test_insertion_ordered_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from decompiler.util.insertion_ordered_set import InsertionOrderedSet


def test_insertion_ordered_set_operations():
set_1 = InsertionOrderedSet([1, 2])
set_2 = InsertionOrderedSet([4, 3])
set_3 = InsertionOrderedSet([1, 2, 3, 4, 5])
difference = set_3 - set_1
intersection = set_1 & set_3
symmetric_difference = set_1 ^ set_3
union = set_1 | set_2
assert isinstance(difference, InsertionOrderedSet) and (difference == InsertionOrderedSet([3, 4, 5]))
assert isinstance(intersection, InsertionOrderedSet) and (intersection == InsertionOrderedSet([1, 2]))
assert isinstance(symmetric_difference, InsertionOrderedSet) and (symmetric_difference == InsertionOrderedSet([3, 4, 5]))
assert isinstance(union, InsertionOrderedSet) and (union == InsertionOrderedSet([1, 2, 4, 3]))

0 comments on commit 60cb317

Please sign in to comment.