[tracker/wip/carlosg/more-tests] tests: Add more aggregate function tests




commit d18138fe7c4668f820ff5939aca6c34e7ab45273
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Mar 11 00:38:16 2022 +0100

    tests: Add more aggregate function tests

 tests/libtracker-data/aggregates/aggregate-count-1.out        |  1 +
 tests/libtracker-data/aggregates/aggregate-count-1.rq         |  3 +++
 tests/libtracker-data/aggregates/aggregate-count-2.out        |  1 +
 tests/libtracker-data/aggregates/aggregate-count-2.rq         |  3 +++
 tests/libtracker-data/aggregates/aggregate-count-3.out        |  1 +
 tests/libtracker-data/aggregates/aggregate-count-3.rq         |  3 +++
 tests/libtracker-data/aggregates/aggregate-group-having-1.out |  1 +
 tests/libtracker-data/aggregates/aggregate-group-having-1.rq  | 10 ++++++++++
 tests/libtracker-data/tracker-sparql-test.c                   |  4 ++++
 9 files changed, 27 insertions(+)
---
diff --git a/tests/libtracker-data/aggregates/aggregate-count-1.out 
b/tests/libtracker-data/aggregates/aggregate-count-1.out
new file mode 100644
index 000000000..18d17df02
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-count-1.out
@@ -0,0 +1 @@
+"3"
diff --git a/tests/libtracker-data/aggregates/aggregate-count-1.rq 
b/tests/libtracker-data/aggregates/aggregate-count-1.rq
new file mode 100644
index 000000000..dbdb24acf
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-count-1.rq
@@ -0,0 +1,3 @@
+PREFIX : <http://example/>
+
+SELECT COUNT(?u) { [ :i2 ?u ] }
diff --git a/tests/libtracker-data/aggregates/aggregate-count-2.out 
b/tests/libtracker-data/aggregates/aggregate-count-2.out
new file mode 100644
index 000000000..18d17df02
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-count-2.out
@@ -0,0 +1 @@
+"3"
diff --git a/tests/libtracker-data/aggregates/aggregate-count-2.rq 
b/tests/libtracker-data/aggregates/aggregate-count-2.rq
new file mode 100644
index 000000000..dd440145d
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-count-2.rq
@@ -0,0 +1,3 @@
+PREFIX : <http://example/>
+
+SELECT COUNT(*) { [ :i2 ?u ] }
diff --git a/tests/libtracker-data/aggregates/aggregate-count-3.out 
b/tests/libtracker-data/aggregates/aggregate-count-3.out
new file mode 100644
index 000000000..1026c253e
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-count-3.out
@@ -0,0 +1 @@
+"2"
diff --git a/tests/libtracker-data/aggregates/aggregate-count-3.rq 
b/tests/libtracker-data/aggregates/aggregate-count-3.rq
new file mode 100644
index 000000000..73a072b8a
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-count-3.rq
@@ -0,0 +1,3 @@
+PREFIX : <http://example/>
+
+SELECT COUNT(DISTINCT ?u) { [ :i2 ?u ] }
diff --git a/tests/libtracker-data/aggregates/aggregate-group-having-1.out 
b/tests/libtracker-data/aggregates/aggregate-group-having-1.out
new file mode 100644
index 000000000..e66f8d307
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-group-having-1.out
@@ -0,0 +1 @@
+"http://example/x";     "2"     "8"     "string t|string y"
diff --git a/tests/libtracker-data/aggregates/aggregate-group-having-1.rq 
b/tests/libtracker-data/aggregates/aggregate-group-having-1.rq
new file mode 100644
index 000000000..c8dc7bef8
--- /dev/null
+++ b/tests/libtracker-data/aggregates/aggregate-group-having-1.rq
@@ -0,0 +1,10 @@
+PREFIX : <http://example/>
+
+SELECT ?a COUNT(DISTINCT ?b) SUM(?ib) GROUP_CONCAT(?sb, "|")
+{ ?a a :A ;
+     :b ?b .
+  ?b :ib ?ib .
+  ?b :sb ?sb .
+  FILTER (?ib>2) }
+GROUP BY ?a
+HAVING (SUM(?ib)<10)
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index f09798b86..aa932019a 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -42,10 +42,14 @@ struct _TestInfo {
 
 const TestInfo tests[] = {
        { "aggregates/aggregate-1", "aggregates/data-1", FALSE },
+       { "aggregates/aggregate-count-1", "aggregates/data-1", FALSE },
+       { "aggregates/aggregate-count-2", "aggregates/data-1", FALSE },
+       { "aggregates/aggregate-count-3", "aggregates/data-1", FALSE },
        { "aggregates/aggregate-distinct-1", "aggregates/data-1", FALSE },
        { "aggregates/aggregate-group-1", "aggregates/data-1", FALSE },
        { "aggregates/aggregate-group-2", "aggregates/data-1", FALSE },
        { "aggregates/aggregate-group-as-1", "aggregates/data-1", FALSE },
+       { "aggregates/aggregate-group-having-1", "aggregates/data-1", FALSE },
        { "algebra/two-nested-opt", "algebra/two-nested-opt", FALSE },
        { "algebra/two-nested-opt-alt", "algebra/two-nested-opt", FALSE },
        { "algebra/opt-filter-3", "algebra/opt-filter-3", FALSE },


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