20
20
-module(float_SUITE).
22
-include("test_server.hrl").
24
-export([all/1,init_per_testcase/2,fin_per_testcase/2,
25
fpe/1,fp_drv/1,fp_drv_thread/1,denormalized/1,match/1,bad_float_unpack/1]).
22
-include_lib("test_server/include/test_server.hrl").
24
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
25
init_per_group/2,end_per_group/2,
26
init_per_testcase/2,end_per_testcase/2,
27
fpe/1,fp_drv/1,fp_drv_thread/1,denormalized/1,match/1,
29
-export([otp_7178/1]).
27
32
init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
28
33
Dog = ?t:timetrap(?t:minutes(3)),
29
34
[{watchdog, Dog},{testcase,Func}|Config].
31
fin_per_testcase(_Func, Config) ->
36
end_per_testcase(_Func, Config) ->
32
37
Dog = ?config(watchdog, Config),
33
38
?t:timetrap_cancel(Dog).
36
[fpe,fp_drv,fp_drv_thread,denormalized,match,bad_float_unpack].
40
suite() -> [{ct_hooks,[ts_install_cth]}].
43
[fpe, fp_drv, fp_drv_thread, otp_7178, denormalized,
44
match, bad_float_unpack].
49
init_per_suite(Config) ->
52
end_per_suite(_Config) ->
55
init_per_group(_GroupName, Config) ->
58
end_per_group(_GroupName, Config) ->
63
%% OTP-7178, list_to_float on very small numbers should give 0.0
64
%% instead of exception, i.e. ignore underflow.
69
["test that list_to_float on very small numbers give 0.0"];
70
otp_7178(Config) when is_list(Config) ->
71
?line X = list_to_float("1.0e-325"),
72
?line true = (X < 0.00000001) and (X > -0.00000001),
73
?line Y = list_to_float("1.0e-325325325"),
74
?line true = (Y < 0.00000001) and (Y > -0.00000001),
75
?line {'EXIT', {badarg,_}} = (catch list_to_float("1.0e83291083210")),
38
78
%% Forces floating point exceptions and tests that subsequent, legal,
39
79
%% operations are calculated correctly. Original version by Sebastian