diff options
author | Kostis Sagonas <[email protected]> | 2014-03-04 14:05:49 +0100 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2015-12-16 22:08:32 +0100 |
commit | 6a645e07a02f9adda9b9534214e699ad8f30a15f (patch) | |
tree | 204668b974388eeb551ec14a4e52c7ee535acb92 /lib/hipe/test/basic_SUITE_data/basic_bignums.erl | |
parent | 9fd2f21c38944c8a605020d6662bb5935c5bbee2 (diff) | |
download | otp-6a645e07a02f9adda9b9534214e699ad8f30a15f.tar.gz otp-6a645e07a02f9adda9b9534214e699ad8f30a15f.tar.bz2 otp-6a645e07a02f9adda9b9534214e699ad8f30a15f.zip |
More basic tests
and some tests that the HiPE compiler is not causing trouble
Diffstat (limited to 'lib/hipe/test/basic_SUITE_data/basic_bignums.erl')
-rw-r--r-- | lib/hipe/test/basic_SUITE_data/basic_bignums.erl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/hipe/test/basic_SUITE_data/basic_bignums.erl b/lib/hipe/test/basic_SUITE_data/basic_bignums.erl index c455bf318f..79f62e3229 100644 --- a/lib/hipe/test/basic_SUITE_data/basic_bignums.erl +++ b/lib/hipe/test/basic_SUITE_data/basic_bignums.erl @@ -13,6 +13,8 @@ test() -> ok = test_big_fac(), ok = test_int_overfl_32(), ok = test_int_overfl_64(), + ok = test_int_overfl_32_guard(), + ok = test_int_overfl_64_guard(), ok. %%-------------------------------------------------------------------- @@ -122,3 +124,20 @@ test_int_overfl_64() -> add(X, Y) -> X + Y. %%-------------------------------------------------------------------- +%% Tests for correct handling of integer overflow in guards + +test_int_overfl_32_guard() -> + ok = overfl_in_guard(16#7ffffff, 0), + ok = overfl_in_guard(16#7ffffff, 16#7ffffff), + ok. + +test_int_overfl_64_guard() -> + ok = overfl_in_guard(16#7ffffffffffffff, 0), + ok = overfl_in_guard(16#7ffffffffffffff, 16#7ffffffffffffff), + ok. + +overfl_in_guard(X, Y) -> + case ok of + V when X+Y > 12 -> V; + _ -> bad + end. |