diff options
author | 2023-02-24 20:21:15 +0100 | |
---|---|---|
committer | 2023-02-24 23:29:49 +0100 | |
commit | f8a3c575e400259a4985233c07b7a50e5d4d82c5 (patch) | |
tree | f5975a19fcce28eba17b5af8adde5a37ddba83c6 /subprojects/store-partial | |
parent | refactor: split query and partial from store (diff) | |
download | refinery-f8a3c575e400259a4985233c07b7a50e5d4d82c5.tar.gz refinery-f8a3c575e400259a4985233c07b7a50e5d4d82c5.tar.zst refinery-f8a3c575e400259a4985233c07b7a50e5d4d82c5.zip |
feat: Dnf reduction and structural equality
Diffstat (limited to 'subprojects/store-partial')
6 files changed, 80 insertions, 42 deletions
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java index a49e0625..8c157187 100644 --- a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalDnfCallLiteral.java | |||
@@ -2,13 +2,14 @@ package tools.refinery.store.partial.literal; | |||
2 | 2 | ||
3 | import tools.refinery.store.query.Dnf; | 3 | import tools.refinery.store.query.Dnf; |
4 | import tools.refinery.store.query.Variable; | 4 | import tools.refinery.store.query.Variable; |
5 | import tools.refinery.store.query.equality.LiteralEqualityHelper; | ||
5 | import tools.refinery.store.query.literal.CallPolarity; | 6 | import tools.refinery.store.query.literal.CallPolarity; |
6 | import tools.refinery.store.query.literal.DnfCallLiteral; | 7 | import tools.refinery.store.query.literal.DnfCallLiteral; |
7 | import tools.refinery.store.query.literal.LiteralReduction; | 8 | import tools.refinery.store.query.literal.LiteralReduction; |
8 | import tools.refinery.store.query.literal.PolarLiteral; | 9 | import tools.refinery.store.query.literal.PolarLiteral; |
10 | import tools.refinery.store.query.substitution.Substitution; | ||
9 | 11 | ||
10 | import java.util.List; | 12 | import java.util.List; |
11 | import java.util.Map; | ||
12 | 13 | ||
13 | public class ModalDnfCallLiteral extends ModalLiteral<Dnf> implements PolarLiteral<ModalDnfCallLiteral> { | 14 | public class ModalDnfCallLiteral extends ModalLiteral<Dnf> implements PolarLiteral<ModalDnfCallLiteral> { |
14 | public ModalDnfCallLiteral(CallPolarity polarity, Modality modality, Dnf target, List<Variable> arguments) { | 15 | public ModalDnfCallLiteral(CallPolarity polarity, Modality modality, Dnf target, List<Variable> arguments) { |
@@ -20,7 +21,17 @@ public class ModalDnfCallLiteral extends ModalLiteral<Dnf> implements PolarLiter | |||
20 | } | 21 | } |
21 | 22 | ||
22 | @Override | 23 | @Override |
23 | public ModalDnfCallLiteral substitute(Map<Variable, Variable> substitution) { | 24 | public Class<Dnf> getTargetType() { |
25 | return Dnf.class; | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | protected boolean targetEquals(LiteralEqualityHelper helper, Dnf otherTarget) { | ||
30 | return helper.dnfEqual(getTarget(), otherTarget); | ||
31 | } | ||
32 | |||
33 | @Override | ||
34 | public ModalDnfCallLiteral substitute(Substitution substitution) { | ||
24 | return new ModalDnfCallLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); | 35 | return new ModalDnfCallLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); |
25 | } | 36 | } |
26 | 37 | ||
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java index a1b6c83e..cebe9c9d 100644 --- a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalLiteral.java | |||
@@ -2,8 +2,10 @@ package tools.refinery.store.partial.literal; | |||
2 | 2 | ||
3 | import tools.refinery.store.query.RelationLike; | 3 | import tools.refinery.store.query.RelationLike; |
4 | import tools.refinery.store.query.Variable; | 4 | import tools.refinery.store.query.Variable; |
5 | import tools.refinery.store.query.equality.LiteralEqualityHelper; | ||
5 | import tools.refinery.store.query.literal.CallLiteral; | 6 | import tools.refinery.store.query.literal.CallLiteral; |
6 | import tools.refinery.store.query.literal.CallPolarity; | 7 | import tools.refinery.store.query.literal.CallPolarity; |
8 | import tools.refinery.store.query.literal.Literal; | ||
7 | 9 | ||
8 | import java.util.List; | 10 | import java.util.List; |
9 | import java.util.Objects; | 11 | import java.util.Objects; |
@@ -26,6 +28,22 @@ public abstract class ModalLiteral<T extends RelationLike> extends CallLiteral<T | |||
26 | } | 28 | } |
27 | 29 | ||
28 | @Override | 30 | @Override |
31 | public boolean equalsWithSubstitution(LiteralEqualityHelper helper, Literal other) { | ||
32 | if (!super.equalsWithSubstitution(helper, other)) { | ||
33 | return false; | ||
34 | } | ||
35 | // If {@link CallLiteral#equalsWithSubstitution(LiteralEqualityHelper, Literal)} has returned {@code true}, | ||
36 | // we must have the same dynamic type as {@code other}. | ||
37 | var otherModalLiteral = (ModalLiteral<?>) other; | ||
38 | return modality == otherModalLiteral.modality; | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | protected String targetToString() { | ||
43 | return "%s %s".formatted(modality, super.targetToString()); | ||
44 | } | ||
45 | |||
46 | @Override | ||
29 | public boolean equals(Object o) { | 47 | public boolean equals(Object o) { |
30 | if (this == o) return true; | 48 | if (this == o) return true; |
31 | if (o == null || getClass() != o.getClass()) return false; | 49 | if (o == null || getClass() != o.getClass()) return false; |
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java index dbaa524f..39054f22 100644 --- a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/ModalRelationLiteral.java | |||
@@ -4,9 +4,9 @@ import tools.refinery.store.partial.representation.PartialRelation; | |||
4 | import tools.refinery.store.query.Variable; | 4 | import tools.refinery.store.query.Variable; |
5 | import tools.refinery.store.query.literal.CallPolarity; | 5 | import tools.refinery.store.query.literal.CallPolarity; |
6 | import tools.refinery.store.query.literal.PolarLiteral; | 6 | import tools.refinery.store.query.literal.PolarLiteral; |
7 | import tools.refinery.store.query.substitution.Substitution; | ||
7 | 8 | ||
8 | import java.util.List; | 9 | import java.util.List; |
9 | import java.util.Map; | ||
10 | 10 | ||
11 | public final class ModalRelationLiteral extends ModalLiteral<PartialRelation> | 11 | public final class ModalRelationLiteral extends ModalLiteral<PartialRelation> |
12 | implements PolarLiteral<ModalRelationLiteral> { | 12 | implements PolarLiteral<ModalRelationLiteral> { |
@@ -15,12 +15,18 @@ public final class ModalRelationLiteral extends ModalLiteral<PartialRelation> | |||
15 | super(polarity, modality, target, arguments); | 15 | super(polarity, modality, target, arguments); |
16 | } | 16 | } |
17 | 17 | ||
18 | |||
18 | public ModalRelationLiteral(Modality modality, PartialRelationLiteral baseLiteral) { | 19 | public ModalRelationLiteral(Modality modality, PartialRelationLiteral baseLiteral) { |
19 | super(modality, baseLiteral); | 20 | super(modality, baseLiteral); |
20 | } | 21 | } |
21 | 22 | ||
22 | @Override | 23 | @Override |
23 | public ModalRelationLiteral substitute(Map<Variable, Variable> substitution) { | 24 | public Class<PartialRelation> getTargetType() { |
25 | return PartialRelation.class; | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | public ModalRelationLiteral substitute(Substitution substitution) { | ||
24 | return new ModalRelationLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); | 30 | return new ModalRelationLiteral(getPolarity(), getModality(), getTarget(), substituteArguments(substitution)); |
25 | } | 31 | } |
26 | 32 | ||
diff --git a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java index dc1a1da3..b81d9a3d 100644 --- a/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java +++ b/subprojects/store-partial/src/main/java/tools/refinery/store/partial/literal/PartialRelationLiteral.java | |||
@@ -5,9 +5,9 @@ import tools.refinery.store.query.Variable; | |||
5 | import tools.refinery.store.query.literal.CallLiteral; | 5 | import tools.refinery.store.query.literal.CallLiteral; |
6 | import tools.refinery.store.query.literal.CallPolarity; | 6 | import tools.refinery.store.query.literal.CallPolarity; |
7 | import tools.refinery.store.query.literal.PolarLiteral; | 7 | import tools.refinery.store.query.literal.PolarLiteral; |
8 | import tools.refinery.store.query.substitution.Substitution; | ||
8 | 9 | ||
9 | import java.util.List; | 10 | import java.util.List; |
10 | import java.util.Map; | ||
11 | 11 | ||
12 | public final class PartialRelationLiteral extends CallLiteral<PartialRelation> | 12 | public final class PartialRelationLiteral extends CallLiteral<PartialRelation> |
13 | implements PolarLiteral<PartialRelationLiteral> { | 13 | implements PolarLiteral<PartialRelationLiteral> { |
@@ -16,7 +16,12 @@ public final class PartialRelationLiteral extends CallLiteral<PartialRelation> | |||
16 | } | 16 | } |
17 | 17 | ||
18 | @Override | 18 | @Override |
19 | public PartialRelationLiteral substitute(Map<Variable, Variable> substitution) { | 19 | public Class<PartialRelation> getTargetType() { |
20 | return PartialRelation.class; | ||
21 | } | ||
22 | |||
23 | @Override | ||
24 | public PartialRelationLiteral substitute(Substitution substitution) { | ||
20 | return new PartialRelationLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); | 25 | return new PartialRelationLiteral(getPolarity(), getTarget(), substituteArguments(substitution)); |
21 | } | 26 | } |
22 | 27 | ||
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 | ); |
diff --git a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java index 1aab75bb..02903026 100644 --- a/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.java +++ b/subprojects/store-partial/src/test/java/tools/refinery/store/partial/translator/typehierarchy/TypeAnalyzerTest.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.Test; | 3 | import org.junit.jupiter.api.Test; |
5 | import tools.refinery.store.partial.representation.PartialRelation; | 4 | import tools.refinery.store.partial.representation.PartialRelation; |
6 | import tools.refinery.store.representation.TruthValue; | 5 | import tools.refinery.store.representation.TruthValue; |
@@ -137,8 +136,8 @@ class TypeAnalyzerTest { | |||
137 | 136 | ||
138 | var expected = new InferredType(Set.of(c3), Set.of(c1, c2, c3), c3); | 137 | var expected = new InferredType(Set.of(c3), Set.of(c1, c2, c3), c3); |
139 | assertAll( | 138 | assertAll( |
140 | () -> assertThat(tester.getInferredType(c3), Matchers.is(expected)), | 139 | () -> assertThat(tester.getInferredType(c3), is(expected)), |
141 | () -> assertThat(c3Result.merge(sut.getUnknownType(), TruthValue.TRUE), Matchers.is(expected)) | 140 | () -> assertThat(c3Result.merge(sut.getUnknownType(), TruthValue.TRUE), is(expected)) |
142 | ); | 141 | ); |
143 | } | 142 | } |
144 | 143 | ||
@@ -162,7 +161,7 @@ class TypeAnalyzerTest { | |||
162 | var a1Result = tester.getPreservedType(a1); | 161 | var a1Result = tester.getPreservedType(a1); |
163 | 162 | ||
164 | assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), | 163 | assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), |
165 | Matchers.is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c2))); | 164 | is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c2))); |
166 | } | 165 | } |
167 | 166 | ||
168 | @Test | 167 | @Test |
@@ -185,7 +184,7 @@ class TypeAnalyzerTest { | |||
185 | var a1Result = tester.getPreservedType(a1); | 184 | var a1Result = tester.getPreservedType(a1); |
186 | 185 | ||
187 | assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), | 186 | assertThat(c1Result.merge(a1Result.asInferredType(), TruthValue.FALSE), |
188 | Matchers.is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c3))); | 187 | is(new InferredType(Set.of(a1), Set.of(c2, c3, c4), c3))); |
189 | } | 188 | } |
190 | 189 | ||
191 | @Test | 190 | @Test |