aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gradle/junit.gradle5
-rw-r--r--model-data/build.gradle2
-rw-r--r--model-data/src/test/java/org/eclipse/viatra/solver/data/query/test/QueryTest.java20
3 files changed, 15 insertions, 12 deletions
diff --git a/gradle/junit.gradle b/gradle/junit.gradle
index b36b30b4..3f3970d9 100644
--- a/gradle/junit.gradle
+++ b/gradle/junit.gradle
@@ -1,3 +1,5 @@
1apply plugin: 'jacoco'
2
1dependencies { 3dependencies {
2 testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}" 4 testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
3 testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" 5 testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
@@ -14,3 +16,6 @@ test {
14task slowTest(type: Test) { 16task slowTest(type: Test) {
15 useJUnitPlatform() 17 useJUnitPlatform()
16} 18}
19
20test.finalizedBy(jacocoTestReport)
21jacocoTestReport.dependsOn(test)
diff --git a/model-data/build.gradle b/model-data/build.gradle
index 2d0aef9a..95336602 100644
--- a/model-data/build.gradle
+++ b/model-data/build.gradle
@@ -4,5 +4,5 @@ apply from: "${rootDir}/gradle/jmh.gradle"
4 4
5dependencies { 5dependencies {
6 compile "org.eclipse.viatra:viatra-query-runtime:${viatraVersion}" 6 compile "org.eclipse.viatra:viatra-query-runtime:${viatraVersion}"
7 compile "org.eclipse.emf:org.eclipse.emf.ecore:2.24.0" 7 compile "org.eclipse.emf:org.eclipse.emf.ecore:${ecoreVersion}"
8} 8}
diff --git a/model-data/src/test/java/org/eclipse/viatra/solver/data/query/test/QueryTest.java b/model-data/src/test/java/org/eclipse/viatra/solver/data/query/test/QueryTest.java
index 50fcf3f4..ca73b103 100644
--- a/model-data/src/test/java/org/eclipse/viatra/solver/data/query/test/QueryTest.java
+++ b/model-data/src/test/java/org/eclipse/viatra/solver/data/query/test/QueryTest.java
@@ -40,17 +40,16 @@ class QueryTest {
40 RelationView<Boolean> persionView = new TupleRelationView(model, person); 40 RelationView<Boolean> persionView = new TupleRelationView(model, person);
41 41
42 RelationalScope scope = new RelationalScope(Set.of(persionView)); 42 RelationalScope scope = new RelationalScope(Set.of(persionView));
43 43
44 GenericQuerySpecification<GenericPatternMatcher> personQuery = (new RelationalQuery("PersonQuery")) 44 GenericQuerySpecification<GenericPatternMatcher> personQuery = (new RelationalQuery("PersonQuery"))
45 .addParameter("p",persionView) 45 .addParameter("p", persionView).addConstraint(persionView, "p").build();
46 .addConstraint(persionView, "p").build(); 46
47
48 ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope); 47 ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope);
49 GenericPatternMatcher personMatcher = engine.getMatcher(personQuery); 48 GenericPatternMatcher personMatcher = engine.getMatcher(personQuery);
50 49
51 assertEquals(2, personMatcher.countMatches()); 50 assertEquals(2, personMatcher.countMatches());
52 } 51 }
53 52
54 void modelBuildingTest() { 53 void modelBuildingTest() {
55 Relation<Boolean> person = new Relation<>("Person", 1, false); 54 Relation<Boolean> person = new Relation<>("Person", 1, false);
56 Relation<Integer> age = new Relation<Integer>("age", 1, null); 55 Relation<Integer> age = new Relation<Integer>("age", 1, null);
@@ -78,15 +77,14 @@ class QueryTest {
78 RelationView<TruthValue> friendMayView = new FilteredRelationView<TruthValue>(model, friend, (k, v) -> v.may()); 77 RelationView<TruthValue> friendMayView = new FilteredRelationView<TruthValue>(model, friend, (k, v) -> v.may());
79 78
80 RelationalScope scope = new RelationalScope(Set.of(persionView, ageView, friendMustView, friendMayView)); 79 RelationalScope scope = new RelationalScope(Set.of(persionView, ageView, friendMustView, friendMayView));
81 80
82 GenericQuerySpecification<GenericPatternMatcher> personQuery = (new RelationalQuery("PersonQuery")) 81 GenericQuerySpecification<GenericPatternMatcher> personQuery = (new RelationalQuery("PersonQuery"))
83 .addParameter("p",persionView) 82 .addParameter("p", persionView).addConstraint(persionView, "p").build();
84 .addConstraint(persionView, "p").build(); 83
85
86 ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope); 84 ViatraQueryEngine engine = AdvancedViatraQueryEngine.on(scope);
87 GenericPatternMatcher personMatcher = engine.getMatcher(personQuery); 85 GenericPatternMatcher personMatcher = engine.getMatcher(personQuery);
88 Collection<GenericPatternMatch> personMatches = personMatcher.getAllMatches(); 86 Collection<GenericPatternMatch> personMatches = personMatcher.getAllMatches();
89 for(GenericPatternMatch personMatch : personMatches) { 87 for (GenericPatternMatch personMatch : personMatches) {
90 System.out.println(personMatch); 88 System.out.println(personMatch);
91 } 89 }
92 } 90 }