diff options
author | Björn Gustavsson <[email protected]> | 2017-06-12 10:47:49 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-06-12 10:50:12 +0200 |
commit | 808c828c30cbb0fb57847675cc579d989c687710 (patch) | |
tree | 60ae39f474975a918f4c45ed8242b1ce856625bd /lib/compiler/test | |
parent | c1d2968701ef330bb38771185a86e8ec3676c091 (diff) | |
download | otp-808c828c30cbb0fb57847675cc579d989c687710.tar.gz otp-808c828c30cbb0fb57847675cc579d989c687710.tar.bz2 otp-808c828c30cbb0fb57847675cc579d989c687710.zip |
beam_type_SUITE: Add a test case for an already fixed bug
https://bugs.erlang.org/browse/ERL-433
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/beam_type_SUITE.erl | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_type_SUITE.erl b/lib/compiler/test/beam_type_SUITE.erl index 07dad85c57..86146c614f 100644 --- a/lib/compiler/test/beam_type_SUITE.erl +++ b/lib/compiler/test/beam_type_SUITE.erl @@ -22,7 +22,7 @@ -export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1, init_per_group/2,end_per_group/2, integers/1,coverage/1,booleans/1,setelement/1,cons/1, - tuple/1,record_float/1,binary_float/1]). + tuple/1,record_float/1,binary_float/1,float_compare/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. @@ -39,7 +39,8 @@ groups() -> cons, tuple, record_float, - binary_float + binary_float, + float_compare ]}]. init_per_suite(Config) -> @@ -151,5 +152,25 @@ binary_float(_Config) -> binary_negate_float(<<Float/float>>) -> <<-Float/float>>. +float_compare(_Config) -> + false = do_float_compare(-42.0), + false = do_float_compare(-42), + false = do_float_compare(0), + false = do_float_compare(0.0), + true = do_float_compare(42), + true = do_float_compare(42.0), + ok. + +do_float_compare(X) -> + %% ERL-433: Used to fail before OTP 20. Was accidentally fixed + %% in OTP 20. Add a test case to ensure it stays fixed. + + Y = X + 1.0, + case X > 0 of + T when (T =:= nil) or (T =:= false) -> T; + _T -> Y > 0 + end. + + id(I) -> I. |