mtodd-geoip 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/geoip.c +1 -1
- data/test.rb +6 -0
- metadata +1 -1
data/Rakefile
CHANGED
data/geoip.c
CHANGED
@@ -178,7 +178,7 @@ VALUE rb_geoip_org_look_up(VALUE self, VALUE addr) {
|
|
178
178
|
*/
|
179
179
|
VALUE rb_geoip_addr_to_num(VALUE self, VALUE addr) {
|
180
180
|
Check_Type(addr, T_STRING);
|
181
|
-
return
|
181
|
+
return UINT2NUM((unsigned long)_GeoIP_addr_to_num(STR2CSTR(addr)));
|
182
182
|
}
|
183
183
|
|
184
184
|
void Init_geoip()
|
data/test.rb
CHANGED
@@ -22,6 +22,12 @@ class GeoIPTest < Test::Unit::TestCase
|
|
22
22
|
assert_equal ipnum, GeoIP.addr_to_num(ip)
|
23
23
|
end
|
24
24
|
|
25
|
+
def test_addr_to_num_converts_large_ips_to_an_ipnum_correctly
|
26
|
+
ip = "245.245.245.245"
|
27
|
+
ipnum = 16777216*245 + 65536*245 + 256*245 + 245
|
28
|
+
assert_equal ipnum, GeoIP.addr_to_num(ip)
|
29
|
+
end
|
30
|
+
|
25
31
|
def test_addr_to_num_expects_an_ip_string
|
26
32
|
assert_raises TypeError do
|
27
33
|
GeoIP.addr_to_num(nil)
|