[Groonga-commit] groonga/groonga [master] test: move invalid geo point value load test to function test

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 17日 (火) 23:19:12 JST


Kouhei Sutou	2012-07-17 23:19:12 +0900 (Tue, 17 Jul 2012)

  New Revision: 138aee4133e85c75366ce73254ae7d8dc56480bb
  https://github.com/groonga/groonga/commit/138aee4133e85c75366ce73254ae7d8dc56480bb

  Log:
    test: move invalid geo point value load test to function test

  Added files:
    test/function/suite/load/invalid/geo-point-too-large-latitude.expected
    test/function/suite/load/invalid/geo-point-too-large-latitude.test
    test/function/suite/load/invalid/geo-point-too-large-longitude.expected
    test/function/suite/load/invalid/geo-point-too-large-longitude.test
    test/function/suite/load/invalid/geo-point-too-small-latitude.expected
    test/function/suite/load/invalid/geo-point-too-small-latitude.test
    test/function/suite/load/invalid/geo-point-too-small-longitude.expected
    test/function/suite/load/invalid/geo-point-too-small-longitude.test
  Modified files:
    test/unit/core/test-command-load.c

  Added: test/function/suite/load/invalid/geo-point-too-large-latitude.expected (+11 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-large-latitude.expected    2012-07-17 23:19:12 +0900 (4945bd3)
@@ -0,0 +1,11 @@
+table_create Shops TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+[[0,0.0,0.0],true]
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "324000001x-74.044444"}
+]
+[[0,0.0,0.0],1]
+#|e| <Shops.location>: failed to cast to <WGS84GeoPoint>: <"324000001x-74.044444">
+#|e| [table][load] failed to set column value: <Shops.location>: failed to cast to <WGS84GeoPoint>: <"324000001x-74.044444">: key: <"Statue of Liberty">, column: <location>, value: <"324000001x-74.044444">

  Added: test/function/suite/load/invalid/geo-point-too-large-latitude.test (+7 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-large-latitude.test    2012-07-17 23:19:12 +0900 (8546685)
@@ -0,0 +1,7 @@
+table_create Shops TABLE_HASH_KEY ShortText
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "324000001x-74.044444"}
+]

  Added: test/function/suite/load/invalid/geo-point-too-large-longitude.expected (+11 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-large-longitude.expected    2012-07-17 23:19:12 +0900 (4fdd463)
@@ -0,0 +1,11 @@
+table_create Shops TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+[[0,0.0,0.0],true]
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "40.689167x648000001"}
+]
+[[0,0.0,0.0],1]
+#|e| <Shops.location>: failed to cast to <WGS84GeoPoint>: <"40.689167x648000001">
+#|e| [table][load] failed to set column value: <Shops.location>: failed to cast to <WGS84GeoPoint>: <"40.689167x648000001">: key: <"Statue of Liberty">, column: <location>, value: <"40.689167x648000001">

  Added: test/function/suite/load/invalid/geo-point-too-large-longitude.test (+7 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-large-longitude.test    2012-07-17 23:19:12 +0900 (8097c64)
@@ -0,0 +1,7 @@
+table_create Shops TABLE_HASH_KEY ShortText
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "40.689167x648000001"}
+]

  Added: test/function/suite/load/invalid/geo-point-too-small-latitude.expected (+11 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-small-latitude.expected    2012-07-17 23:19:12 +0900 (9c9eeea)
@@ -0,0 +1,11 @@
+table_create Shops TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+[[0,0.0,0.0],true]
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "-324000001x-74.044444"}
+]
+[[0,0.0,0.0],1]
+#|e| <Shops.location>: failed to cast to <WGS84GeoPoint>: <"-324000001x-74.044444">
+#|e| [table][load] failed to set column value: <Shops.location>: failed to cast to <WGS84GeoPoint>: <"-324000001x-74.044444">: key: <"Statue of Liberty">, column: <location>, value: <"-324000001x-74.044444">

  Added: test/function/suite/load/invalid/geo-point-too-small-latitude.test (+7 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-small-latitude.test    2012-07-17 23:19:12 +0900 (bae16f2)
@@ -0,0 +1,7 @@
+table_create Shops TABLE_HASH_KEY ShortText
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "-324000001x-74.044444"}
+]

  Added: test/function/suite/load/invalid/geo-point-too-small-longitude.expected (+11 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-small-longitude.expected    2012-07-17 23:19:12 +0900 (fede6c8)
@@ -0,0 +1,11 @@
+table_create Shops TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+[[0,0.0,0.0],true]
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "40.689167x-648000001"}
+]
+[[0,0.0,0.0],1]
+#|e| <Shops.location>: failed to cast to <WGS84GeoPoint>: <"40.689167x-648000001">
+#|e| [table][load] failed to set column value: <Shops.location>: failed to cast to <WGS84GeoPoint>: <"40.689167x-648000001">: key: <"Statue of Liberty">, column: <location>, value: <"40.689167x-648000001">

  Added: test/function/suite/load/invalid/geo-point-too-small-longitude.test (+7 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/invalid/geo-point-too-small-longitude.test    2012-07-17 23:19:12 +0900 (d872cbd)
@@ -0,0 +1,7 @@
+table_create Shops TABLE_HASH_KEY ShortText
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+
+load --table Shops
+[
+{"_key": "Statue of Liberty", "location": "40.689167x-648000001"}
+]

  Modified: test/unit/core/test-command-load.c (+0 -45)
===================================================================
--- test/unit/core/test-command-load.c    2012-07-17 23:18:19 +0900 (e2fd67e)
+++ test/unit/core/test-command-load.c    2012-07-17 23:19:12 +0900 (054193f)
@@ -43,8 +43,6 @@ void data_each(void);
 void test_each(gconstpointer data);
 void test_vector_reference_column(void);
 void test_invalid_int32_value(void);
-void data_invalid_geo_point_valid(void);
-void test_invalid_geo_point_value(gconstpointer data);
 
 static gchar *tmp_directory;
 static const gchar *database_path;
@@ -501,46 +499,3 @@ test_invalid_int32_value(void)
      "[1,0]]]",
     send_command("select Users"));
 }
