Skip to content

Commit

Permalink
testing pull request #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Zorn committed Oct 17, 2013
1 parent e30ec16 commit 961c7df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/egeoip.erl
Expand Up @@ -33,6 +33,11 @@

-include("egeoip.hrl").

%% exports for tests
-ifdef(TEST).
-export([address_fast/3]).
-endif.

%% geoip record API

%% @type geoip_atom() = country_code | country_code3 | country_name |
Expand Down Expand Up @@ -300,7 +305,7 @@ address_fast([N0], Num, 0) ->
ip2long(Address) when is_integer(Address) ->
{ok, Address};
ip2long(Address) when is_list(Address) ->
case catch address_fast(Address, 0, 24) of
case address_fast(Address, 0, 24) of
N when is_integer(N) ->
{ok, N};
_ ->
Expand Down
4 changes: 4 additions & 0 deletions test/egeoip_tests.erl
Expand Up @@ -2,6 +2,9 @@
-include_lib("eunit/include/eunit.hrl").
-include("egeoip.hrl").

address_fast_test_() ->
[?_assertEqual(16909060, egeoip:address_fast("1.2.3.4", 0, 24))].

run_test_() ->
{inorder,
{foreach,
Expand Down Expand Up @@ -99,6 +102,7 @@ country_test2_data() ->
[{"212.118.5.94", "JO"},
{"64.170.57.29", "US"},
{"202.7.216.215", "AU"},
{"1.2.3.4", "AU"},
{"212.33.164.149", "SA"},
{"68.96.110.210", "US"},
{"213.166.131.168", "SA"},
Expand Down

0 comments on commit 961c7df

Please sign in to comment.