[tracker] tests: Add tests to prove the last commit
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tests: Add tests to prove the last commit
- Date: Mon, 14 Mar 2016 22:27:19 +0000 (UTC)
commit 70b8260abd17d4cb3fe897acfb2c5d9f4c50d829
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Mar 13 13:22:17 2016 +0100
tests: Add tests to prove the last commit
Reverting it will make the first test fail with:
Unable to insert multiple values for subject `http://example.com/foo' and
single valued property `example:propertyA' (old_value: 'foo', new value: 'bar')
.../insert-mixed-cardinality-1.ontology | 25 ++++++++++++++++++++
.../insert-mixed-cardinality-1.rq | 5 ++++
.../insert-mixed-cardinality-query-1.out | 1 +
.../insert-mixed-cardinality-query-1.rq | 5 ++++
.../update-mixed-cardinality-1.ontology | 25 ++++++++++++++++++++
.../update-mixed-cardinality-1.rq | 10 ++++++++
.../update-mixed-cardinality-query-1.out | 1 +
.../update-mixed-cardinality-query-1.rq | 5 ++++
tests/libtracker-data/tracker-sparql-test.c | 3 ++
9 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-1.ontology
b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-1.ontology
new file mode 100644
index 0000000..4e9cdf2
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-1.ontology
@@ -0,0 +1,25 @@
+ prefix example: <http://example.com/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+
+example: a tracker:Namespace ;
+ tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:propertyA a rdf:Property ;
+ rdfs:domain example:A ;
+ nrl:maxCardinality 1 ;
+ rdfs:range xsd:string .
+
+example:B a rdfs:Class ;
+ rdfs:subClassOf example:A .
+
+example:propertyB a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:subPropertyOf example:propertyA ;
+ rdfs:range xsd:string .
diff --git a/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-1.rq
b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-1.rq
new file mode 100644
index 0000000..ae5def0
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-1.rq
@@ -0,0 +1,5 @@
+INSERT {
+ example:foo a example:B .
+ example:foo example:propertyB "foo" .
+ example:foo example:propertyB "bar" .
+}
diff --git a/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-query-1.out
b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-query-1.out
new file mode 100644
index 0000000..eb34b92
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-query-1.out
@@ -0,0 +1 @@
+"http://example.com/foo" "foo"
diff --git a/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-query-1.rq
b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-query-1.rq
new file mode 100644
index 0000000..ef3cd10
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/insert-mixed-cardinality-query-1.rq
@@ -0,0 +1,5 @@
+SELECT ?s ?o
+WHERE {
+ ?s example:propertyA ?o
+}
+
diff --git a/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-1.ontology
b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-1.ontology
new file mode 100644
index 0000000..4e9cdf2
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-1.ontology
@@ -0,0 +1,25 @@
+ prefix example: <http://example.com/> .
+ prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ prefix tracker: <http://www.tracker-project.org/ontologies/tracker#> .
+ prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+ prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
+
+example: a tracker:Namespace ;
+ tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+ rdfs:subClassOf rdfs:Resource .
+
+example:propertyA a rdf:Property ;
+ rdfs:domain example:A ;
+ nrl:maxCardinality 1 ;
+ rdfs:range xsd:string .
+
+example:B a rdfs:Class ;
+ rdfs:subClassOf example:A .
+
+example:propertyB a rdf:Property ;
+ rdfs:domain example:B ;
+ rdfs:subPropertyOf example:propertyA ;
+ rdfs:range xsd:string .
diff --git a/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-1.rq
b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-1.rq
new file mode 100644
index 0000000..c415722
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-1.rq
@@ -0,0 +1,10 @@
+INSERT {
+ example:foo a example:A .
+ example:foo example:propertyA "baz" .
+}
+
+INSERT OR REPLACE {
+ example:foo a example:B .
+ example:foo example:propertyB "foo" .
+ example:foo example:propertyB "bar" .
+}
diff --git a/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-query-1.out
b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-query-1.out
new file mode 100644
index 0000000..f54cc2a
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-query-1.out
@@ -0,0 +1 @@
+"http://example.com/foo" "bar"
diff --git a/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-query-1.rq
b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-query-1.rq
new file mode 100644
index 0000000..ef3cd10
--- /dev/null
+++ b/tests/libtracker-data/mixed-cardinality/update-mixed-cardinality-query-1.rq
@@ -0,0 +1,5 @@
+SELECT ?s ?o
+WHERE {
+ ?s example:propertyA ?o
+}
+
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 9c7035c..57b7a00 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -129,6 +129,9 @@ const TestInfo tests[] = {
{ "turtle/turtle-query-001", "turtle/turtle-data-001", FALSE },
{ "turtle/turtle-query-002", "turtle/turtle-data-002", FALSE },
+ /* Mixed cardinality tests */
+ { "mixed-cardinality/insert-mixed-cardinality-query-1",
"mixed-cardinality/insert-mixed-cardinality-1", FALSE, FALSE },
+ { "mixed-cardinality/update-mixed-cardinality-query-1",
"mixed-cardinality/update-mixed-cardinality-1", FALSE, FALSE },
{ NULL }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]