From 33b19f4ed08f84459ed762dbb50ea0cf148ebfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 2 Sep 2014 13:16:53 +0200 Subject: Rewrite matching of object definitions using the simplified syntax Rewrite the confusing and buggy matching of an object definition against the simplified syntax. While we are at it, we will also add proper error handling. --- lib/asn1/test/testInfObjExtract.erl | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'lib/asn1/test/testInfObjExtract.erl') diff --git a/lib/asn1/test/testInfObjExtract.erl b/lib/asn1/test/testInfObjExtract.erl index 4e148824fe..d3ea368391 100644 --- a/lib/asn1/test/testInfObjExtract.erl +++ b/lib/asn1/test/testInfObjExtract.erl @@ -23,17 +23,31 @@ -export([main/0]). main() -> - roundtrip('DataSeq-1', {'DataSeq-1',1,true}), - roundtrip('DataSeq-1', {'DataSeq-1',2,<<"abc">>}), - roundtrip('DataSeq-1', {'DataSeq-1',3,<<42:5>>}), - roundtrip_error('DataSeq-1', {'DataSeq-1',4,42}), - - roundtrip('DataSeq-2', {'DataSeq-2',1,true}), - roundtrip_error('DataSeq-2', {'DataSeq',2,<<"abc">>}), - roundtrip_error('DataSeq-2', {'DataSeq',3,<<42:5>>}), - roundtrip_error('DataSeq-2', {'DataSeq',999,42}), + roundtrip_data_object_13('DataSeq-1'), + + roundtrip_data_object_1('DataSeq-2'), + roundtrip_data_object_1('DataSeq-3'), + roundtrip_data_object_1('DataSeq-4'), + + roundtrip_data_object_13('DataSeq-5'), + roundtrip_data_object_13('DataSeq-6'), + ok. +roundtrip_data_object_13(SeqType) -> + roundtrip(SeqType, {SeqType,1,true}), + roundtrip(SeqType, {SeqType,2,<<"abc">>}), + roundtrip(SeqType, {SeqType,3,<<42:5>>}), + roundtrip_error(SeqType, {SeqType,4,42}). + +roundtrip_data_object_1(SeqType) -> + roundtrip(SeqType, {SeqType,1,false}), + roundtrip(SeqType, {SeqType,1,true}), + roundtrip_error(SeqType, {SeqType,1,42}), + roundtrip_error(SeqType, {SeqType,2,<<"abc">>}), + roundtrip_error(SeqType, {SeqType,3,<<42:5>>}), + roundtrip_error(SeqType, {SeqType,999,42}). + roundtrip(T, V) -> asn1_test_lib:roundtrip('InfObjExtract', T, V). -- cgit v1.2.3