aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/testINSTANCE_OF.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-09-13 12:56:06 +0200
committerBjörn Gustavsson <[email protected]>2013-09-18 11:45:01 +0200
commitb379d700e1450a3fc7e76bb75369fa6b5eb2d327 (patch)
tree88a7ef2503b735b8cf8f51444e472facbcc2db5a /lib/asn1/test/testINSTANCE_OF.erl
parentb8f57af261d72f9f078ddf7190201209dd846d53 (diff)
downloadotp-b379d700e1450a3fc7e76bb75369fa6b5eb2d327.tar.gz
otp-b379d700e1450a3fc7e76bb75369fa6b5eb2d327.tar.bz2
otp-b379d700e1450a3fc7e76bb75369fa6b5eb2d327.zip
Eliminate the use of asn1_wrapper
The asn1_wrapper made some sense when encode functions could either produce a list or a binary, depending on the backend. Now encode functions always produce a binary. To improve readbility of the test suites, eliminate the asn1_wrapper functions by replacing them with calls to one of the roundtrip functions in asn1_test_lib. When it is not possible to use the roundtrip functions, call the module in question directly. While at it, also remove ?line macros that are near to the touched code and use asn1_test_lib:hex_to_bin/1 instead of home-brewn hex conversion routines.
Diffstat (limited to 'lib/asn1/test/testINSTANCE_OF.erl')
-rw-r--r--lib/asn1/test/testINSTANCE_OF.erl43
1 files changed, 10 insertions, 33 deletions
diff --git a/lib/asn1/test/testINSTANCE_OF.erl b/lib/asn1/test/testINSTANCE_OF.erl
index ce411beb92..c855ca3c06 100644
--- a/lib/asn1/test/testINSTANCE_OF.erl
+++ b/lib/asn1/test/testINSTANCE_OF.erl
@@ -18,46 +18,23 @@
%%
%%
-module(testINSTANCE_OF).
-
-export([main/1]).
-include_lib("test_server/include/test_server.hrl").
-main(Erule) ->
+main(_Erule) ->
+ Int = roundtrip('Int', 3),
- ?line {ok,Integer} = asn1_wrapper:encode('INSTANCEOF','Int',3),
- Int = list_to_binary(Integer),
ValotherName = {otherName,{'INSTANCE OF',{2,4},Int}},
+ _ = roundtrip('GeneralName', ValotherName),
+
VallastName1 = {lastName,{'GeneralName_lastName',{2,4},12}},
+ _ = roundtrip('GeneralName', VallastName1),
+
VallastName2 = {lastName,{'GeneralName_lastName',{2,3,4},
{'Seq',12,true}}},
- ?line {ok,BytesoN}=
- asn1_wrapper:encode('INSTANCEOF','GeneralName',ValotherName),
- ?line {ok,Res1={otherName,_}} =
- asn1_wrapper:decode('INSTANCEOF','GeneralName',BytesoN),
- ?line ok = test_encdec(Erule,Int,Res1),
-
- ?line {ok,ByteslN1}=
- asn1_wrapper:encode('INSTANCEOF','GeneralName',VallastName1),
- ?line {ok,Res2={lastName,_}} =
- asn1_wrapper:decode('INSTANCEOF','GeneralName',ByteslN1),
- ?line test_encdec(Erule,Res2),
-
- ?line {ok,ByteslN2}=
- asn1_wrapper:encode('INSTANCEOF','GeneralName',VallastName2),
- ?line {ok,Res3={lastName,_}} =
- asn1_wrapper:decode('INSTANCEOF','GeneralName',ByteslN2),
- ?line test_encdec(Erule,Res3).
-
-test_encdec(_Erule,Int,{otherName,{'INSTANCE OF',{2,4},Int}}) ->
- ok;
-test_encdec(Erule,Int,R={otherName,{'INSTANCE OF',{2,4},_Int2}}) ->
- {error,{Erule,Int,R}}.
+ _ = roundtrip('GeneralName', VallastName2),
+ ok.
-test_encdec(_Erule,{lastName,{'GeneralName_lastName',{2,4},12}}) ->
- ok;
-test_encdec(_Erule,{lastName,{'GeneralName_lastName',{2,3,4},
- {'Seq',12,true}}}) ->
- ok;
-test_encdec(Erule,Res) ->
- {error,{Erule,Res}}.
+roundtrip(T, V) ->
+ asn1_test_lib:roundtrip_enc('INSTANCEOF', T, V).