diff options
Diffstat (limited to 'subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java')
-rw-r--r-- | subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java index ad81e28f..5f528328 100644 --- a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java +++ b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerExampleHierarchyTest.java | |||
@@ -1,6 +1,5 @@ | |||
1 | package tools.refinery.store.partial.translator.typehierarchy; | 1 | package tools.refinery.store.partial.translator.typehierarchy; |
2 | 2 | ||
3 | import org.hamcrest.Matchers; | ||
4 | import org.junit.jupiter.api.BeforeEach; | 3 | import org.junit.jupiter.api.BeforeEach; |
5 | import org.junit.jupiter.api.Test; | 4 | import org.junit.jupiter.api.Test; |
6 | import tools.refinery.store.partial.representation.PartialRelation; | 5 | import tools.refinery.store.partial.representation.PartialRelation; |
@@ -61,16 +60,16 @@ class TypeAnalyzerExampleHierarchyTest { | |||
61 | @Test | 60 | @Test |
62 | void inferredTypesTest() { | 61 | void inferredTypesTest() { |
63 | assertAll( | 62 | assertAll( |
64 | () -> assertThat(sut.getUnknownType(), Matchers.is(new InferredType(Set.of(), Set.of(c1, c2, c3, c4), null))), | 63 | () -> assertThat(sut.getUnknownType(), is(new InferredType(Set.of(), Set.of(c1, c2, c3, c4), null))), |
65 | () -> assertThat(tester.getInferredType(a1), Matchers.is(new InferredType(Set.of(a1, a4), Set.of(c1, c2), c1))), | 64 | () -> assertThat(tester.getInferredType(a1), is(new InferredType(Set.of(a1, a4), Set.of(c1, c2), c1))), |
66 | () -> assertThat(tester.getInferredType(a3), Matchers.is(new InferredType(Set.of(a3), Set.of(c2, c3), c2))), | 65 | () -> assertThat(tester.getInferredType(a3), is(new InferredType(Set.of(a3), Set.of(c2, c3), c2))), |
67 | () -> assertThat(tester.getInferredType(a4), Matchers.is(new InferredType(Set.of(a4), Set.of(c1, c2, c4), c1))), | 66 | () -> assertThat(tester.getInferredType(a4), is(new InferredType(Set.of(a4), Set.of(c1, c2, c4), c1))), |
68 | () -> assertThat(tester.getInferredType(a5), Matchers.is(new InferredType(Set.of(a5), Set.of(), null))), | 67 | () -> assertThat(tester.getInferredType(a5), is(new InferredType(Set.of(a5), Set.of(), null))), |
69 | () -> assertThat(tester.getInferredType(c1), Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), | 68 | () -> assertThat(tester.getInferredType(c1), is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), |
70 | () -> assertThat(tester.getInferredType(c2), | 69 | () -> assertThat(tester.getInferredType(c2), |
71 | Matchers.is(new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2))), | 70 | is(new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2))), |
72 | () -> assertThat(tester.getInferredType(c3), Matchers.is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), | 71 | () -> assertThat(tester.getInferredType(c3), is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), |
73 | () -> assertThat(tester.getInferredType(c4), Matchers.is(new InferredType(Set.of(a4, c4), Set.of(c4), c4))) | 72 | () -> assertThat(tester.getInferredType(c4), is(new InferredType(Set.of(a4, c4), Set.of(c4), c4))) |
74 | ); | 73 | ); |
75 | } | 74 | } |
76 | 75 | ||
@@ -80,8 +79,8 @@ class TypeAnalyzerExampleHierarchyTest { | |||
80 | var a3Result = tester.getPreservedType(a3); | 79 | var a3Result = tester.getPreservedType(a3); |
81 | var expected = new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2); | 80 | var expected = new InferredType(Set.of(a1, a3, a4, c2), Set.of(c2), c2); |
82 | assertAll( | 81 | assertAll( |
83 | () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.TRUE), Matchers.is(expected)), | 82 | () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.TRUE), is(expected)), |
84 | () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), Matchers.is(expected)), | 83 | () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), is(expected)), |
85 | () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a1Result.asInferredType())), | 84 | () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a1Result.asInferredType())), |
86 | () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a3Result.asInferredType())), | 85 | () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(a3Result.asInferredType())), |
87 | () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.TRUE), | 86 | () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.TRUE), |
@@ -96,19 +95,19 @@ class TypeAnalyzerExampleHierarchyTest { | |||
96 | var a4Result = tester.getPreservedType(a4); | 95 | var a4Result = tester.getPreservedType(a4); |
97 | assertAll( | 96 | assertAll( |
98 | () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.FALSE), | 97 | () -> assertThat(a1Result.merge(a3Result.asInferredType(), TruthValue.FALSE), |
99 | Matchers.is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), | 98 | is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), |
100 | () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.FALSE), | 99 | () -> assertThat(a3Result.merge(a1Result.asInferredType(), TruthValue.FALSE), |
101 | Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), | 100 | is(new InferredType(Set.of(a1, a4, c1), Set.of(c1), c1))), |
102 | () -> assertThat(a4Result.merge(a3Result.asInferredType(), TruthValue.FALSE), | 101 | () -> assertThat(a4Result.merge(a3Result.asInferredType(), TruthValue.FALSE), |
103 | Matchers.is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), | 102 | is(new InferredType(Set.of(a3, c3), Set.of(c3), c3))), |
104 | () -> assertThat(a3Result.merge(a4Result.asInferredType(), TruthValue.FALSE), | 103 | () -> assertThat(a3Result.merge(a4Result.asInferredType(), TruthValue.FALSE), |
105 | Matchers.is(new InferredType(Set.of(a4), Set.of(c1, c4), c1))), | 104 | is(new InferredType(Set.of(a4), Set.of(c1, c4), c1))), |
106 | () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.FALSE), | 105 | () -> assertThat(a1Result.merge(sut.getUnknownType(), TruthValue.FALSE), |
107 | Matchers.is(new InferredType(Set.of(), Set.of(c3, c4), null))), | 106 | is(new InferredType(Set.of(), Set.of(c3, c4), null))), |
108 | () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.FALSE), | 107 | () -> assertThat(a3Result.merge(sut.getUnknownType(), TruthValue.FALSE), |
109 | Matchers.is(new InferredType(Set.of(), Set.of(c1, c4), null))), | 108 | is(new InferredType(Set.of(), Set.of(c1, c4), null))), |
110 | () -> assertThat(a4Result.merge(sut.getUnknownType(), TruthValue.FALSE), | 109 | () -> assertThat(a4Result.merge(sut.getUnknownType(), TruthValue.FALSE), |
111 | Matchers.is(new InferredType(Set.of(), Set.of(c3), null))) | 110 | is(new InferredType(Set.of(), Set.of(c3), null))) |
112 | ); | 111 | ); |
113 | } | 112 | } |
114 | 113 | ||
@@ -118,8 +117,8 @@ class TypeAnalyzerExampleHierarchyTest { | |||
118 | var a4Result = tester.getPreservedType(a4); | 117 | var a4Result = tester.getPreservedType(a4); |
119 | var expected = new InferredType(Set.of(c1, a1, a4), Set.of(), null); | 118 | var expected = new InferredType(Set.of(c1, a1, a4), Set.of(), null); |
120 | assertAll( | 119 | assertAll( |
121 | () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.ERROR), Matchers.is(expected)), | 120 | () -> assertThat(c1Result.merge(a4Result.asInferredType(), TruthValue.ERROR), is(expected)), |
122 | () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.ERROR), Matchers.is(expected)) | 121 | () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.ERROR), is(expected)) |
123 | ); | 122 | ); |
124 | } | 123 | } |
125 | 124 | ||
@@ -141,9 +140,9 @@ class TypeAnalyzerExampleHierarchyTest { | |||
141 | var c3Result = tester.getPreservedType(c3); | 140 | var c3Result = tester.getPreservedType(c3); |
142 | assertAll( | 141 | assertAll( |
143 | () -> assertThat(a1Result.merge(c3Result.asInferredType(), TruthValue.TRUE), | 142 | () -> assertThat(a1Result.merge(c3Result.asInferredType(), TruthValue.TRUE), |
144 | Matchers.is(new InferredType(Set.of(a1, a3, c3), Set.of(), null))), | 143 | is(new InferredType(Set.of(a1, a3, c3), Set.of(), null))), |
145 | () -> assertThat(c3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), | 144 | () -> assertThat(c3Result.merge(a1Result.asInferredType(), TruthValue.TRUE), |
146 | Matchers.is(new InferredType(Set.of(a1, a3, a4, c3), Set.of(), null))) | 145 | is(new InferredType(Set.of(a1, a3, a4, c3), Set.of(), null))) |
147 | ); | 146 | ); |
148 | } | 147 | } |
149 | 148 | ||
@@ -154,13 +153,13 @@ class TypeAnalyzerExampleHierarchyTest { | |||
154 | var c1Result = tester.getPreservedType(c1); | 153 | var c1Result = tester.getPreservedType(c1); |
155 | assertAll( | 154 | assertAll( |
156 | () -> assertThat(a4Result.merge(a1Result.asInferredType(), TruthValue.FALSE), | 155 | () -> assertThat(a4Result.merge(a1Result.asInferredType(), TruthValue.FALSE), |
157 | Matchers.is(new InferredType(Set.of(a1, a4), Set.of(), null))), | 156 | is(new InferredType(Set.of(a1, a4), Set.of(), null))), |
158 | () -> assertThat(a1Result.merge(c1Result.asInferredType(), TruthValue.FALSE), | 157 | () -> assertThat(a1Result.merge(c1Result.asInferredType(), TruthValue.FALSE), |
159 | Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), | 158 | is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), |
160 | () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.FALSE), | 159 | () -> assertThat(a4Result.merge(c1Result.asInferredType(), TruthValue.FALSE), |
161 | Matchers.is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), | 160 | is(new InferredType(Set.of(a1, a4, c1), Set.of(), null))), |
162 | () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), | 161 | () -> assertThat(a1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), |
163 | Matchers.is(new InferredType(Set.of(a1, a4), Set.of(), null))) | 162 | is(new InferredType(Set.of(a1, a4), Set.of(), null))) |
164 | ); | 163 | ); |
165 | } | 164 | } |
166 | 165 | ||
@@ -170,9 +169,9 @@ class TypeAnalyzerExampleHierarchyTest { | |||
170 | var a5Result = tester.getPreservedType(a5); | 169 | var a5Result = tester.getPreservedType(a5); |
171 | assertAll( | 170 | assertAll( |
172 | () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.TRUE), | 171 | () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.TRUE), |
173 | Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), | 172 | is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), |
174 | () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.TRUE), | 173 | () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.TRUE), |
175 | Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))) | 174 | is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))) |
176 | ); | 175 | ); |
177 | } | 176 | } |
178 | 177 | ||
@@ -194,9 +193,9 @@ class TypeAnalyzerExampleHierarchyTest { | |||
194 | var a5Result = tester.getPreservedType(a5); | 193 | var a5Result = tester.getPreservedType(a5); |
195 | assertAll( | 194 | assertAll( |
196 | () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.ERROR), | 195 | () -> assertThat(c1Result.merge(a5Result.asInferredType(), TruthValue.ERROR), |
197 | Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), | 196 | is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), |
198 | () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.ERROR), | 197 | () -> assertThat(a5Result.merge(c1Result.asInferredType(), TruthValue.ERROR), |
199 | Matchers.is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), | 198 | is(new InferredType(Set.of(a1, a4, a5, c1), Set.of(), null))), |
200 | () -> assertThat(a5Result.merge(a5Result.asInferredType(), TruthValue.ERROR), | 199 | () -> assertThat(a5Result.merge(a5Result.asInferredType(), TruthValue.ERROR), |
201 | is(a5Result.asInferredType())) | 200 | is(a5Result.asInferredType())) |
202 | ); | 201 | ); |