aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/asn1_test_lib.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-06-10 09:30:59 +0200
committerBjörn Gustavsson <[email protected]>2013-06-10 09:30:59 +0200
commita33dbb822acb67cf071e606cd28d15090075202f (patch)
treed2d0500960450f46bdc72261ee72aad2d8aa70aa /lib/asn1/test/asn1_test_lib.erl
parent3785a3b673a3530c94b9ee3dc053dcb07b71e62f (diff)
parentac851623b548ac13ffc933516dae9db98626f0fe (diff)
downloadotp-a33dbb822acb67cf071e606cd28d15090075202f.tar.gz
otp-a33dbb822acb67cf071e606cd28d15090075202f.tar.bz2
otp-a33dbb822acb67cf071e606cd28d15090075202f.zip
Merge branch 'bjorn/asn1/not-small-bugs/OTP-11153' into maint
* bjorn/asn1/not-small-bugs/OTP-11153: PER/UPER: Correct decoding of SEQUENCEs with more than 64 extensions testConstraints: Improve tests of semi-constrained INTEGERs Test ENUMERATED with many extended values UPER: Correct encoding of ENUMERATED with more than 63 extended values Add asn1_test_lib:hex_to_bin/1
Diffstat (limited to 'lib/asn1/test/asn1_test_lib.erl')
-rw-r--r--lib/asn1/test/asn1_test_lib.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl
index b839dfcf2a..7d7364e2a4 100644
--- a/lib/asn1/test/asn1_test_lib.erl
+++ b/lib/asn1/test/asn1_test_lib.erl
@@ -22,6 +22,7 @@
-export([compile/3]).
-export([compile_all/3]).
-export([compile_erlang/3]).
+-export([hex_to_bin/1]).
-export([ticket_7407_compile/2,ticket_7407_code/1, ticket_7678/2,
ticket_7708/2, ticket_7763/1, ticket_7876/3]).
@@ -61,6 +62,13 @@ compile_erlang(Mod, Config, Options) ->
{ok, M} = compile:file(filename:join(DataDir, Mod),
[report,{i,CaseDir},{outdir,CaseDir}|Options]).
+hex_to_bin(S) ->
+ << <<(hex2num(C)):4>> || C <- S, C =/= $\s >>.
+
+%%%
+%%% Internal functions.
+%%%
+
should_load(File, Options) ->
case lists:member(abs, Options) of
true ->
@@ -79,6 +87,10 @@ strip_extension(File, Ext) when Ext == ".asn"; Ext == ".set"; Ext == ".asn1"->
strip_extension(File, _Ext) ->
File.
+hex2num(C) when $0 =< C, C =< $9 -> C - $0;
+hex2num(C) when $A =< C, C =< $F -> C - $A + 10;
+hex2num(C) when $a =< C, C =< $f -> C - $a + 10.
+
ticket_7407_compile(Config,Option) ->
?line DataDir = ?config(data_dir,Config),