From 78bf2e6ab930212e49a291b9991bd3bfc886bf0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Mon, 25 Feb 2013 08:39:48 +0100
Subject: testInfObj: Introduce roundtrip/3 to simplify the test suite

---
 lib/asn1/test/testInfObj.erl | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

(limited to 'lib/asn1')

diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl
index 03e70c730a..6318bf44b5 100644
--- a/lib/asn1/test/testInfObj.erl
+++ b/lib/asn1/test/testInfObj.erl
@@ -22,8 +22,6 @@
 
 -export([main/1]).
 
--include_lib("test_server/include/test_server.hrl").
-
 -record('InitiatingMessage',{procedureCode,criticality,value}).
 -record('InitiatingMessage2',{procedureCode,criticality,value}).
 -record('Iu-ReleaseCommand',{first,second}).
@@ -34,22 +32,11 @@ main(_Erule) ->
 				value=#'Iu-ReleaseCommand'{
 				  first=13,
 				  second=true}},
-    ?line {ok,Bytes1} = 
-	asn1_wrapper:encode('RANAPextract1','InitiatingMessage',Val1),
-    
-    ?line {ok,{'InitiatingMessage',1,ignore,{'Iu-ReleaseCommand',13,true}}}=
-	asn1_wrapper:decode('RANAPextract1','InitiatingMessage',Bytes1),
-    
-    ?line {ok,Bytes2} =
-	asn1_wrapper:encode('InfObj','InitiatingMessage',Val1),
-    
-    ?line {ok,Val1} =
-	asn1_wrapper:decode('InfObj','InitiatingMessage',Bytes2),
+    roundtrip('RANAPextract1', 'InitiatingMessage', Val1),
+    roundtrip('InfObj', 'InitiatingMessage', Val1),
 
     Val2 = Val1#'InitiatingMessage'{procedureCode=2},
-    
-    ?line {error,_R1} =
-	asn1_wrapper:encode('InfObj','InitiatingMessage',Val2),
+    {error,_R1} = 'InfObj':encode('InitiatingMessage', Val2),
     
 
     %% Test case for OTP-4275
@@ -59,10 +46,9 @@ main(_Erule) ->
 				   first=13,
 				   second=true}},
 
-    ?line {ok,Bytes3} = 
-	asn1_wrapper:encode('RANAPextract1','InitiatingMessage2',Val3),
+    roundtrip('RANAPextract1', 'InitiatingMessage2', Val3).
 
-    
-    ?line {ok,{'InitiatingMessage2',3,reject,{'Iu-ReleaseCommand',13,true}}}=
-	asn1_wrapper:decode('RANAPextract1','InitiatingMessage2',Bytes3).
-    
+roundtrip(M, T, V) ->
+    {ok,Enc} = M:encode(T, V),
+    {ok,V} = M:decode(T, Enc),
+    ok.
-- 
cgit v1.2.3