From 0642489e95fd7b1a796e4541d88ff16b701ec2f1 Mon Sep 17 00:00:00 2001 From: Niels Steenbergen Date: Fri, 12 Aug 2022 17:48:07 +0200 Subject: [PATCH] Add some tests towards #79. --- tests/test_type.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_type.py b/tests/test_type.py index 678850c..679ce22 100644 --- a/tests/test_type.py +++ b/tests/test_type.py @@ -469,6 +469,29 @@ def test_concretization(self): self.assertEqual(F(F(_)).concretize(replace=Top), F(F(Top))) self.assertEqual(G.concretize(replace=Top), F(Top)) + @unittest.skip("see issue #79") + def test_intersection_type_order_is_irrelevant(self): + A, B, C = (TypeOperator() for _ in range(3)) + self.assertMatch(A & B & C, C & B & A, subtype=False) + + @unittest.skip("see issue #79") + def test_intersection_type_subtype(self): + A, B, C = (TypeOperator() for _ in range(3)) + F = TypeOperator(params=1) + self.assertMatch(A & B & C, B, subtype=True) + self.assertMatch(A & B & C, A & B, subtype=True) + self.assertMatch(A & B & C, A & C, subtype=True) + self.assertMatch(F(A & B & C), F(A), subtype=True) + self.assertNotMatch(A, A & B, subtype=True) + self.assertNotMatch(F(A), F(A & B), subtype=True) + self.assertNotMatch(F(A) & F(B), F(A & B), subtype=True) + + @unittest.skip("see issue #79") + def test_empty_intersection(self): + A, B, C = (TypeOperator() for _ in range(3)) + F = TypeOperator(params=1) + G = TypeOperator(params=1) + self.assertMatch(F(A) & G(A), Bottom) if __name__ == '__main__': unittest.main()