diff options
author | Adam Lindberg <[email protected]> | 2012-02-16 15:51:37 +0100 |
---|---|---|
committer | Adam Lindberg <[email protected]> | 2012-02-29 14:42:22 +0100 |
commit | 9ec0a0babace0932d78accf7c10b237a32dc801c (patch) | |
tree | 2d4a8e515a13497611631b0ed6cd787341ace27b /lib/asn1/test/test_undecoded_rest.erl | |
parent | 79d2f2878c950584e56258a3c34724d42a91c631 (diff) | |
download | otp-9ec0a0babace0932d78accf7c10b237a32dc801c.tar.gz otp-9ec0a0babace0932d78accf7c10b237a32dc801c.tar.bz2 otp-9ec0a0babace0932d78accf7c10b237a32dc801c.zip |
[asn1] Refactor test cases and remove extra suites
Diffstat (limited to 'lib/asn1/test/test_undecoded_rest.erl')
-rw-r--r-- | lib/asn1/test/test_undecoded_rest.erl | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/lib/asn1/test/test_undecoded_rest.erl b/lib/asn1/test/test_undecoded_rest.erl index 0c248a840a..36fd26ed59 100644 --- a/lib/asn1/test/test_undecoded_rest.erl +++ b/lib/asn1/test/test_undecoded_rest.erl @@ -27,31 +27,27 @@ %% testing OTP-5104 test(Opt, Config) -> - ?line {ok,Msg} = asn1ct:value('P-Record','PersonnelRecord', - [{i, ?config(case_dir, Config)}]), - ?line {ok,Bytes} = asn1_wrapper:encode('P-Record','PersonnelRecord',Msg), - Bytes2 = - fun(B) when is_list(B) -> - B ++ [55,55,55]; - (B) when is_binary(B) -> - iolist_to_binary([B,<<55,55,55>>]) - end (Bytes), - + {ok, Msg} = asn1ct:value('P-Record', 'PersonnelRecord', + [{i, ?config(case_dir, Config)}]), + {ok, Bytes} = asn1_wrapper:encode('P-Record', 'PersonnelRecord', Msg), + Bytes2 = if is_list(Bytes) -> + Bytes ++ [55, 55, 55]; + is_binary(Bytes) -> + iolist_to_binary([Bytes, <<55, 55, 55>>]) + end, case Opt of - undec_rest -> - ?line {ok,Msg,R}=asn1_wrapper:decode('P-Record','PersonnelRecord', - Bytes2), - ?line case R of - <<55,55,55>> ->ok; - [55,55,55] -> ok; - BStr when is_bitstring(BStr) -> - PadLen = (8 - (bit_size(BStr) rem 8)) rem 8, - case <<0:PadLen,BStr/bitstring>> of - <<0,55,55,55>> -> ok - end - end; - _ -> - ?line {ok,Msg} = asn1_wrapper:decode('P-Record','PersonnelRecord', - Bytes2) + undec_rest -> + {ok, Msg, R} = asn1_wrapper:decode('P-Record', 'PersonnelRecord', + Bytes2), + case R of + <<55, 55, 55>> -> ok; + [55, 55, 55] -> ok; + BStr when is_bitstring(BStr) -> + PadLen = (8 - (bit_size(BStr) rem 8)) rem 8, + <<0, 55, 55, 55>> = <<0:PadLen, BStr/bitstring>> + end; + _ -> + {ok, Msg} = asn1_wrapper:decode('P-Record', 'PersonnelRecord', + Bytes2) end, ok. |