1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
-module(float_test).
-compile(no_auto_import).
-export([parse_test/0, to_string_test/0]).
parse_test() ->
expect:equal(float:parse(<<"1.23">>), {ok, 1.23}),
expect:equal(float:parse(<<"5.0">>), {ok, 5.0}),
expect:equal(float:parse(<<"0.123456789">>), {ok, 0.123456789}),
expect:is_error(float:parse(<<"">>)),
expect:is_error(float:parse(<<"what">>)),
expect:is_error(float:parse(<<"1">>)).
to_string_test() ->
expect:equal(float:to_string(123.0), <<"123.0">>),
expect:equal(float:to_string(-8.1), <<"-8.1">>).
|