[tracker/wip/carlosg/more-tests: 12/12] tests: Add tests for some builtin SPARQL functions




commit 32b9975a64ba6d9b1bd10974411f92b00bb68e80
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Sep 29 15:47:13 2020 +0200

    tests: Add tests for some builtin SPARQL functions

 tests/libtracker-data/functions/functions-builtin-ceil-1.out     | 1 +
 tests/libtracker-data/functions/functions-builtin-ceil-1.rq      | 1 +
 tests/libtracker-data/functions/functions-builtin-floor-1.out    | 1 +
 tests/libtracker-data/functions/functions-builtin-floor-1.rq     | 1 +
 tests/libtracker-data/functions/functions-builtin-hash-1.out     | 1 +
 tests/libtracker-data/functions/functions-builtin-hash-1.rq      | 8 ++++++++
 tests/libtracker-data/functions/functions-builtin-lcase-1.out    | 1 +
 tests/libtracker-data/functions/functions-builtin-lcase-1.rq     | 1 +
 tests/libtracker-data/functions/functions-builtin-strafter-1.out | 1 +
 tests/libtracker-data/functions/functions-builtin-strafter-1.rq  | 1 +
 .../libtracker-data/functions/functions-builtin-strbefore-1.out  | 1 +
 tests/libtracker-data/functions/functions-builtin-strbefore-1.rq | 1 +
 tests/libtracker-data/functions/functions-builtin-ucase-1.out    | 1 +
 tests/libtracker-data/functions/functions-builtin-ucase-1.rq     | 1 +
 tests/libtracker-data/tracker-sparql-test.c                      | 9 ++++++++-
 15 files changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/tests/libtracker-data/functions/functions-builtin-ceil-1.out 
b/tests/libtracker-data/functions/functions-builtin-ceil-1.out
new file mode 100644
index 000000000..d4caba38f
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-ceil-1.out
@@ -0,0 +1 @@
+"4.0"  "5.0"   "5.0"   "6.0"
diff --git a/tests/libtracker-data/functions/functions-builtin-ceil-1.rq 
b/tests/libtracker-data/functions/functions-builtin-ceil-1.rq
new file mode 100644
index 000000000..857cf68ee
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-ceil-1.rq
@@ -0,0 +1 @@
+SELECT (CEIL(4.0) AS ?a) (CEIL(4.5) AS ?b) (CEIL(4.999999999) AS ?c) (CEIL(5.000000001) AS ?d) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-floor-1.out 
b/tests/libtracker-data/functions/functions-builtin-floor-1.out
new file mode 100644
index 000000000..471e90cf9
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-floor-1.out
@@ -0,0 +1 @@
+"4.0"  "4.0"   "4.0"   "5.0"
diff --git a/tests/libtracker-data/functions/functions-builtin-floor-1.rq 
b/tests/libtracker-data/functions/functions-builtin-floor-1.rq
new file mode 100644
index 000000000..2b7b65b1e
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-floor-1.rq
@@ -0,0 +1 @@
+SELECT (FLOOR(4.0) AS ?a) (FLOOR(4.5) AS ?b) (FLOOR(4.999999999) AS ?c) (FLOOR(5.000000001) AS ?d) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-hash-1.out 
b/tests/libtracker-data/functions/functions-builtin-hash-1.out
new file mode 100644
index 000000000..739594c83
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-hash-1.out
@@ -0,0 +1 @@
+"900150983cd24fb0d6963f7d28e17f72"     "a9993e364706816aba3e25717850c26c9cd0d89d"      
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"      
"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"      
"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
diff --git a/tests/libtracker-data/functions/functions-builtin-hash-1.rq 
b/tests/libtracker-data/functions/functions-builtin-hash-1.rq
new file mode 100644
index 000000000..35b728ba8
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-hash-1.rq
@@ -0,0 +1,8 @@
+SELECT
+  (MD5('abc') AS ?md5)
+  (SHA1('abc') AS ?sha1)
+  (SHA256('abc') AS ?sha256)
+  (SHA384('abc') AS ?sha384)
+  (SHA512('abc') AS ?sha512)
+{
+}
diff --git a/tests/libtracker-data/functions/functions-builtin-lcase-1.out 
b/tests/libtracker-data/functions/functions-builtin-lcase-1.out
new file mode 100644
index 000000000..f6d67cdc1
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-lcase-1.out
@@ -0,0 +1 @@
+"hello"        "москва"
diff --git a/tests/libtracker-data/functions/functions-builtin-lcase-1.rq 
b/tests/libtracker-data/functions/functions-builtin-lcase-1.rq
new file mode 100644
index 000000000..87cf47b0b
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-lcase-1.rq
@@ -0,0 +1 @@
+SELECT (LCASE('HELLO') AS ?str1) (LCASE('МОСКВА') AS ?str2) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-strafter-1.out 
b/tests/libtracker-data/functions/functions-builtin-strafter-1.out
new file mode 100644
index 000000000..0bb47714e
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strafter-1.out
@@ -0,0 +1 @@
+"cd"
diff --git a/tests/libtracker-data/functions/functions-builtin-strafter-1.rq 
b/tests/libtracker-data/functions/functions-builtin-strafter-1.rq
new file mode 100644
index 000000000..2ecd458f4
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strafter-1.rq
@@ -0,0 +1 @@
+SELECT (STRAFTER('abcd', 'b') AS ?str) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-strbefore-1.out 
b/tests/libtracker-data/functions/functions-builtin-strbefore-1.out
new file mode 100644
index 000000000..231f150c5
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strbefore-1.out
@@ -0,0 +1 @@
+"a"
diff --git a/tests/libtracker-data/functions/functions-builtin-strbefore-1.rq 
b/tests/libtracker-data/functions/functions-builtin-strbefore-1.rq
new file mode 100644
index 000000000..5d565cae2
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-strbefore-1.rq
@@ -0,0 +1 @@
+SELECT (STRBEFORE('abcd', 'b') AS ?str) {}
diff --git a/tests/libtracker-data/functions/functions-builtin-ucase-1.out 
b/tests/libtracker-data/functions/functions-builtin-ucase-1.out
new file mode 100644
index 000000000..984e73e01
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-ucase-1.out
@@ -0,0 +1 @@
+"HELLO"        "МОСКВА"
diff --git a/tests/libtracker-data/functions/functions-builtin-ucase-1.rq 
b/tests/libtracker-data/functions/functions-builtin-ucase-1.rq
new file mode 100644
index 000000000..ca9d89971
--- /dev/null
+++ b/tests/libtracker-data/functions/functions-builtin-ucase-1.rq
@@ -0,0 +1 @@
+SELECT (UCASE('hello') AS ?str1) (UCASE('москва') AS ?str2) {}
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index ba9ecdd8c..4024e105a 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -140,6 +140,13 @@ 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-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-strbefore-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-strafter-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-ceil-1", "functions/data-1", FALSE },
+       { "functions/functions-builtin-floor-1", "functions/data-1", FALSE },
        /* Graph semantics and operations */
        { "graph/graph-1", "graph/data-1", FALSE },
        { "graph/graph-2", "graph/data-2", FALSE },
@@ -539,7 +546,7 @@ main (int argc, char **argv)
        gint result;
        gint i;
 
-       setlocale (LC_COLLATE, "en_US.utf8");
+       setlocale (LC_ALL, "en_US.utf8");
 
        current_dir = g_get_current_dir ();
        tests_data_dir = g_build_filename (current_dir, "sparql-test-data-XXXXXX", NULL);


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