summaryrefslogtreecommitdiff
path: root/tests/libtracker-sparql
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2022-05-01 15:45:58 +0200
committerCarlos Garnacho <carlosg@gnome.org>2022-05-01 19:44:47 +0200
commitaa6b3eb69bc07dfa0f47dc8d5bbdf040c5c54c13 (patch)
tree276dcf6e5751363111dd032cdc490c3a9515a623 /tests/libtracker-sparql
parente2a3afb3f747d49e9c20cea8a640499960f62545 (diff)
downloadtracker-aa6b3eb69bc07dfa0f47dc8d5bbdf040c5c54c13.tar.gz
tests: Compare cursors more exhaustively in cursor tests
In some cursor tests we compare the output of specific connections with the output of a direct connection. Poke harder around both cursors looking exactly the same.
Diffstat (limited to 'tests/libtracker-sparql')
-rw-r--r--tests/libtracker-sparql/tracker-cursor-test.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/libtracker-sparql/tracker-cursor-test.c b/tests/libtracker-sparql/tracker-cursor-test.c
index b45c53915..e93740c12 100644
--- a/tests/libtracker-sparql/tracker-cursor-test.c
+++ b/tests/libtracker-sparql/tracker-cursor-test.c
@@ -98,10 +98,32 @@ static void
compare_cursors (TrackerSparqlCursor *cursor_a,
TrackerSparqlCursor *cursor_b)
{
+ gint col, n_cols;
+
+ g_assert_cmpint (tracker_sparql_cursor_get_n_columns (cursor_a),
+ ==,
+ tracker_sparql_cursor_get_n_columns (cursor_b));
+
+ n_cols = tracker_sparql_cursor_get_n_columns (cursor_a);
+
while (tracker_sparql_cursor_next (cursor_a, NULL, NULL) && tracker_sparql_cursor_next (cursor_b, NULL, NULL)) {
- g_assert_cmpstr (tracker_sparql_cursor_get_string (cursor_a, 0, NULL),
- ==,
- tracker_sparql_cursor_get_string (cursor_b, 0, NULL));
+ for (col = 0; col < n_cols; col++) {
+ g_assert_cmpstr (tracker_sparql_cursor_get_variable_name (cursor_a, col),
+ ==,
+ tracker_sparql_cursor_get_variable_name (cursor_b, col));
+
+ g_assert_cmpstr (tracker_sparql_cursor_get_string (cursor_a, col, NULL),
+ ==,
+ tracker_sparql_cursor_get_string (cursor_b, col, NULL));
+
+ g_assert_cmpint (tracker_sparql_cursor_is_bound (cursor_a, col),
+ ==,
+ tracker_sparql_cursor_is_bound (cursor_b, col));
+
+ g_assert_cmpint (tracker_sparql_cursor_get_value_type (cursor_a, col),
+ ==,
+ tracker_sparql_cursor_get_value_type (cursor_b, col));
+ }
}
/* Check that both cursors are at the end (same number of rows) */