diff options
author | Henrik Nord <[email protected]> | 2014-02-25 13:40:48 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2014-02-25 13:40:48 +0100 |
commit | f90751b9f766a0155aaaa6fe22bc925f3a9874e2 (patch) | |
tree | 832940d8c290d35963285f9bc62b62eff460311b /lib/hipe/test/bs_SUITE_data/bs_bugs_R08.erl | |
parent | 7512dc06d2356c116475661693c1bc73d18434dd (diff) | |
parent | 9855233b06ff7ab0af4fabbc99a28907620550c9 (diff) | |
download | otp-f90751b9f766a0155aaaa6fe22bc925f3a9874e2.tar.gz otp-f90751b9f766a0155aaaa6fe22bc925f3a9874e2.tar.bz2 otp-f90751b9f766a0155aaaa6fe22bc925f3a9874e2.zip |
Merge branch 'kostis/hipe-tests-bs/OTP-11748'
* kostis/hipe-tests-bs/OTP-11748:
Up the time limit (globally) for some slow machines
Add check so that tests are skipped if HiPE is not available
Add a Makefile for the HiPE tests
Add tests for the HiPE compiler (Part 1: binaries and bitstrings)
Diffstat (limited to 'lib/hipe/test/bs_SUITE_data/bs_bugs_R08.erl')
-rw-r--r-- | lib/hipe/test/bs_SUITE_data/bs_bugs_R08.erl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/hipe/test/bs_SUITE_data/bs_bugs_R08.erl b/lib/hipe/test/bs_SUITE_data/bs_bugs_R08.erl new file mode 100644 index 0000000000..7b62a17cfb --- /dev/null +++ b/lib/hipe/test/bs_SUITE_data/bs_bugs_R08.erl @@ -0,0 +1,32 @@ +%% -*- erlang-indent-level: 2 -*- +%%------------------------------------------------------------------- +%% When executing this in R8 (and compiled with R8) the result was +%% {ok,[148,129,0,0]} but should be {ok,[145,148,113,129,0,0,0,0]} +%% Thanks to Kenneth Lundin for sending this to us. +%%------------------------------------------------------------------- + +-module(bs_bugs_R08). + +-export([test/0]). + +test() -> + List = [145,148,113,129,0,0,0,0], + {ok, List} = msisdn_internal_storage(<<145,148,113,129,0,0,0,0>>, []), + ok. + +%% msisdn_internal_storage/3 +%% Convert MSISDN binary to internal datatype (TBCD-octet list) + +msisdn_internal_storage(<<>>, MSISDN) -> + {ok, lists:reverse(MSISDN)}; +msisdn_internal_storage(<<2#11111111:8,_Rest/binary>>, MSISDN) -> + {ok, lists:reverse(MSISDN)}; +msisdn_internal_storage(<<2#1111:4,DigitN:4,_Rest/binary>>, MSISDN) when + DigitN < 10 -> + {ok, lists:reverse([(DigitN bor 2#11110000)|MSISDN])}; +msisdn_internal_storage(<<DigitNplus1:4,DigitN:4,Rest/binary>>, MSISDN) when + DigitNplus1 < 10, DigitN < 10 -> + NewMSISDN = [((DigitNplus1 bsl 4) bor DigitN)|MSISDN], + msisdn_internal_storage(Rest, NewMSISDN); +msisdn_internal_storage(_Rest, _MSISDN) -> + {fault}. %% Mandatory IE incorrect |