[tracker/wip/carlosg/deserializer-cursors: 12/15] tests: Compare cursors more exhaustively in cursor tests




commit 637d83262818dbb96cfd44c99a402b3e967d95cd
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun May 1 15:45:58 2022 +0200

    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.

 tests/libtracker-sparql/tracker-cursor-test.c | 28 ++++++++++++++++++++++++---
 1 file 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) */


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