@@ -6,85 +6,111 @@ class TestCommandsGeo < Test::Unit::TestCase
6
6
def setup
7
7
super
8
8
9
- added_items_count = r . geoadd ( "Sicily" , 13.361389 , 38.115556 , "Palermo" , 15.087269 , 37.502669 , "Catania" )
10
- assert_equal 2 , added_items_count
9
+ target_version "3.2.0" do
10
+ added_items_count = r . geoadd ( "Sicily" , 13.361389 , 38.115556 , "Palermo" , 15.087269 , 37.502669 , "Catania" )
11
+ assert_equal 2 , added_items_count
12
+ end
11
13
end
12
14
13
15
def test_georadius_with_sort
14
- nearest_cities = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , sort : 'asc' )
15
- assert_equal %w( Catania Palermo ) , nearest_cities
16
+ target_version "3.2.0" do
17
+ nearest_cities = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , sort : 'asc' )
18
+ assert_equal %w( Catania Palermo ) , nearest_cities
16
19
17
- farthest_cities = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , sort : 'desc' )
18
- assert_equal %w( Palermo Catania ) , farthest_cities
20
+ farthest_cities = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , sort : 'desc' )
21
+ assert_equal %w( Palermo Catania ) , farthest_cities
22
+ end
19
23
end
20
24
21
25
def test_georadius_with_count
22
- city = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , count : 1 )
23
- assert_equal %w( Catania ) , city
26
+ target_version "3.2.0" do
27
+ city = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , count : 1 )
28
+ assert_equal %w( Catania ) , city
29
+ end
24
30
end
25
31
26
32
def test_georadius_with_options_count_sort
27
- city = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , sort : :desc , options : :WITHDIST , count : 1 )
28
- assert_equal [ [ "Palermo" , "190.4424" ] ] , city
33
+ target_version "3.2.0" do
34
+ city = r . georadius ( "Sicily" , 15 , 37 , 200 , 'km' , sort : :desc , options : :WITHDIST , count : 1 )
35
+ assert_equal [ [ "Palermo" , "190.4424" ] ] , city
36
+ end
29
37
end
30
38
31
39
def test_georadiusbymember_with_sort
32
- nearest_cities = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , sort : 'asc' )
33
- assert_equal %w( Catania Palermo ) , nearest_cities
40
+ target_version "3.2.0" do
41
+ nearest_cities = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , sort : 'asc' )
42
+ assert_equal %w( Catania Palermo ) , nearest_cities
34
43
35
- farthest_cities = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , sort : 'desc' )
36
- assert_equal %w( Palermo Catania ) , farthest_cities
44
+ farthest_cities = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , sort : 'desc' )
45
+ assert_equal %w( Palermo Catania ) , farthest_cities
46
+ end
37
47
end
38
48
39
49
def test_georadiusbymember_with_count
40
- city = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , count : 1 )
41
- assert_equal %w( Catania ) , city
50
+ target_version "3.2.0" do
51
+ city = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , count : 1 )
52
+ assert_equal %w( Catania ) , city
53
+ end
42
54
end
43
55
44
56
def test_georadiusbymember_with_options_count_sort
45
- city = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , sort : :desc , options : :WITHDIST , count : 1 )
46
- assert_equal [ [ "Palermo" , "166.2742" ] ] , city
57
+ target_version "3.2.0" do
58
+ city = r . georadiusbymember ( "Sicily" , "Catania" , 200 , 'km' , sort : :desc , options : :WITHDIST , count : 1 )
59
+ assert_equal [ [ "Palermo" , "166.2742" ] ] , city
60
+ end
47
61
end
48
62
49
63
def test_geopos
50
- location = r . geopos ( "Sicily" , "Catania" )
51
- assert_equal [ [ "15.08726745843887329" , "37.50266842333162032" ] ] , location
64
+ target_version "3.2.0" do
65
+ location = r . geopos ( "Sicily" , "Catania" )
66
+ assert_equal [ [ "15.08726745843887329" , "37.50266842333162032" ] ] , location
52
67
53
- locations = r . geopos ( "Sicily" , [ "Palermo" , "Catania" ] )
54
- assert_equal [ [ "13.36138933897018433" , "38.11555639549629859" ] , [ "15.08726745843887329" , "37.50266842333162032" ] ] , locations
68
+ locations = r . geopos ( "Sicily" , [ "Palermo" , "Catania" ] )
69
+ assert_equal [ [ "13.36138933897018433" , "38.11555639549629859" ] , [ "15.08726745843887329" , "37.50266842333162032" ] ] , locations
70
+ end
55
71
end
56
72
57
73
def test_geopos_nonexistant_location
58
- location = r . geopos ( "Sicily" , "Rome" )
59
- assert_equal [ nil ] , location
74
+ target_version "3.2.0" do
75
+ location = r . geopos ( "Sicily" , "Rome" )
76
+ assert_equal [ nil ] , location
60
77
61
- locations = r . geopos ( "Sicily" , [ "Rome" , "Catania" ] )
62
- assert_equal [ nil , [ "15.08726745843887329" , "37.50266842333162032" ] ] , locations
78
+ locations = r . geopos ( "Sicily" , [ "Rome" , "Catania" ] )
79
+ assert_equal [ nil , [ "15.08726745843887329" , "37.50266842333162032" ] ] , locations
80
+ end
63
81
end
64
82
65
83
def test_geodist
66
- distination_in_meters = r . geodist ( "Sicily" , "Palermo" , "Catania" )
67
- assert_equal "166274.1516" , distination_in_meters
84
+ target_version "3.2.0" do
85
+ distination_in_meters = r . geodist ( "Sicily" , "Palermo" , "Catania" )
86
+ assert_equal "166274.1516" , distination_in_meters
68
87
69
- distination_in_feet = r . geodist ( "Sicily" , "Palermo" , "Catania" , 'ft' )
70
- assert_equal "545518.8700" , distination_in_feet
88
+ distination_in_feet = r . geodist ( "Sicily" , "Palermo" , "Catania" , 'ft' )
89
+ assert_equal "545518.8700" , distination_in_feet
90
+ end
71
91
end
72
92
73
93
def test_geodist_with_nonexistant_location
74
- distination = r . geodist ( "Sicily" , "Palermo" , "Rome" )
75
- assert_equal nil , distination
94
+ target_version "3.2.0" do
95
+ distination = r . geodist ( "Sicily" , "Palermo" , "Rome" )
96
+ assert_equal nil , distination
97
+ end
76
98
end
77
99
78
100
def test_geohash
79
- geohash = r . geohash ( "Sicily" , "Palermo" )
80
- assert_equal [ "sqc8b49rny0" ] , geohash
101
+ target_version "3.2.0" do
102
+ geohash = r . geohash ( "Sicily" , "Palermo" )
103
+ assert_equal [ "sqc8b49rny0" ] , geohash
81
104
82
- geohashes = r . geohash ( "Sicily" , [ "Palermo" , "Catania" ] )
83
- assert_equal %w( sqc8b49rny0 sqdtr74hyu0 ) , geohashes
105
+ geohashes = r . geohash ( "Sicily" , [ "Palermo" , "Catania" ] )
106
+ assert_equal %w( sqc8b49rny0 sqdtr74hyu0 ) , geohashes
107
+ end
84
108
end
85
109
86
110
def test_geohash_with_nonexistant_location
87
- geohashes = r . geohash ( "Sicily" , [ "Palermo" , "Rome" ] )
88
- assert_equal [ "sqc8b49rny0" , nil ] , geohashes
111
+ target_version "3.2.0" do
112
+ geohashes = r . geohash ( "Sicily" , [ "Palermo" , "Rome" ] )
113
+ assert_equal [ "sqc8b49rny0" , nil ] , geohashes
114
+ end
89
115
end
90
116
end
0 commit comments