[tracker/wip/carlosg/portal: 11/16] tests: Add tests for CONSTRAINT declarations in prologue
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/portal: 11/16] tests: Add tests for CONSTRAINT declarations in prologue
- Date: Sun, 5 Jul 2020 17:31:04 +0000 (UTC)
commit 8d305360036cc24ca35e34e0af1fa8ba73b92f2a
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 24 18:39:57 2020 +0100
tests: Add tests for CONSTRAINT declarations in prologue
This is the heart of data isolation, so it makes sense to have
well tested.
tests/libtracker-data/constraint/coexisting-1.out | 4 ++++
tests/libtracker-data/constraint/coexisting-1.rq | 3 +++
tests/libtracker-data/constraint/coexisting-2.out | 2 ++
tests/libtracker-data/constraint/coexisting-2.rq | 3 +++
tests/libtracker-data/constraint/coexisting-3.out | 4 ++++
tests/libtracker-data/constraint/coexisting-3.rq | 3 +++
tests/libtracker-data/constraint/coexisting-4.out | 2 ++
tests/libtracker-data/constraint/coexisting-4.rq | 3 +++
tests/libtracker-data/constraint/data.rq | 17 +++++++++++++++++
tests/libtracker-data/constraint/empty-graph-1.out | 0
tests/libtracker-data/constraint/empty-graph-1.rq | 2 ++
tests/libtracker-data/constraint/empty-graph-2.out | 0
tests/libtracker-data/constraint/empty-graph-2.rq | 2 ++
tests/libtracker-data/constraint/empty-graph-3.out | 0
tests/libtracker-data/constraint/empty-graph-3.rq | 2 ++
tests/libtracker-data/constraint/empty-graph-4.out | 0
tests/libtracker-data/constraint/empty-graph-4.rq | 2 ++
tests/libtracker-data/constraint/nested-1.out | 0
tests/libtracker-data/constraint/nested-1.rq | 3 +++
tests/libtracker-data/constraint/nested-2.out | 0
tests/libtracker-data/constraint/nested-2.rq | 3 +++
tests/libtracker-data/constraint/nested-3.out | 1 +
tests/libtracker-data/constraint/nested-3.rq | 3 +++
tests/libtracker-data/constraint/nested-4.out | 0
tests/libtracker-data/constraint/nested-4.rq | 3 +++
tests/libtracker-data/constraint/nested-5.out | 0
tests/libtracker-data/constraint/nested-5.rq | 3 +++
tests/libtracker-data/constraint/nested-6.out | 1 +
tests/libtracker-data/constraint/nested-6.rq | 3 +++
tests/libtracker-data/constraint/test.ontology | 15 +++++++++++++++
tests/libtracker-data/tracker-sparql-test.c | 15 +++++++++++++++
31 files changed, 99 insertions(+)
---
diff --git a/tests/libtracker-data/constraint/coexisting-1.out
b/tests/libtracker-data/constraint/coexisting-1.out
new file mode 100644
index 000000000..8be680548
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-1.out
@@ -0,0 +1,4 @@
+"a"
+"b"
+"c"
+"d"
diff --git a/tests/libtracker-data/constraint/coexisting-1.rq
b/tests/libtracker-data/constraint/coexisting-1.rq
new file mode 100644
index 000000000..3fc6ee60a
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-1.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH ALL,<A>
+SELECT ?u { ?u a example:A }
+ORDER BY ?u
diff --git a/tests/libtracker-data/constraint/coexisting-2.out
b/tests/libtracker-data/constraint/coexisting-2.out
new file mode 100644
index 000000000..22d3c21b7
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-2.out
@@ -0,0 +1,2 @@
+"a"
+"d"
diff --git a/tests/libtracker-data/constraint/coexisting-2.rq
b/tests/libtracker-data/constraint/coexisting-2.rq
new file mode 100644
index 000000000..439678b18
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-2.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH DEFAULT,<A>
+SELECT ?u { ?u a example:A }
+ORDER BY ?u
diff --git a/tests/libtracker-data/constraint/coexisting-3.out
b/tests/libtracker-data/constraint/coexisting-3.out
new file mode 100644
index 000000000..8be680548
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-3.out
@@ -0,0 +1,4 @@
+"a"
+"b"
+"c"
+"d"
diff --git a/tests/libtracker-data/constraint/coexisting-3.rq
b/tests/libtracker-data/constraint/coexisting-3.rq
new file mode 100644
index 000000000..1d3f3299c
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-3.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH ALL,DEFAULT
+SELECT ?u { ?u a example:A }
+ORDER BY ?u
diff --git a/tests/libtracker-data/constraint/coexisting-4.out
b/tests/libtracker-data/constraint/coexisting-4.out
new file mode 100644
index 000000000..071144f21
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-4.out
@@ -0,0 +1,2 @@
+"a"
+"b"
diff --git a/tests/libtracker-data/constraint/coexisting-4.rq
b/tests/libtracker-data/constraint/coexisting-4.rq
new file mode 100644
index 000000000..7dec44fba
--- /dev/null
+++ b/tests/libtracker-data/constraint/coexisting-4.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH <A>,<B>
+SELECT ?u { ?u a example:A }
+ORDER BY ?u
diff --git a/tests/libtracker-data/constraint/data.rq b/tests/libtracker-data/constraint/data.rq
new file mode 100644
index 000000000..ef6ac9e25
--- /dev/null
+++ b/tests/libtracker-data/constraint/data.rq
@@ -0,0 +1,17 @@
+INSERT {
+ GRAPH <A> {
+ <a> a example:A ;
+ example:p 42
+ }
+ GRAPH <B> {
+ <b> a example:A ;
+ example:p 21
+ }
+ GRAPH <C> {
+ <c> a example:A ;
+ example:p 7
+ }
+
+ <d> a example:A ;
+ example:p 3;
+}
diff --git a/tests/libtracker-data/constraint/empty-graph-1.out
b/tests/libtracker-data/constraint/empty-graph-1.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/empty-graph-1.rq
b/tests/libtracker-data/constraint/empty-graph-1.rq
new file mode 100644
index 000000000..5587d24ee
--- /dev/null
+++ b/tests/libtracker-data/constraint/empty-graph-1.rq
@@ -0,0 +1,2 @@
+CONSTRAINT GRAPH
+SELECT ?u { ?u a example:A }
diff --git a/tests/libtracker-data/constraint/empty-graph-2.out
b/tests/libtracker-data/constraint/empty-graph-2.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/empty-graph-2.rq
b/tests/libtracker-data/constraint/empty-graph-2.rq
new file mode 100644
index 000000000..1d9ad6932
--- /dev/null
+++ b/tests/libtracker-data/constraint/empty-graph-2.rq
@@ -0,0 +1,2 @@
+CONSTRAINT GRAPH
+SELECT ?u ?p ?o { ?u ?p ?o }
diff --git a/tests/libtracker-data/constraint/empty-graph-3.out
b/tests/libtracker-data/constraint/empty-graph-3.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/empty-graph-3.rq
b/tests/libtracker-data/constraint/empty-graph-3.rq
new file mode 100644
index 000000000..5e981922c
--- /dev/null
+++ b/tests/libtracker-data/constraint/empty-graph-3.rq
@@ -0,0 +1,2 @@
+CONSTRAINT GRAPH
+SELECT ?u { GRAPH <A> { ?u example:p 42 } }
diff --git a/tests/libtracker-data/constraint/empty-graph-4.out
b/tests/libtracker-data/constraint/empty-graph-4.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/empty-graph-4.rq
b/tests/libtracker-data/constraint/empty-graph-4.rq
new file mode 100644
index 000000000..2994635aa
--- /dev/null
+++ b/tests/libtracker-data/constraint/empty-graph-4.rq
@@ -0,0 +1,2 @@
+CONSTRAINT GRAPH
+SELECT ?g ?u { GRAPH ?g { ?u a example:A } }
diff --git a/tests/libtracker-data/constraint/nested-1.out b/tests/libtracker-data/constraint/nested-1.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/nested-1.rq b/tests/libtracker-data/constraint/nested-1.rq
new file mode 100644
index 000000000..db172998d
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-1.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH
+CONSTRAINT GRAPH <A>
+SELECT ?u { ?u a example:A }
diff --git a/tests/libtracker-data/constraint/nested-2.out b/tests/libtracker-data/constraint/nested-2.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/nested-2.rq b/tests/libtracker-data/constraint/nested-2.rq
new file mode 100644
index 000000000..dafb152b9
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-2.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH <A>
+CONSTRAINT GRAPH <B>
+SELECT ?u { ?u a example:A }
diff --git a/tests/libtracker-data/constraint/nested-3.out b/tests/libtracker-data/constraint/nested-3.out
new file mode 100644
index 000000000..19010cc35
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-3.out
@@ -0,0 +1 @@
+"b"
diff --git a/tests/libtracker-data/constraint/nested-3.rq b/tests/libtracker-data/constraint/nested-3.rq
new file mode 100644
index 000000000..a46945d5d
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-3.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH <A>, <B>
+CONSTRAINT GRAPH <B>
+SELECT ?u { ?u a example:A }
diff --git a/tests/libtracker-data/constraint/nested-4.out b/tests/libtracker-data/constraint/nested-4.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/nested-4.rq b/tests/libtracker-data/constraint/nested-4.rq
new file mode 100644
index 000000000..f43a8a094
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-4.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH ALL
+CONSTRAINT GRAPH
+SELECT ?u { ?u a example:A }
diff --git a/tests/libtracker-data/constraint/nested-5.out b/tests/libtracker-data/constraint/nested-5.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/constraint/nested-5.rq b/tests/libtracker-data/constraint/nested-5.rq
new file mode 100644
index 000000000..3b2cd4b50
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-5.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH
+CONSTRAINT GRAPH ALL
+SELECT ?u { ?u a example:A }
diff --git a/tests/libtracker-data/constraint/nested-6.out b/tests/libtracker-data/constraint/nested-6.out
new file mode 100644
index 000000000..5775b9f8c
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-6.out
@@ -0,0 +1 @@
+"d"
diff --git a/tests/libtracker-data/constraint/nested-6.rq b/tests/libtracker-data/constraint/nested-6.rq
new file mode 100644
index 000000000..0f5c67fee
--- /dev/null
+++ b/tests/libtracker-data/constraint/nested-6.rq
@@ -0,0 +1,3 @@
+CONSTRAINT GRAPH ALL
+CONSTRAINT GRAPH DEFAULT
+SELECT ?u { ?u a example:A }
diff --git a/tests/libtracker-data/constraint/test.ontology b/tests/libtracker-data/constraint/test.ontology
new file mode 100644
index 000000000..6f88d2eee
--- /dev/null
+++ b/tests/libtracker-data/constraint/test.ontology
@@ -0,0 +1,15 @@
+@prefix example: <http://example/> .
+@prefix nrl: <http://tracker.api.gnome.org/ontology/v3/nrl#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+example: a nrl:Namespace ;
+ nrl:prefix "example" .
+
+example:A a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:p a rdf:Property ;
+ rdfs:domain example:A ;
+ rdfs:range xsd:integer .
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 53d4cf2b1..dbda8a03b 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -262,6 +262,21 @@ const TestInfo tests[] = {
{ "update/delete-insert-where-query-5", "update/delete-insert-where-5", FALSE, FALSE },
{ "update/delete-insert-where-query-6", "update/delete-insert-where-6", FALSE, FALSE },
{ "update/select-date-with-offset-1", "update/insert-date-with-offset-1", FALSE, FALSE },
+ /* Constraint declarations */
+ { "constraint/empty-graph-1", "constraint/data", FALSE, FALSE },
+ { "constraint/empty-graph-2", "constraint/data", FALSE, FALSE },
+ { "constraint/empty-graph-3", "constraint/data", FALSE, FALSE },
+ { "constraint/empty-graph-4", "constraint/data", FALSE, FALSE },
+ { "constraint/nested-1", "constraint/data", FALSE, FALSE },
+ { "constraint/nested-2", "constraint/data", FALSE, FALSE },
+ { "constraint/nested-3", "constraint/data", FALSE, FALSE },
+ { "constraint/nested-4", "constraint/data", FALSE, FALSE },
+ { "constraint/nested-5", "constraint/data", FALSE, FALSE },
+ { "constraint/nested-6", "constraint/data", FALSE, FALSE },
+ { "constraint/coexisting-1", "constraint/data", FALSE, FALSE },
+ { "constraint/coexisting-2", "constraint/data", FALSE, FALSE },
+ { "constraint/coexisting-3", "constraint/data", FALSE, FALSE },
+ { "constraint/coexisting-4", "constraint/data", FALSE, FALSE },
{ NULL }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]