[Groonga-commit] groonga/groonga [master] [test][geo] test also record value.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 10月 19日 (水) 22:48:47 JST


Kouhei Sutou	2011-10-19 13:48:47 +0000 (Wed, 19 Oct 2011)

  New Revision: 9fd0e68ed37bd9ed6e5fae6109d6b1357436c907

  Log:
    [test][geo] test also record value.

  Modified files:
    test/unit/core/test-geo-in-rectangle.c

  Modified: test/unit/core/test-geo-in-rectangle.c (+38 -2)
===================================================================
--- test/unit/core/test-geo-in-rectangle.c    2011-10-19 13:32:40 +0000 (cdcad81)
+++ test/unit/core/test-geo-in-rectangle.c    2011-10-19 13:48:47 +0000 (bbdeca0)
@@ -202,6 +202,35 @@ test_not_in(void)
                                         hiiragi_wgs84));
 }
 
+static GList *
+result_to_list(void)
+{
+  GList *list = NULL;
+  grn_table_cursor *cursor;
+
+  cursor = grn_table_cursor_open(context, result,
+                                 NULL, 0,
+                                 NULL, 0,
+                                 0, -1,
+                                 GRN_CURSOR_ASCENDING | GRN_CURSOR_BY_ID);
+  while ((grn_table_cursor_next(context, cursor))) {
+    void *result_key;
+    gint result_key_size;
+    grn_id shop_id;
+    gchar key[GRN_TABLE_MAX_KEY_SIZE];
+    gint key_size;
+
+    result_key_size = grn_table_cursor_get_key(context, cursor, &result_key);
+    memcpy(&shop_id, result_key, result_key_size);
+    key_size = grn_table_get_key(context, shops, shop_id,
+                                 &key, GRN_TABLE_MAX_KEY_SIZE);
+    list = g_list_append(list, g_strndup(key, key_size));
+  }
+  gcut_take_list(list, g_free);
+
+  return list;
+}
+
 void
 test_select(void)
 {
@@ -209,8 +238,15 @@ test_select(void)
                                               location_index,
                                               nerima_wgs84, tokyo_wgs84,
                                               result, GRN_OP_OR));
-  cut_assert_equal_int(6,
-                       grn_table_size(context, result));
+  gcut_assert_equal_list_string(
+    gcut_take_new_list_string("soba-taiyaki-ku",
+                              "sazare",
+                              "hirose-ya",
+                              "taiyaki-kataoka",
+                              "kuruma",
+                              "nezu-no-taiyaki",
+                              NULL),
+    result_to_list());
 }
 
 void




Groonga-commit メーリングリストの案内
Back to archive index