From 60cb317e5da5f7fb76377b41ebb37159ec9f9927 Mon Sep 17 00:00:00 2001 From: fnhartmann Date: Tue, 23 Jan 2024 16:02:11 +0100 Subject: [PATCH] Added test --- tests/util/test_insertion_ordered_set.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/util/test_insertion_ordered_set.py diff --git a/tests/util/test_insertion_ordered_set.py b/tests/util/test_insertion_ordered_set.py new file mode 100644 index 000000000..444f97bce --- /dev/null +++ b/tests/util/test_insertion_ordered_set.py @@ -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]))