diff options
author | Kristóf Marussy <kristof@marussy.com> | 2023-06-18 14:31:05 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2023-06-18 16:44:15 +0200 |
commit | cd4d5aecd2c1ceedc49657f315d3a543b48779c5 (patch) | |
tree | 820b1ab5087474b7ca74cda611d33128ccf1fde7 /subprojects/store-query/src/test | |
parent | refactor: clean up Symbol constructor (diff) | |
download | refinery-cd4d5aecd2c1ceedc49657f315d3a543b48779c5.tar.gz refinery-cd4d5aecd2c1ceedc49657f315d3a543b48779c5.tar.zst refinery-cd4d5aecd2c1ceedc49657f315d3a543b48779c5.zip |
refactor: prefer Query.of over Dnf.of
Diffstat (limited to 'subprojects/store-query/src/test')
2 files changed, 13 insertions, 13 deletions
diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java index 3608d09e..c52d26b2 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/dnf/VariableDirectionTest.java | |||
@@ -38,7 +38,7 @@ class VariableDirectionTest { | |||
38 | private static final Symbol<Integer> age = Symbol.of("age", 1, Integer.class); | 38 | private static final Symbol<Integer> age = Symbol.of("age", 1, Integer.class); |
39 | private static final AnySymbolView personView = new KeyOnlyView<>(person); | 39 | private static final AnySymbolView personView = new KeyOnlyView<>(person); |
40 | private static final AnySymbolView friendView = new KeyOnlyView<>(friend); | 40 | private static final AnySymbolView friendView = new KeyOnlyView<>(friend); |
41 | private static final AnySymbolView ageView = new FunctionView<>(age); | 41 | private static final FunctionView<Integer> ageView = new FunctionView<>(age); |
42 | private static final NodeVariable p = Variable.of("p"); | 42 | private static final NodeVariable p = Variable.of("p"); |
43 | private static final NodeVariable q = Variable.of("q"); | 43 | private static final NodeVariable q = Variable.of("q"); |
44 | private static final DataVariable<Integer> x = Variable.of("x", Integer.class); | 44 | private static final DataVariable<Integer> x = Variable.of("x", Integer.class); |
@@ -149,10 +149,10 @@ class VariableDirectionTest { | |||
149 | return Stream.of( | 149 | return Stream.of( |
150 | Arguments.of(not(friendView.call(p, q))), | 150 | Arguments.of(not(friendView.call(p, q))), |
151 | Arguments.of(y.assign(friendView.count(p, q))), | 151 | Arguments.of(y.assign(friendView.count(p, q))), |
152 | Arguments.of(y.assign(ageView.aggregate(z, INT_SUM, p, z))), | 152 | Arguments.of(y.assign(ageView.aggregate(INT_SUM, p))), |
153 | Arguments.of(not(dnfWithOutput.call(p, q))), | 153 | Arguments.of(not(dnfWithOutput.call(p, q))), |
154 | Arguments.of(y.assign(dnfWithOutput.count(p, q))), | 154 | Arguments.of(y.assign(dnfWithOutput.count(p, q))), |
155 | Arguments.of(y.assign(dnfWithOutputToAggregate.aggregate(z, INT_SUM, p, q, z))) | 155 | Arguments.of(y.assign(dnfWithOutputToAggregate.aggregateBy(z, INT_SUM, p, q, z))) |
156 | ); | 156 | ); |
157 | } | 157 | } |
158 | 158 | ||
@@ -192,8 +192,8 @@ class VariableDirectionTest { | |||
192 | Arguments.of(not(dnfWithInput.call(p, p))), | 192 | Arguments.of(not(dnfWithInput.call(p, p))), |
193 | Arguments.of(y.assign(dnfWithInput.count(p, q))), | 193 | Arguments.of(y.assign(dnfWithInput.count(p, q))), |
194 | Arguments.of(y.assign(dnfWithInput.count(p, p))), | 194 | Arguments.of(y.assign(dnfWithInput.count(p, p))), |
195 | Arguments.of(y.assign(dnfWithInputToAggregate.aggregate(z, INT_SUM, p, q, z))), | 195 | Arguments.of(y.assign(dnfWithInputToAggregate.aggregateBy(z, INT_SUM, p, q, z))), |
196 | Arguments.of(y.assign(dnfWithInputToAggregate.aggregate(z, INT_SUM, p, p, z))) | 196 | Arguments.of(y.assign(dnfWithInputToAggregate.aggregateBy(z, INT_SUM, p, p, z))) |
197 | ); | 197 | ); |
198 | } | 198 | } |
199 | 199 | ||
@@ -357,7 +357,7 @@ class VariableDirectionTest { | |||
357 | Arguments.of(dnfWithInput.call(x, q)), | 357 | Arguments.of(dnfWithInput.call(x, q)), |
358 | Arguments.of(not(dnfWithInput.call(x, q))), | 358 | Arguments.of(not(dnfWithInput.call(x, q))), |
359 | Arguments.of(y.assign(dnfWithInput.count(x, q))), | 359 | Arguments.of(y.assign(dnfWithInput.count(x, q))), |
360 | Arguments.of(y.assign(dnfWithInputToAggregate.aggregate(z, INT_SUM, x, q, z))) | 360 | Arguments.of(y.assign(dnfWithInputToAggregate.aggregateBy(z, INT_SUM, x, q, z))) |
361 | ); | 361 | ); |
362 | } | 362 | } |
363 | 363 | ||
@@ -415,10 +415,10 @@ class VariableDirectionTest { | |||
415 | Arguments.of(x.assign(constant(24))), | 415 | Arguments.of(x.assign(constant(24))), |
416 | Arguments.of(ageView.call(q, x)), | 416 | Arguments.of(ageView.call(q, x)), |
417 | Arguments.of(x.assign(personView.count(q))), | 417 | Arguments.of(x.assign(personView.count(q))), |
418 | Arguments.of(x.assign(ageView.aggregate(z, INT_SUM, q, z))), | 418 | Arguments.of(x.assign(ageView.aggregate(INT_SUM, q))), |
419 | Arguments.of(dnfWithDataOutput.call(x, q)), | 419 | Arguments.of(dnfWithDataOutput.call(x, q)), |
420 | Arguments.of(x.assign(dnfWithOutput.count(q))), | 420 | Arguments.of(x.assign(dnfWithOutput.count(q))), |
421 | Arguments.of(x.assign(dnfWithOutputToAggregate.aggregate(z, INT_SUM, q, z))) | 421 | Arguments.of(x.assign(dnfWithOutputToAggregate.aggregateBy(z, INT_SUM, q, z))) |
422 | ); | 422 | ); |
423 | } | 423 | } |
424 | 424 | ||
diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/literal/AggregationLiteralTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/literal/AggregationLiteralTest.java index 5293b273..35910e08 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/literal/AggregationLiteralTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/literal/AggregationLiteralTest.java | |||
@@ -44,7 +44,7 @@ class AggregationLiteralTest { | |||
44 | 44 | ||
45 | @Test | 45 | @Test |
46 | void parameterDirectionTest() { | 46 | void parameterDirectionTest() { |
47 | var literal = x.assign(fakeConstraint.aggregate(y, INT_SUM, p, y)); | 47 | var literal = x.assign(fakeConstraint.aggregateBy(y, INT_SUM, p, y)); |
48 | assertAll( | 48 | assertAll( |
49 | () -> assertThat(literal.getOutputVariables(), containsInAnyOrder(x)), | 49 | () -> assertThat(literal.getOutputVariables(), containsInAnyOrder(x)), |
50 | () -> assertThat(literal.getInputVariables(Set.of()), empty()), | 50 | () -> assertThat(literal.getInputVariables(Set.of()), empty()), |
@@ -56,13 +56,13 @@ class AggregationLiteralTest { | |||
56 | 56 | ||
57 | @Test | 57 | @Test |
58 | void missingAggregationVariableTest() { | 58 | void missingAggregationVariableTest() { |
59 | var aggregation = fakeConstraint.aggregate(y, INT_SUM, p, z); | 59 | var aggregation = fakeConstraint.aggregateBy(y, INT_SUM, p, z); |
60 | assertThrows(IllegalArgumentException.class, () -> x.assign(aggregation)); | 60 | assertThrows(IllegalArgumentException.class, () -> x.assign(aggregation)); |
61 | } | 61 | } |
62 | 62 | ||
63 | @Test | 63 | @Test |
64 | void circularAggregationVariableTest() { | 64 | void circularAggregationVariableTest() { |
65 | var aggregation = fakeConstraint.aggregate(x, INT_SUM, p, x); | 65 | var aggregation = fakeConstraint.aggregateBy(x, INT_SUM, p, x); |
66 | assertThrows(IllegalArgumentException.class, () -> x.assign(aggregation)); | 66 | assertThrows(IllegalArgumentException.class, () -> x.assign(aggregation)); |
67 | } | 67 | } |
68 | 68 | ||
@@ -71,7 +71,7 @@ class AggregationLiteralTest { | |||
71 | var builder = Dnf.builder() | 71 | var builder = Dnf.builder() |
72 | .clause( | 72 | .clause( |
73 | not(fakeConstraint.call(p, y)), | 73 | not(fakeConstraint.call(p, y)), |
74 | x.assign(fakeConstraint.aggregate(y, INT_SUM, p, y)) | 74 | x.assign(fakeConstraint.aggregateBy(y, INT_SUM, p, y)) |
75 | ); | 75 | ); |
76 | assertThrows(IllegalArgumentException.class, builder::build); | 76 | assertThrows(IllegalArgumentException.class, builder::build); |
77 | } | 77 | } |
@@ -81,7 +81,7 @@ class AggregationLiteralTest { | |||
81 | var builder = Dnf.builder() | 81 | var builder = Dnf.builder() |
82 | .clause( | 82 | .clause( |
83 | y.assign(constant(27)), | 83 | y.assign(constant(27)), |
84 | x.assign(fakeConstraint.aggregate(y, INT_SUM, p, y)) | 84 | x.assign(fakeConstraint.aggregateBy(y, INT_SUM, p, y)) |
85 | ); | 85 | ); |
86 | assertThrows(IllegalArgumentException.class, builder::build); | 86 | assertThrows(IllegalArgumentException.class, builder::build); |
87 | } | 87 | } |