-
-
-void
-data_invalid_geo_point_value(void)
-{
-#define ADD_DATUM(label, location)                                      \
-  gcut_add_datum(label " (" location ")",                               \
-                 "location", G_TYPE_STRING, location,                   \
-                 NULL)
-
-  ADD_DATUM("too large latitude", "324000001x502419287");
-  ADD_DATUM("too small latitude", "-324000001x502419287");
-  ADD_DATUM("too large longitude", "128514964x648000001");
-  ADD_DATUM("too small longitude", "128514964x-648000001");
-
-#undef ADD_DATUM
-}
-
-void
-test_invalid_geo_point_value(gconstpointer data)
-{
-  assert_send_command("table_create Shops TABLE_HASH_KEY ShortText");
-  assert_send_command("column_create Shops location COLUMN_SCALAR WGS84GeoPoint");
-  grn_test_assert_send_command_error(
-    context,
-    GRN_INVALID_ARGUMENT,
-    cut_take_printf("<Shops.location>: "
-                    "failed to cast to <WGS84GeoPoint>: <\"%s\">",
-                    gcut_data_get_string(data, "location")),
-    cut_take_printf("load --table Shops\n"
-                    "[\n"
-                    "{\"_key\": \"たかね\", \"location\": \"%s\"}\n"
-                    "]\n",
-                    gcut_data_get_string(data, "location")));
-  send_command("]\n");
-  cut_assert_equal_string(
-    "[[[1],"
-     "[[\"_id\",\"UInt32\"],"
-      "[\"_key\",\"ShortText\"],"
-      "[\"location\",\"WGS84GeoPoint\"]],"
-     "[1,\"たかね\",\"0x0\"]]]",
-    send_command("select Shops"));
-}
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



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