-
Notifications
You must be signed in to change notification settings - Fork 0
/
geonames_test.erl
35 lines (28 loc) · 1.1 KB
/
geonames_test.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-module(geonames_test).
-export([main/0]).
-load_file(geonames).
-include_lib("eunit/include/eunit.hrl").
main() ->
compile:file(geonames),
inets:start(),
{ StartMegaSeconds, StartSeconds, StartMicroseconds } = erlang:now(),
test(),
{ EndMegaSeconds, EndSeconds, EndMicroseconds } = erlang:now(),
{ TestMegaSeconds, TestSeconds, TestMicroseconds } =
{ EndMegaSeconds - StartMegaSeconds,
EndSeconds - StartSeconds,
EndMicroseconds - StartMicroseconds },
io:format("\033[1m\033[32m\033[40m passing test!\033[0m~n"),
%%io:format("\033[1m\033[31m\033[40m failing test\033[0m~n"),
io:format(" Test run time: ~B.~6..0B seconds.~n",
[TestMegaSeconds*1000 + TestSeconds, TestMicroseconds]).
%% i don't know about testing the current time yet..
%% maybe a GMT modifier to this
timezone_for_test() ->
{_, "Africa/Tripoli"} = geonames:timezone_for("23", "23").
city_from_zip_test() ->
{"HE", "Wiesbaden" } = geonames:city_from_zip("65201").
countrycode_for_test() ->
{"LY"} = geonames:countrycode_for("25", "20").
geonameid_for_test() ->
{"6252001"} = geonames:geonameid_for("us").