aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Igne <git@federicoigne.com>2021-10-04 09:54:55 +0100
committerFederico Igne <git@federicoigne.com>2021-10-04 09:54:55 +0100
commit8f6759bfa0cfcfaf379d09c0c331aabb7395d319 (patch)
treede0341d9cecd1e11ae35acd0fb666e4c420ec997
parent0d311287610bcf14a1b4ff35008359dde8c00fc3 (diff)
downloadRSAComb-8f6759bfa0cfcfaf379d09c0c331aabb7395d319.tar.gz
RSAComb-8f6759bfa0cfcfaf379d09c0c331aabb7395d319.zip
Tag some tests as slow
-rw-r--r--README.md23
-rw-r--r--src/test/scala/uk/ac/ox/cs/rsacomb/functional/Functional.scala17
2 files changed, 37 insertions, 3 deletions
diff --git a/README.md b/README.md
index 6fcd98d..e61e889 100644
--- a/README.md
+++ b/README.md
@@ -118,11 +118,32 @@ java -cp <path/to/JRDFox.jar>:<path/to/fat.jar> uk.ac.ox.cs.rsacomb.RSAComb [<op
118 118
119### Running tests 119### Running tests
120 120
121To run the suit of unit test provided along with the code run 121To run the suites of tests provided along with the code run
122``` 122```
123sbt test 123sbt test
124``` 124```
125 125
126This will run all [unit tests](https://en.wikipedia.org/wiki/Unit_testing) and [functional tests](https://en.wikipedia.org/wiki/Functional_testing).
127If you want to limit the scope of the tests and run only a particular suite use
128```
129sbt "testOnly <test-class>"
130```
131
132For example, to execute only unit tests concerning the canonical model computation, run
133```
134sbt "testOnly uk.ac.ox.cs.rsacomb.CanonicalModelSpec"
135```
136
137or alternatively
138```
139sbt "testOnly *CanonicalModelSpec"
140```
141
142To run only functional tests for LUBM, excluding tests tagged as *slow* (that require more resources), run
143```
144sbt "testOnly *functional.LUBM -- -l org.scalatest.tags.Slow"
145```
146
126## Changes introduced 147## Changes introduced
127 148
128We tried to implement the system as close as possible to the theoretical description provided in [[1](#references)]. 149We tried to implement the system as close as possible to the theoretical description provided in [[1](#references)].
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/functional/Functional.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/functional/Functional.scala
index e4ea01b..abede60 100644
--- a/src/test/scala/uk/ac/ox/cs/rsacomb/functional/Functional.scala
+++ b/src/test/scala/uk/ac/ox/cs/rsacomb/functional/Functional.scala
@@ -2,6 +2,7 @@ package uk.ac.ox.cs.rsacomb.functional
2 2
3import org.scalatest.funspec.AnyFunSpec 3import org.scalatest.funspec.AnyFunSpec
4import org.scalatest.matchers.should.Matchers 4import org.scalatest.matchers.should.Matchers
5import org.scalatest.tagobjects.Slow
5 6
6import uk.ac.ox.cs.rsacomb.ontology.Ontology 7import uk.ac.ox.cs.rsacomb.ontology.Ontology
7import uk.ac.ox.cs.rsacomb.approximation.Upperbound 8import uk.ac.ox.cs.rsacomb.approximation.Upperbound
@@ -27,12 +28,11 @@ class LUBM extends AnyFunSpec with Matchers {
27 private val rsa = ontology approximate toUpperbound 28 private val rsa = ontology approximate toUpperbound
28 29
29 /* Queries and results */ 30 /* Queries and results */
30 private val queries =
31 RDFoxUtil.loadQueriesFromFile(test / "queries.sparql")
32 private val results = ujson.read(os.read(test / "results.json")).arr 31 private val results = ujson.read(os.read(test / "results.json")).arr
33 32
34 describe("Ontology size: 1)") { 33 describe("Ontology size: 1)") {
35 34
35 val queries = RDFoxUtil.loadQueriesFromFile(test / "queries.sparql")
36 queries foreach { query => 36 queries foreach { query =>
37 it(s"Tested Query${query.id}") { 37 it(s"Tested Query${query.id}") {
38 val answers = rsa.ask(query).answers.map(_._2.mkString("\t")) 38 val answers = rsa.ask(query).answers.map(_._2.mkString("\t"))
@@ -45,5 +45,18 @@ class LUBM extends AnyFunSpec with Matchers {
45 } 45 }
46 } 46 }
47 47
48 val slow = RDFoxUtil.loadQueriesFromFile(test / "queries-slow.sparql")
49 slow foreach { query =>
50 it(s"Tested Query${query.id}", Slow) {
51 val answers = rsa.ask(query).answers.map(_._2.mkString("\t"))
52 val reference = results
53 .find(_("queryID").num == query.id)
54 .get("answers")
55 .arr
56 .map(_.str)
57 answers should contain theSameElementsAs reference
58 }
59 }
60
48 } 61 }
49} 62}