1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-module(int_test).
-compile(no_auto_import).
-export([to_string/0, parse/0, to_base_string/0]).
to_string() ->
expect:equal(int:to_string(123), <<"123">>),
expect:equal(int:to_string(-123), <<"-123">>),
expect:equal(int:to_string(123), <<"123">>).
parse() ->
expect:equal(int:parse(<<"123">>), {ok, 123}),
expect:equal(int:parse(<<"-123">>), {ok, -123}),
expect:equal(int:parse(<<"0123">>), {ok, 123}),
expect:is_error(int:parse(<<"">>)),
expect:is_error(int:parse(<<"what">>)),
expect:is_error(int:parse(<<"1.23">>)).
to_base_string() ->
expect:equal(int:to_base_string(100, 16), <<"64">>),
expect:equal(int:to_base_string(-100, 16), <<"-64">>).
|