[tracker/wip/carlosg/more-tests: 1/3] tests: Add more SPARQL builtin function tests




commit 7bbd710815e4158c3a0c443bcfa60cab23ffa279
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Mar 10 21:00:28 2022 +0100

    tests: Add more SPARQL builtin function tests

 .../functions/functions-builtin-abs-1.out          |  1 +
 .../functions/functions-builtin-abs-1.rq           |  1 +
 .../functions/functions-builtin-bnode-1.out        |  1 +
 .../functions/functions-builtin-bnode-1.rq         | 11 +++++++++
 .../functions/functions-builtin-bnode-2.out        |  1 +
 .../functions/functions-builtin-bnode-2.rq         | 11 +++++++++
 .../functions/functions-builtin-contains-1.out     |  1 +
 .../functions/functions-builtin-contains-1.rq      |  1 +
 .../functions/functions-builtin-day-1.out          |  5 +++++
 .../functions/functions-builtin-day-1.rq           |  9 ++++++++
 .../functions-builtin-encode-for-uri-1.out         |  1 +
 .../functions-builtin-encode-for-uri-1.rq          |  1 +
 .../functions/functions-builtin-hours-1.out        |  5 +++++
 .../functions/functions-builtin-hours-1.rq         |  9 ++++++++
 .../functions/functions-builtin-if-1.out           |  1 +
 .../functions/functions-builtin-if-1.rq            |  1 +
 .../functions/functions-builtin-minutes-1.out      |  5 +++++
 .../functions/functions-builtin-minutes-1.rq       |  9 ++++++++
 .../functions/functions-builtin-month-1.out        |  5 +++++
 .../functions/functions-builtin-month-1.rq         |  9 ++++++++
 .../functions/functions-builtin-now-1.out          |  1 +
 .../functions/functions-builtin-now-1.rq           |  1 +
 .../functions/functions-builtin-rand-1.out         |  1 +
 .../functions/functions-builtin-rand-1.rq          |  7 ++++++
 .../functions/functions-builtin-replace-1.out      |  1 +
 .../functions/functions-builtin-replace-1.rq       |  1 +
 .../functions/functions-builtin-replace-2.out      |  0
 .../functions/functions-builtin-replace-2.rq       |  2 ++
 .../functions/functions-builtin-replace-3.out      |  0
 .../functions/functions-builtin-replace-3.rq       |  2 ++
 .../functions/functions-builtin-replace-4.out      |  1 +
 .../functions/functions-builtin-replace-4.rq       |  1 +
 .../functions/functions-builtin-replace-5.out      |  0
 .../functions/functions-builtin-replace-5.rq       |  1 +
 .../functions/functions-builtin-round-1.out        |  1 +
 .../functions/functions-builtin-round-1.rq         |  1 +
 .../functions/functions-builtin-sameterm-1.out     |  1 +
 .../functions/functions-builtin-sameterm-1.rq      |  1 +
 .../functions/functions-builtin-seconds-1.out      |  5 +++++
 .../functions/functions-builtin-seconds-1.rq       |  9 ++++++++
 .../functions/functions-builtin-strdt-1.out        |  1 +
 .../functions/functions-builtin-strdt-1.rq         |  1 +
 .../functions/functions-builtin-strlen-1.out       |  1 +
 .../functions/functions-builtin-strlen-1.rq        |  1 +
 .../functions/functions-builtin-substr-1.out       |  1 +
 .../functions/functions-builtin-substr-1.rq        |  1 +
 .../functions/functions-builtin-uri-1.out          |  1 +
 .../functions/functions-builtin-uri-1.rq           |  1 +
 .../functions/functions-builtin-uuid-1.out         |  1 +
 .../functions/functions-builtin-uuid-1.rq          | 11 +++++++++
 .../functions/functions-builtin-year-1.out         |  5 +++++
 .../functions/functions-builtin-year-1.rq          |  9 ++++++++
 tests/libtracker-data/tracker-sparql-test.c        | 26 ++++++++++++++++++++++
 53 files changed, 185 insertions(+)
