[tracker/wip/carlosg/datetime-comparisons: 59/61] tests: Add tests for xsd:dateTime comparisons in FILTER
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/datetime-comparisons: 59/61] tests: Add tests for xsd:dateTime comparisons in FILTER
- Date: Sat, 8 May 2021 10:40:37 +0000 (UTC)
commit 3d2c16c3145c6beee521a2cd67b9e4d0109366ed
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Apr 12 01:38:41 2021 +0200
tests: Add tests for xsd:dateTime comparisons in FILTER
tests/libtracker-data/datetime/filter-1.out | 1 +
tests/libtracker-data/datetime/filter-1.rq | 9 +++++++++
tests/libtracker-data/datetime/filter-2.out | 1 +
tests/libtracker-data/datetime/filter-2.rq | 8 ++++++++
tests/libtracker-data/datetime/filter-3.out | 2 ++
tests/libtracker-data/datetime/filter-3.rq | 9 +++++++++
tests/libtracker-data/datetime/filter-4.out | 1 +
tests/libtracker-data/datetime/filter-4.rq | 9 +++++++++
tests/libtracker-data/datetime/filter-5.out | 2 ++
tests/libtracker-data/datetime/filter-5.rq | 9 +++++++++
tests/libtracker-data/tracker-sparql-test.c | 5 +++++
11 files changed, 56 insertions(+)
---
diff --git a/tests/libtracker-data/datetime/filter-1.out b/tests/libtracker-data/datetime/filter-1.out
new file mode 100644
index 000000000..4f6581e08
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-1.out
@@ -0,0 +1 @@
+"2010-02-16T11:00:00Z"
diff --git a/tests/libtracker-data/datetime/filter-1.rq b/tests/libtracker-data/datetime/filter-1.rq
new file mode 100644
index 000000000..e0ab2aeb9
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-1.rq
@@ -0,0 +1,9 @@
+SELECT ?d {
+ VALUES ?d {
+ '2010-02-16T11:00:00Z'^^xsd:dateTime
+ '2011-02-16T11:00:00.123Z'^^xsd:dateTime
+ '2012-02-16T11:00:00Z'^^xsd:dateTime
+ }
+ FILTER (?d = '2010-02-16T11:00:00Z'^^xsd:dateTime)
+}
+ORDER BY ?d
diff --git a/tests/libtracker-data/datetime/filter-2.out b/tests/libtracker-data/datetime/filter-2.out
new file mode 100644
index 000000000..edb57a0aa
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-2.out
@@ -0,0 +1 @@
+"2011-02-16T11:00:00.123Z"
diff --git a/tests/libtracker-data/datetime/filter-2.rq b/tests/libtracker-data/datetime/filter-2.rq
new file mode 100644
index 000000000..bcb5ac340
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-2.rq
@@ -0,0 +1,8 @@
+SELECT ?d {
+ VALUES ?d {
+ '2010-02-16T11:00:00Z'^^xsd:dateTime
+ '2011-02-16T11:00:00.123Z'^^xsd:dateTime
+ '2012-02-16T11:00:00Z'^^xsd:dateTime
+ }
+ FILTER (?d = '2011-02-16T11:00:00.123Z'^^xsd:dateTime)
+}
diff --git a/tests/libtracker-data/datetime/filter-3.out b/tests/libtracker-data/datetime/filter-3.out
new file mode 100644
index 000000000..4907aa6a6
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-3.out
@@ -0,0 +1,2 @@
+"2012-02-16T11:00:00Z"
+"2011-02-16T11:00:00.123Z"
diff --git a/tests/libtracker-data/datetime/filter-3.rq b/tests/libtracker-data/datetime/filter-3.rq
new file mode 100644
index 000000000..38257e3c2
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-3.rq
@@ -0,0 +1,9 @@
+SELECT ?d {
+ VALUES ?d {
+ '2010-02-16T11:00:00Z'^^xsd:dateTime
+ '2011-02-16T11:00:00.123Z'^^xsd:dateTime
+ '2012-02-16T11:00:00Z'^^xsd:dateTime
+ }
+ FILTER (?d >= '2011-02-16T11:00:00.123Z'^^xsd:dateTime)
+}
+ORDER BY ?d
diff --git a/tests/libtracker-data/datetime/filter-4.out b/tests/libtracker-data/datetime/filter-4.out
new file mode 100644
index 000000000..edb57a0aa
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-4.out
@@ -0,0 +1 @@
+"2011-02-16T11:00:00.123Z"
diff --git a/tests/libtracker-data/datetime/filter-4.rq b/tests/libtracker-data/datetime/filter-4.rq
new file mode 100644
index 000000000..9e9070c19
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-4.rq
@@ -0,0 +1,9 @@
+SELECT ?d {
+ VALUES ?d {
+ '2010-02-16T11:00:00Z'^^xsd:dateTime
+ '2011-02-16T11:00:00.123Z'^^xsd:dateTime
+ '2012-02-16T11:00:00Z'^^xsd:dateTime
+ }
+ FILTER ('2011-02-16T11:00:00.123Z'^^xsd:dateTime = ?d)
+}
+ORDER BY ?d
diff --git a/tests/libtracker-data/datetime/filter-5.out b/tests/libtracker-data/datetime/filter-5.out
new file mode 100644
index 000000000..4907aa6a6
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-5.out
@@ -0,0 +1,2 @@
+"2012-02-16T11:00:00Z"
+"2011-02-16T11:00:00.123Z"
diff --git a/tests/libtracker-data/datetime/filter-5.rq b/tests/libtracker-data/datetime/filter-5.rq
new file mode 100644
index 000000000..0b2b6dc0b
--- /dev/null
+++ b/tests/libtracker-data/datetime/filter-5.rq
@@ -0,0 +1,9 @@
+SELECT ?d {
+ VALUES ?d {
+ '2010-02-16T11:00:00Z'^^xsd:dateTime
+ '2011-02-16T11:00:00.123Z'^^xsd:dateTime
+ '2012-02-16T11:00:00Z'^^xsd:dateTime
+ }
+ FILTER (?d IN ('2011-02-16T11:00:00.123Z'^^xsd:dateTime, '2012-02-16T11:00:00Z'^^xsd:dateTime,
'2013-02-16T11:00:00Z'^^xsd:dateTime))
+}
+ORDER BY ?d
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 60475720b..12ead7834 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -104,6 +104,11 @@ const TestInfo tests[] = {
{ "datetime/functions-timezone-2", "datetime/data-2", FALSE },
{ "datetime/functions-timezone-3", "datetime/data-2", FALSE },
{ "datetime/functions-tz-1", "datetime/data-2", FALSE },
+ { "datetime/filter-1", "datetime/data-1", FALSE },
+ { "datetime/filter-2", "datetime/data-1", FALSE },
+ { "datetime/filter-3", "datetime/data-1", FALSE },
+ { "datetime/filter-4", "datetime/data-1", FALSE },
+ { "datetime/filter-5", "datetime/data-1", FALSE },
{ "describe/describe-single", "describe/data", FALSE },
{ "describe/describe-non-existent", "describe/data", FALSE },
{ "describe/describe-pattern", "describe/data", FALSE },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]