null+****@clear*****
null+****@clear*****
2012年 4月 19日 (木) 19:01:15 JST
khayashi 2012-04-19 19:01:15 +0900 (Thu, 19 Apr 2012)
New Revision: fa126f5b1460431f32b787793c5e5d1be456d212
Log:
test: migrate a test from Cutter to grntest style
The test checks loading the value of geo point column(indexed).
Added files:
test/function/suite/load/scalar-geo-point-index.expected
test/function/suite/load/scalar-geo-point-index.test
Modified files:
test/unit/core/test-command-load.c
Added: test/function/suite/load/scalar-geo-point-index.expected (+120 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/scalar-geo-point-index.expected 2012-04-19 19:01:15 +0900 (ce8e0bd)
@@ -0,0 +1,120 @@
+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]
+table_create Locations TABLE_PAT_KEY WGS84GeoPoint
+[[0,0.0,0.0],true]
+column_create Locations shop COLUMN_INDEX Shops location
+[[0,0.0,0.0],true]
+load --table Shops
+[
+{"_key": "たかね", "location": "128514964x502419287"}
+]
+[[0,0.0,0.0],1]
+select Shops --filter 'geo_in_circle(location, "128514964x502419287", 1)'
+[
+ [
+ 0,
+ 0.0,
+ 0.0
+ ],
+ [
+ [
+ [
+ 1
+ ],
+ [
+ [
+ "_id",
+ "UInt32"
+ ],
+ [
+ "_key",
+ "ShortText"
+ ],
+ [
+ "location",
+ "WGS84GeoPoint"
+ ]
+ ],
+ [
+ 1,
+ "たかね",
+ "128514964x502419287"
+ ]
+ ]
+ ]
+]
+load --table Shops
+[
+{"_key": "たかね", "location": null}
+]
+[[0,0.0,0.0],1]
+select Shops --filter 'geo_in_circle(location, "128514964x502419287", 1)'
+[
+ [
+ 0,
+ 0.0,
+ 0.0
+ ],
+ [
+ [
+ [
+ 0
+ ],
+ [
+ [
+ "_id",
+ "UInt32"
+ ],
+ [
+ "_key",
+ "ShortText"
+ ],
+ [
+ "location",
+ "WGS84GeoPoint"
+ ]
+ ]
+ ]
+ ]
+]
+load --table Shops
+[
+{"_key": "たかね", "location": "128514964x502419287"}
+]
+[[0,0.0,0.0],1]
+select Shops --filter 'geo_in_circle(location, "128514964x502419287", 1)'
+[
+ [
+ 0,
+ 0.0,
+ 0.0
+ ],
+ [
+ [
+ [
+ 1
+ ],
+ [
+ [
+ "_id",
+ "UInt32"
+ ],
+ [
+ "_key",
+ "ShortText"
+ ],
+ [
+ "location",
+ "WGS84GeoPoint"
+ ]
+ ],
+ [
+ 1,
+ "たかね",
+ "128514964x502419287"
+ ]
+ ]
+ ]
+]
Added: test/function/suite/load/scalar-geo-point-index.test (+26 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/load/scalar-geo-point-index.test 2012-04-19 19:01:15 +0900 (2770f9a)
@@ -0,0 +1,26 @@
+table_create Shops TABLE_HASH_KEY ShortText
+column_create Shops location COLUMN_SCALAR WGS84GeoPoint
+
+table_create Locations TABLE_PAT_KEY WGS84GeoPoint
+column_create Locations shop COLUMN_INDEX Shops location
+
+load --table Shops
+[
+{"_key": "たかね", "location": "128514964x502419287"}
+]
+
+select Shops --filter 'geo_in_circle(location, "128514964x502419287", 1)'
+
+load --table Shops
+[
+{"_key": "たかね", "location": null}
+]
+
+select Shops --filter 'geo_in_circle(location, "128514964x502419287", 1)'
+
+load --table Shops
+[
+{"_key": "たかね", "location": "128514964x502419287"}
+]
+
+select Shops --filter 'geo_in_circle(location, "128514964x502419287", 1)'
Modified: test/unit/core/test-command-load.c (+0 -44)
===================================================================
--- test/unit/core/test-command-load.c 2012-04-19 17:43:40 +0900 (d77d9b5)
+++ test/unit/core/test-command-load.c 2012-04-19 19:01:15 +0900 (75569a9)
@@ -313,50 +313,6 @@ test_null(gconstpointer data)
send_command("select Students"));
}
-void
-test_index_geo_point(void)
-{
- const gchar *query =
- "select Shops "
- "--filter 'geo_in_circle(location, \"128514964x502419287\", 1)'";
- const gchar *hit_result =
- "[[[1],"
- "[[\"_id\",\"UInt32\"],"
- "[\"_key\",\"ShortText\"],"
- "[\"location\",\"WGS84GeoPoint\"]],"
- "[1,\"たかね\",\"128514964x502419287\"]]]";
- const gchar *no_hit_result =
- "[[[0],"
- "[[\"_id\",\"UInt32\"],"
- "[\"_key\",\"ShortText\"],"
- "[\"location\",\"WGS84GeoPoint\"]]]]";
- const gchar *load_takane =
- "load --table Shops\n"
- "[{\"_key\": \"たかね\", \"location\": \"128514964x502419287\"}]";
- const gchar *load_takane_with_empty_location =
- "load --table Shops\n"
- "[{\"_key\": \"たかね\", \"location\": null}]";
-
- assert_send_command("table_create Shops TABLE_HASH_KEY ShortText");
- assert_send_command("column_create Shops location COLUMN_SCALAR WGS84GeoPoint");
- assert_send_command("table_create Locations TABLE_PAT_KEY WGS84GeoPoint");
- assert_send_command("column_create Locations shop COLUMN_INDEX Shops location");
-
- cut_assert_equal_string("1",
- send_command(load_takane));
- cut_assert_equal_string(hit_result,
- send_command(query));
-
- cut_assert_equal_string("1",
- send_command(load_takane_with_empty_location));
- cut_assert_equal_string(no_hit_result,
- send_command(query));
-
- cut_assert_equal_string("1",
- send_command(load_takane));
- cut_assert_equal_string(hit_result,
- send_command(query));
-}
void
test_nonexistent_columns(void)