[Groonga-commit] groonga/groonga [master] [geo] add missing return.

Back to archive index

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


Kouhei Sutou	2011-10-19 13:59:36 +0000 (Wed, 19 Oct 2011)

  New Revision: 2b932f4b1d48e5f8077d5ea2f58f4528b87a90b2

  Log:
    [geo] add missing return.

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

  Modified: lib/geo.c (+1 -0)
===================================================================
--- lib/geo.c    2011-10-19 13:48:47 +0000 (6c320b1)
+++ lib/geo.c    2011-10-19 13:59:36 +0000 (59a5166)
@@ -1089,6 +1089,7 @@ grn_geo_cursor_next_callback(grn_ctx *ctx, grn_ii_posting *posting,
 {
   grn_ii_posting **return_posting = user_data;
   *return_posting = posting;
+  return GRN_FALSE;
 }
 
 grn_posting *

  Modified: test/unit/core/test-geo-in-rectangle.c (+55 -0)
===================================================================
--- test/unit/core/test-geo-in-rectangle.c    2011-10-19 13:48:47 +0000 (bbdeca0)
+++ test/unit/core/test-geo-in-rectangle.c    2011-10-19 13:59:36 +0000 (642d9f3)
@@ -29,6 +29,8 @@
 void test_in(void);
 void test_not_in(void);
 void test_select(void);
+void data_cursor(void);
+void test_cursor(gconstpointer data);
 void test_estimate(void);
 
 static gchar *tmp_directory;
@@ -250,6 +252,59 @@ test_select(void)
 }
 
 void
+data_cursor(void)
+{
+#define ADD_DATA(label, expected, offset, limit)                        \
+  gcut_add_datum(label,                                                 \
+                 "expected", G_TYPE_POINTER, expected, gcut_list_string_free, \
+                 "offset", G_TYPE_INT, offset,                          \
+                 "limit", G_TYPE_INT, limit,                            \
+                 NULL)
+
+  ADD_DATA("all",
+           gcut_list_string_new("soba-taiyaki-ku",
+                                "sazare",
+                                "hirose-ya",
+                                "taiyaki-kataoka",
+                                "kuruma",
+                                "nezu-no-taiyaki",
+                                NULL),
+           0, -1);
+
+#undef ADD_DATA
+}
+
+void
+test_cursor(gconstpointer data)
+{
+  GList *expected, *records = NULL;
+  gint offset, limit;
+  grn_obj *geo_cursor;
+  grn_posting *posting;
+
+  offset = gcut_data_get_int(data, "offset");
+  limit = gcut_data_get_int(data, "limit");
+  geo_cursor = grn_geo_cursor_open_in_rectangle(context,
+                                                location_index,
+                                                nerima_wgs84, tokyo_wgs84,
+                                                offset, limit);
+  while ((posting = grn_geo_cursor_next(context, geo_cursor))) {
+    grn_id shop_id = posting->rid;
+    gchar key[GRN_TABLE_MAX_KEY_SIZE];
+    gint key_size;
+
+    key_size = grn_table_get_key(context, shops, shop_id,
+                                 &key, GRN_TABLE_MAX_KEY_SIZE);
+    records = g_list_append(records, g_strndup(key, key_size));
+  }
+  grn_obj_unlink(context, geo_cursor);
+
+  expected = (GList *)gcut_data_get_pointer(data, "expected");
+  gcut_take_list(records, g_free);
+  gcut_assert_equal_list_string(expected, records);
+}
+
+void
 test_estimate(void)
 {
   cut_assert_equal_int(4,




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