---
diff --git a/tests/libtracker-data/functions/functions-builtin-abs-1.out 
b/tests/libtracker-data/functions/functions-builtin-abs-1.out
new file mode 100644
index 000000000..d691312ad
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-abs-1.out
@@ -0,0 +1 @@
+"4.0"  "4.0"   "4.999999999"   "4.999999999"
diff --git a/tests/libtracker-data/functions/functions-builtin-abs-1.rq 
b/tests/libtracker-data/functions/functions-builtin-abs-1.rq
new file mode 100644
index 000000000..bebb448c2
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-abs-1.rq
@@ -0,0 +1 @@
+SELECT (ABS(4.0) AS ?a) (ABS(-4.0) AS ?b) (ABS(4.999999999) AS ?c) (ABS(4.999999999) AS ?c) { FILTER (ABS 
(-40) > ABS(2)) }
diff --git a/tests/libtracker-data/functions/functions-builtin-bnode-1.out 
b/tests/libtracker-data/functions/functions-builtin-bnode-1.out
new file mode 100644
index 000000000..826861551
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-bnode-1.out
@@ -0,0 +1 @@
+"true"
diff --git a/tests/libtracker-data/functions/functions-builtin-bnode-1.rq 
b/tests/libtracker-data/functions/functions-builtin-bnode-1.rq
new file mode 100644
index 000000000..13cc98366
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-bnode-1.rq
@@ -0,0 +1,11 @@
+ASK
+{
+  BIND (BNODE () AS ?a) .
+  BIND (BNODE () AS ?b) .
+  # Check prefix
+  FILTER (SUBSTR(STR(?a), 0, 11) = 'urn:bnode:') .
+  FILTER (SUBSTR(STR(?a), 0, 11) = SUBSTR(STR(?b), 0, 11)) .
+  # Check UUIDv4 version char, this is always 4
+  FILTER (SUBSTR(STR(?a), 25, 1) = '4') .
+  FILTER (SUBSTR(STR(?a), 25, 1) = SUBSTR(STR(?b), 25, 1)) .
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-bnode-2.out 
b/tests/libtracker-data/functions/functions-builtin-bnode-2.out
new file mode 100644
index 000000000..826861551
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-bnode-2.out
@@ -0,0 +1 @@
+"true"
diff --git a/tests/libtracker-data/functions/functions-builtin-bnode-2.rq 
b/tests/libtracker-data/functions/functions-builtin-bnode-2.rq
new file mode 100644
index 000000000..81afe0a00
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-bnode-2.rq
@@ -0,0 +1,11 @@
+ASK
+{
+  BIND (BNODE ("a") AS ?a) .
+  BIND (BNODE ("b") AS ?b) .
+  # Check prefix
+  FILTER (SUBSTR(STR(?a), 0, 11) = 'urn:bnode:') .
+  FILTER (SUBSTR(STR(?a), 0, 11) = SUBSTR(STR(?b), 0, 11)) .
+  # Check UUIDv4 version char, this is always 4
+  FILTER (SUBSTR(STR(?a), 25, 1) = '4') .
+  FILTER (SUBSTR(STR(?a), 25, 1) = SUBSTR(STR(?b), 25, 1)) .
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-contains-1.out 
b/tests/libtracker-data/functions/functions-builtin-contains-1.out
new file mode 100644
index 000000000..6cd3c6c29
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-contains-1.out
@@ -0,0 +1 @@
+"true" "false" "false"
diff --git a/tests/libtracker-data/functions/functions-builtin-contains-1.rq 
b/tests/libtracker-data/functions/functions-builtin-contains-1.rq
new file mode 100644
index 000000000..e88afc65c
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-contains-1.rq
@@ -0,0 +1 @@
+SELECT (CONTAINS('abcd', 'b') AS ?a) (CONTAINS('abcd', 'z') AS ?b) (CONTAINS('\u2323', '\u0023') AS ?a) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-day-1.out 
b/tests/libtracker-data/functions/functions-builtin-day-1.out
new file mode 100644
index 000000000..4f3685941
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-day-1.out
@@ -0,0 +1,5 @@
+"10"
+"01"
+"31"
+"02"
+"31"
diff --git a/tests/libtracker-data/functions/functions-builtin-day-1.rq 
b/tests/libtracker-data/functions/functions-builtin-day-1.rq
new file mode 100644
index 000000000..57647f94a
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-day-1.rq
@@ -0,0 +1,9 @@
+SELECT DAY(?d) {
+  VALUES ?d {
+    '2022-03-10T12:23:34Z'^^xsd:dateTime
+    '2022-01-01T01:00:00-0600'^^xsd:dateTime
+    '2022-12-31T23:00:00+0600'^^xsd:dateTime
+    '0001-01-02'^^xsd:date
+    '9998-12-31'^^xsd:date
+  }
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-encode-for-uri-1.out 
b/tests/libtracker-data/functions/functions-builtin-encode-for-uri-1.out
new file mode 100644
index 000000000..a6143bb05
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-encode-for-uri-1.out
@@ -0,0 +1 @@
+"a%2Fb%23c%F0%9F%98%83"        "abc123"
diff --git a/tests/libtracker-data/functions/functions-builtin-encode-for-uri-1.rq 
b/tests/libtracker-data/functions/functions-builtin-encode-for-uri-1.rq
new file mode 100644
index 000000000..ff74b4a57
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-encode-for-uri-1.rq
@@ -0,0 +1 @@
+SELECT ENCODE_FOR_URI('a/b#c😃') ENCODE_FOR_URI('abc123') {}
diff --git a/tests/libtracker-data/functions/functions-builtin-hours-1.out 
b/tests/libtracker-data/functions/functions-builtin-hours-1.out
new file mode 100644
index 000000000..a05ff54dd
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-hours-1.out
@@ -0,0 +1,5 @@
+"12"
+"1"
+"23"
+"0"
+"0"
diff --git a/tests/libtracker-data/functions/functions-builtin-hours-1.rq 
b/tests/libtracker-data/functions/functions-builtin-hours-1.rq
new file mode 100644
index 000000000..5e706d146
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-hours-1.rq
@@ -0,0 +1,9 @@
+SELECT HOURS(?d) {
+  VALUES ?d {
+    '2022-03-10T12:23:34Z'^^xsd:dateTime
+    '2022-01-01T01:00:00-0600'^^xsd:dateTime
+    '2022-12-31T23:00:00+0600'^^xsd:dateTime
+    '0001-01-02'^^xsd:date
+    '9998-12-31'^^xsd:date
+  }
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-if-1.out 
b/tests/libtracker-data/functions/functions-builtin-if-1.out
new file mode 100644
index 000000000..17809c402
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-if-1.out
@@ -0,0 +1 @@
+"istrue"       "isfalse"
diff --git a/tests/libtracker-data/functions/functions-builtin-if-1.rq 
b/tests/libtracker-data/functions/functions-builtin-if-1.rq
new file mode 100644
index 000000000..fc87e24a7
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-if-1.rq
@@ -0,0 +1 @@
+SELECT (IF (true, 'istrue', 'isfalse') AS ?b) (IF (false, 'istrue', 'isfalse') AS ?b) {}
\ No newline at end of file
diff --git a/tests/libtracker-data/functions/functions-builtin-minutes-1.out 
b/tests/libtracker-data/functions/functions-builtin-minutes-1.out
new file mode 100644
index 000000000..a7e4a23f4
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-minutes-1.out
@@ -0,0 +1,5 @@
+"23"
+"0"
+"0"
+"0"
+"0"
diff --git a/tests/libtracker-data/functions/functions-builtin-minutes-1.rq 
b/tests/libtracker-data/functions/functions-builtin-minutes-1.rq
new file mode 100644
index 000000000..32a0c306b
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-minutes-1.rq
@@ -0,0 +1,9 @@
+SELECT MINUTES(?d) {
+  VALUES ?d {
+    '2022-03-10T12:23:34Z'^^xsd:dateTime
+    '2022-01-01T01:00:00-0600'^^xsd:dateTime
+    '2022-12-31T23:00:00+0600'^^xsd:dateTime
+    '0001-01-02'^^xsd:date
+    '9998-12-31'^^xsd:date
+  }
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-month-1.out 
b/tests/libtracker-data/functions/functions-builtin-month-1.out
new file mode 100644
index 000000000..a9942add6
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-month-1.out
@@ -0,0 +1,5 @@
+"03"
+"01"
+"12"
+"01"
+"12"
diff --git a/tests/libtracker-data/functions/functions-builtin-month-1.rq 
b/tests/libtracker-data/functions/functions-builtin-month-1.rq
new file mode 100644
index 000000000..70b8aef63
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-month-1.rq
@@ -0,0 +1,9 @@
+SELECT MONTH(?d) {
+  VALUES ?d {
+    '2022-03-10T12:23:34Z'^^xsd:dateTime
+    '2022-01-01T01:00:00-0600'^^xsd:dateTime
+    '2022-12-31T23:00:00+0600'^^xsd:dateTime
+    '0001-01-02'^^xsd:date
+    '9998-12-31'^^xsd:date
+  }
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-now-1.out 
b/tests/libtracker-data/functions/functions-builtin-now-1.out
new file mode 100644
index 000000000..3bf44eff7
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-now-1.out
@@ -0,0 +1 @@
+"yay"
diff --git a/tests/libtracker-data/functions/functions-builtin-now-1.rq 
b/tests/libtracker-data/functions/functions-builtin-now-1.rq
new file mode 100644
index 000000000..7a7865210
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-now-1.rq
@@ -0,0 +1 @@
+SELECT IF(YEAR(NOW()) >= 2022, "yay", "fix your clock") {}
diff --git a/tests/libtracker-data/functions/functions-builtin-rand-1.out 
b/tests/libtracker-data/functions/functions-builtin-rand-1.out
new file mode 100644
index 000000000..826861551
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-rand-1.out
@@ -0,0 +1 @@
+"true"
diff --git a/tests/libtracker-data/functions/functions-builtin-rand-1.rq 
b/tests/libtracker-data/functions/functions-builtin-rand-1.rq
new file mode 100644
index 000000000..f4b92dd86
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-rand-1.rq
@@ -0,0 +1,7 @@
+ASK {
+  BIND (RAND() AS ?r) .
+  # Not much we can check around a random
+  # number, so check it stays within the
+  # expected limits.
+  FILTER (?r >= 0 && ?r <= 1) .
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-1.out 
b/tests/libtracker-data/functions/functions-builtin-replace-1.out
new file mode 100644
index 000000000..6b948ef08
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-replace-1.out
@@ -0,0 +1 @@
+"adc"  "abc"   "z"     "zbc"
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-1.rq 
b/tests/libtracker-data/functions/functions-builtin-replace-1.rq
new file mode 100644
index 000000000..b0d4932d7
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-replace-1.rq
@@ -0,0 +1 @@
+SELECT (REPLACE('abc', 'b', 'd') AS ?a) (REPLACE('abc', 'd', 'z') AS ?b) (REPLACE('abc', 'abc' , 'z') AS ?c) 
(REPLACE ('abc', 'a', 'z') AS ?d) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-2.out 
b/tests/libtracker-data/functions/functions-builtin-replace-2.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-2.rq 
b/tests/libtracker-data/functions/functions-builtin-replace-2.rq
new file mode 100644
index 000000000..5e1758804
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-replace-2.rq
@@ -0,0 +1,2 @@
+# Expected to fail, empty regular expression
+SELECT (REPLACE('abc', '', 'd') AS ?a) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-3.out 
b/tests/libtracker-data/functions/functions-builtin-replace-3.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-3.rq 
b/tests/libtracker-data/functions/functions-builtin-replace-3.rq
new file mode 100644
index 000000000..1664b44f7
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-replace-3.rq
@@ -0,0 +1,2 @@
+# Expected to fail, regular expression matches empty string
+SELECT (REPLACE('abc', '.*', 'd') AS ?a) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-4.out 
b/tests/libtracker-data/functions/functions-builtin-replace-4.out
new file mode 100644
index 000000000..6b948ef08
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-replace-4.out
@@ -0,0 +1 @@
+"adc"  "abc"   "z"     "zbc"
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-4.rq 
b/tests/libtracker-data/functions/functions-builtin-replace-4.rq
new file mode 100644
index 000000000..064366947
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-replace-4.rq
@@ -0,0 +1 @@
+SELECT (REPLACE('abc', 'B', 'd', 'i') AS ?a) (REPLACE('abc', 'D', 'z', 'i') AS ?b) (REPLACE('abc', 'ABC' , 
'z', 'i') AS ?c) (REPLACE ('abc', 'A', 'z', 'smix') AS ?d) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-5.out 
b/tests/libtracker-data/functions/functions-builtin-replace-5.out
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/libtracker-data/functions/functions-builtin-replace-5.rq 
b/tests/libtracker-data/functions/functions-builtin-replace-5.rq
new file mode 100644
index 000000000..112eaf47c
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-replace-5.rq
@@ -0,0 +1 @@
+SELECT (REPLACE ('abc', 'A', 'z', 'this is not a regex flag') AS ?d) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-round-1.out 
b/tests/libtracker-data/functions/functions-builtin-round-1.out
new file mode 100644
index 000000000..a8bb9c200
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-round-1.out
@@ -0,0 +1 @@
+"4.0"  "5.0"   "5.0"   "5.0"
diff --git a/tests/libtracker-data/functions/functions-builtin-round-1.rq 
b/tests/libtracker-data/functions/functions-builtin-round-1.rq
new file mode 100644
index 000000000..bad8e5fa8
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-round-1.rq
@@ -0,0 +1 @@
+SELECT (ROUND(4.0) AS ?a) (ROUND(4.5) AS ?b) (ROUND(4.999999999) AS ?c) (ROUND(5.000000001) AS ?d) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-sameterm-1.out 
b/tests/libtracker-data/functions/functions-builtin-sameterm-1.out
new file mode 100644
index 000000000..0e3924af7
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-sameterm-1.out
@@ -0,0 +1 @@
+"false"        "true"  "true"
diff --git a/tests/libtracker-data/functions/functions-builtin-sameterm-1.rq 
b/tests/libtracker-data/functions/functions-builtin-sameterm-1.rq
new file mode 100644
index 000000000..ba32bef8a
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-sameterm-1.rq
@@ -0,0 +1 @@
+SELECT (SAMETERM (xsd:integer, xsd:boolean) AS ?a) (SAMETERM (xsd:boolean, xsd:boolean) AS ?b) (SAMETERM 
(<http://www.w3.org/2001/XMLSchema#boolean>, xsd:boolean) AS ?b) {}
\ No newline at end of file
diff --git a/tests/libtracker-data/functions/functions-builtin-seconds-1.out 
b/tests/libtracker-data/functions/functions-builtin-seconds-1.out
new file mode 100644
index 000000000..3f5f63f4d
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-seconds-1.out
@@ -0,0 +1,5 @@
+"34"
+"0"
+"0"
+"0"
+"0"
diff --git a/tests/libtracker-data/functions/functions-builtin-seconds-1.rq 
b/tests/libtracker-data/functions/functions-builtin-seconds-1.rq
new file mode 100644
index 000000000..53a714ef0
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-seconds-1.rq
@@ -0,0 +1,9 @@
+SELECT SECONDS(?d) {
+  VALUES ?d {
+    '2022-03-10T12:23:34Z'^^xsd:dateTime
+    '2022-01-01T01:00:00-0600'^^xsd:dateTime
+    '2022-12-31T23:00:00+0600'^^xsd:dateTime
+    '0001-01-02'^^xsd:date
+    '9998-12-31'^^xsd:date
+  }
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-strdt-1.out 
b/tests/libtracker-data/functions/functions-builtin-strdt-1.out
new file mode 100644
index 000000000..3dbc1dd05
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strdt-1.out
@@ -0,0 +1 @@
+"2"    "2.2"   "true"  "false" "333"   "2022-03-10"
diff --git a/tests/libtracker-data/functions/functions-builtin-strdt-1.rq 
b/tests/libtracker-data/functions/functions-builtin-strdt-1.rq
new file mode 100644
index 000000000..f57899b49
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strdt-1.rq
@@ -0,0 +1 @@
+select strdt("2.2", xsd:integer) strdt("2.2", xsd:double) strdt(1, xsd:boolean) strdt(0, xsd:boolean) 
strdt(333, xsd:string) strdt("2022-03-10T01:01:01Z", xsd:date) {}
\ No newline at end of file
diff --git a/tests/libtracker-data/functions/functions-builtin-strlen-1.out 
b/tests/libtracker-data/functions/functions-builtin-strlen-1.out
new file mode 100644
index 000000000..6ebd24b35
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strlen-1.out
@@ -0,0 +1 @@
+"3"    "0"
diff --git a/tests/libtracker-data/functions/functions-builtin-strlen-1.rq 
b/tests/libtracker-data/functions/functions-builtin-strlen-1.rq
new file mode 100644
index 000000000..24bd0f69d
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strlen-1.rq
@@ -0,0 +1 @@
+SELECT (STRLEN ('abc') AS ?a) (STRLEN ('') AS ?b) {}
\ No newline at end of file
diff --git a/tests/libtracker-data/functions/functions-builtin-substr-1.out 
b/tests/libtracker-data/functions/functions-builtin-substr-1.out
new file mode 100644
index 000000000..61138dedb
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-substr-1.out
@@ -0,0 +1 @@
+"bc"   "b"     ""      ""
diff --git a/tests/libtracker-data/functions/functions-builtin-substr-1.rq 
b/tests/libtracker-data/functions/functions-builtin-substr-1.rq
new file mode 100644
index 000000000..ebc0dd407
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-substr-1.rq
@@ -0,0 +1 @@
+SELECT SUBSTR('abc', 2) SUBSTR('abc', 2, 1) SUBSTR('abc', 2, 0) SUBSTR ('abc', 4, 1) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-uri-1.out 
b/tests/libtracker-data/functions/functions-builtin-uri-1.out
new file mode 100644
index 000000000..cfbe41932
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-uri-1.out
@@ -0,0 +1 @@
+"http://www.w3.org/2001/XMLSchema#integer";     "http://www.w3.org/2001/XMLSchema%23integer";    
"http://www.w3.org/2001/XMLSchema%23integer";
diff --git a/tests/libtracker-data/functions/functions-builtin-uri-1.rq 
b/tests/libtracker-data/functions/functions-builtin-uri-1.rq
new file mode 100644
index 000000000..1e6474fb8
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-uri-1.rq
@@ -0,0 +1 @@
+select xsd:integer uri(xsd:integer) iri(xsd:integer) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-uuid-1.out 
b/tests/libtracker-data/functions/functions-builtin-uuid-1.out
new file mode 100644
index 000000000..826861551
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-uuid-1.out
@@ -0,0 +1 @@
+"true"
diff --git a/tests/libtracker-data/functions/functions-builtin-uuid-1.rq 
b/tests/libtracker-data/functions/functions-builtin-uuid-1.rq
new file mode 100644
index 000000000..9e6bdac05
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-uuid-1.rq
@@ -0,0 +1,11 @@
+ASK
+{
+  BIND (UUID () AS ?a) .
+  BIND (UUID () AS ?b) .
+  # Check prefix
+  FILTER (SUBSTR(STR(?a), 0, 10) = 'urn:uuid:') .
+  FILTER (SUBSTR(STR(?a), 0, 10) = SUBSTR(STR(?b), 0, 10)) .
+  # Check UUIDv4 version char, this is always 4
+  FILTER (SUBSTR(STR(?a), 24, 1) = '4') .
+  FILTER (SUBSTR(STR(?a), 24, 1) = SUBSTR(STR(?b), 24, 1)) .
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-year-1.out 
b/tests/libtracker-data/functions/functions-builtin-year-1.out
new file mode 100644
index 000000000..44a853e3c
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-year-1.out
@@ -0,0 +1,5 @@
+"2022"
+"2022"
+"2022"
+"0001"
+"9998"
diff --git a/tests/libtracker-data/functions/functions-builtin-year-1.rq 
b/tests/libtracker-data/functions/functions-builtin-year-1.rq
new file mode 100644
index 000000000..a4092ad88
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-year-1.rq
@@ -0,0 +1,9 @@
+SELECT YEAR(?d) {
+  VALUES ?d {
+    '2022-03-10T12:23:34Z'^^xsd:dateTime
+    '2022-01-01T01:00:00-0600'^^xsd:dateTime
+    '2022-12-31T23:00:00+0600'^^xsd:dateTime
+    '0001-01-02'^^xsd:date
+    '9998-12-31'^^xsd:date
+  }
+}
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 2975bb066..0e0339dd8 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -153,13 +153,39 @@ const TestInfo tests[] = {
        { "functions/functions-datatypes-2", "functions/data-2", FALSE },
        { "functions/functions-datatypes-3", "functions/data-3", FALSE },
        { "functions/functions-datatypes-4", "functions/data-4", FALSE },
+       { "functions/functions-builtin-bnode-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-bnode-2", "functions/data-1", FALSE },
+       { "functions/functions-builtin-uuid-1", "functions/data-1", FALSE },
        { "functions/functions-builtin-hash-1", "functions/data-1", FALSE },
        { "functions/functions-builtin-ucase-1", "functions/data-1", FALSE },
        { "functions/functions-builtin-lcase-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-strlen-1", "functions/data-1", FALSE },
        { "functions/functions-builtin-strbefore-1", "functions/data-1", FALSE },
        { "functions/functions-builtin-strafter-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-substr-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-replace-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-replace-2", "functions/data-1", TRUE },
+       { "functions/functions-builtin-replace-3", "functions/data-1", TRUE },
+       { "functions/functions-builtin-replace-4", "functions/data-1", FALSE },
+       { "functions/functions-builtin-replace-5", "functions/data-1", TRUE },
+       { "functions/functions-builtin-contains-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-abs-1", "functions/data-1", FALSE },
        { "functions/functions-builtin-ceil-1", "functions/data-1", FALSE },
        { "functions/functions-builtin-floor-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-round-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-uri-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-year-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-month-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-day-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-hours-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-minutes-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-seconds-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-now-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-encode-for-uri-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-strdt-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-sameterm-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-if-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-rand-1", "functions/data-1", FALSE },
        /* Graph semantics and operations */
        { "graph/graph-1", "graph/data-1", FALSE },
        { "graph/graph-2", "graph/data-2", FALSE },


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