[tracker/localtime: 5/5] libtracker-data: Test local time support



commit 11198d560c240d3a2c37791ba8ef3d1412b6f19e
Author: Jürg Billeter <j bitron ch>
Date:   Thu Feb 18 16:11:08 2010 +0100

    libtracker-data: Test local time support

 configure.ac                                       |    1 +
 tests/libtracker-data/Makefile.am                  |    1 +
 tests/libtracker-data/datetime/Makefile.am         |   11 +++++++++++
 tests/libtracker-data/datetime/data-1.ontology     |   15 +++++++++++++++
 tests/libtracker-data/datetime/data-1.ttl          |   11 +++++++++++
 tests/libtracker-data/datetime/data-2.ontology     |   15 +++++++++++++++
 tests/libtracker-data/datetime/data-2.ttl          |    8 ++++++++
 .../datetime/functions-localtime-1.out             |    3 +++
 .../datetime/functions-localtime-1.rq              |    5 +++++
 .../datetime/functions-timezone-1.out              |    2 ++
 .../datetime/functions-timezone-1.rq               |    5 +++++
 tests/libtracker-data/tracker-sparql-test.c        |    2 ++
 12 files changed, 79 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c000bf1..065a37a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1660,6 +1660,7 @@ AC_CONFIG_FILES([
 	tests/libtracker-data/algebra/Makefile
 	tests/libtracker-data/bnode-coreference/Makefile
 	tests/libtracker-data/bound/Makefile
+	tests/libtracker-data/datetime/Makefile
 	tests/libtracker-data/expr-ops/Makefile
 	tests/libtracker-data/functions/Makefile
 	tests/libtracker-data/graph/Makefile
diff --git a/tests/libtracker-data/Makefile.am b/tests/libtracker-data/Makefile.am
index 591f5b4..ccd6da2 100644
--- a/tests/libtracker-data/Makefile.am
+++ b/tests/libtracker-data/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = 			\
 	algebra			\
 	bnode-coreference	\
 	bound 			\
+	datetime		\
 	expr-ops		\
 	functions		\
 	graph			\
diff --git a/tests/libtracker-data/datetime/Makefile.am b/tests/libtracker-data/datetime/Makefile.am
new file mode 100644
index 0000000..67caf5d
--- /dev/null
+++ b/tests/libtracker-data/datetime/Makefile.am
@@ -0,0 +1,11 @@
+include $(top_srcdir)/Makefile.decl
+
+EXTRA_DIST = 				\
+	data-1.ontology			\
+	data-1.ttl			\
+	data-2.ontology			\
+	data-2.ttl			\
+	functions-localtime-1.out	\
+	functions-localtime-1.rq	\
+	functions-timezone-1.out	\
+	functions-timezone-1.rq
diff --git a/tests/libtracker-data/datetime/data-1.ontology b/tests/libtracker-data/datetime/data-1.ontology
new file mode 100644
index 0000000..2938ddc
--- /dev/null
+++ b/tests/libtracker-data/datetime/data-1.ontology
@@ -0,0 +1,15 @@
+ prefix example: <http://example/> .
+ 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#> .
+
+example: a tracker:Namespace ;
+	tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+example:p a rdf:Property ;
+	rdfs:domain example:A ;
+	rdfs:range xsd:dateTime .
diff --git a/tests/libtracker-data/datetime/data-1.ttl b/tests/libtracker-data/datetime/data-1.ttl
new file mode 100644
index 0000000..dcd0eb9
--- /dev/null
+++ b/tests/libtracker-data/datetime/data-1.ttl
@@ -0,0 +1,11 @@
+ prefix : <http://example/> .
+ prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
+
+:x a :A .
+:x :p "2001-02-03T10:11:12Z" .
+
+:y a :A .
+:y :p "2004-05-06T13:14:15+0200" .
+
+:z a :A .
+:z :p "2007-08-09T16:17:18" .
diff --git a/tests/libtracker-data/datetime/data-2.ontology b/tests/libtracker-data/datetime/data-2.ontology
new file mode 100644
index 0000000..2938ddc
--- /dev/null
+++ b/tests/libtracker-data/datetime/data-2.ontology
@@ -0,0 +1,15 @@
+ prefix example: <http://example/> .
+ 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#> .
+
+example: a tracker:Namespace ;
+	tracker:prefix "example" .
+
+example:A a rdfs:Class ;
+	rdfs:subClassOf rdfs:Resource .
+
+example:p a rdf:Property ;
+	rdfs:domain example:A ;
+	rdfs:range xsd:dateTime .
diff --git a/tests/libtracker-data/datetime/data-2.ttl b/tests/libtracker-data/datetime/data-2.ttl
new file mode 100644
index 0000000..3903cc2
--- /dev/null
+++ b/tests/libtracker-data/datetime/data-2.ttl
@@ -0,0 +1,8 @@
+ prefix : <http://example/> .
+ prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
+
+:x a :A .
+:x :p "2001-02-03T10:11:12Z" .
+
+:y a :A .
+:y :p "2004-05-06T13:14:15+0200" .
diff --git a/tests/libtracker-data/datetime/functions-localtime-1.out b/tests/libtracker-data/datetime/functions-localtime-1.out
new file mode 100644
index 0000000..f808bf8
--- /dev/null
+++ b/tests/libtracker-data/datetime/functions-localtime-1.out
@@ -0,0 +1,3 @@
+"http://example/x";	"2001"	"02"	"03"	"10"	"11"	"12"
+"http://example/y";	"2004"	"05"	"06"	"13"	"14"	"15"
+"http://example/z";	"2007"	"08"	"09"	"16"	"17"	"18"
diff --git a/tests/libtracker-data/datetime/functions-localtime-1.rq b/tests/libtracker-data/datetime/functions-localtime-1.rq
new file mode 100644
index 0000000..6822e1f
--- /dev/null
+++ b/tests/libtracker-data/datetime/functions-localtime-1.rq
@@ -0,0 +1,5 @@
+SELECT ?s fn:year-from-dateTime (?v) fn:month-from-dateTime (?v) fn:day-from-dateTime (?v) fn:hours-from-dateTime (?v) fn:minutes-from-dateTime (?v) fn:seconds-from-dateTime (?v)
+WHERE {
+	?s a example:A ;
+	   example:p ?v
+}
diff --git a/tests/libtracker-data/datetime/functions-timezone-1.out b/tests/libtracker-data/datetime/functions-timezone-1.out
new file mode 100644
index 0000000..0bf73fe
--- /dev/null
+++ b/tests/libtracker-data/datetime/functions-timezone-1.out
@@ -0,0 +1,2 @@
+"http://example/x";	"0"
+"http://example/y";	"7200"
diff --git a/tests/libtracker-data/datetime/functions-timezone-1.rq b/tests/libtracker-data/datetime/functions-timezone-1.rq
new file mode 100644
index 0000000..1cdf8f3
--- /dev/null
+++ b/tests/libtracker-data/datetime/functions-timezone-1.rq
@@ -0,0 +1,5 @@
+SELECT ?s fn:timezone-from-dateTime (?v)
+WHERE {
+	?s a example:A ;
+	   example:p ?v
+}
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index d53ccc4..7d79aac 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -56,6 +56,8 @@ const TestInfo tests[] = {
 	{ "algebra/var-scope-join-1", "algebra/var-scope-join-1", FALSE },
 	{ "bnode-coreference/query", "bnode-coreference/data", FALSE },
 	{ "bound/bound1", "bound/data", FALSE },
+	{ "datetime/functions-localtime-1", "datetime/data-1", FALSE },
+	{ "datetime/functions-timezone-1", "datetime/data-2", FALSE },
 	{ "expr-ops/query-ge-1", "expr-ops/data", FALSE },
 	{ "expr-ops/query-le-1", "expr-ops/data", FALSE },
 	{ "expr-ops/query-minus-1", "expr-ops/data", FALSE },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]