diff options
author | Björn Gustavsson <[email protected]> | 2014-02-25 09:04:47 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-02-28 11:57:05 +0100 |
commit | 7505ac9334c0e0a62dd81f9e0fdee8a1a5a7eb01 (patch) | |
tree | 27f95fc38661f7ad1346e75be0a94954fadcd4c0 /lib/asn1/test | |
parent | 0e3d94fef11e126b0d772134cd5b3582aa1169f3 (diff) | |
download | otp-7505ac9334c0e0a62dd81f9e0fdee8a1a5a7eb01.tar.gz otp-7505ac9334c0e0a62dd81f9e0fdee8a1a5a7eb01.tar.bz2 otp-7505ac9334c0e0a62dd81f9e0fdee8a1a5a7eb01.zip |
asn1ct_check: Rewrite error checking for INTEGER and BIT STRING
The error checking code for INTEGER and BIT STRING was broken,
since it built an error tuple that was never returned.
Rewrite the error checking code, sharing most of the code between
INTEGER and BIT STRING. Make sure that we test for both duplicated
names and number, as well as for negative bit numbers for
BIT STRING.
This rewrite will eliminate two dialyzer warnings for unmatched
returns.
Diffstat (limited to 'lib/asn1/test')
-rw-r--r-- | lib/asn1/test/error_SUITE.erl | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/lib/asn1/test/error_SUITE.erl b/lib/asn1/test/error_SUITE.erl index 930b44cea6..2e4863301f 100644 --- a/lib/asn1/test/error_SUITE.erl +++ b/lib/asn1/test/error_SUITE.erl @@ -19,7 +19,7 @@ -module(error_SUITE). -export([suite/0,all/0,groups/0, - already_defined/1,enumerated/1,objects/1,values/1]). + already_defined/1,bitstrings/1,enumerated/1,integers/1,objects/1,values/1]). -include_lib("test_server/include/test_server.hrl"). @@ -31,7 +31,9 @@ all() -> groups() -> [{p,parallel(), [already_defined, + bitstrings, enumerated, + integers, objects, values]}]. @@ -70,6 +72,23 @@ already_defined(Config) -> } = run(P, Config), ok. +bitstrings(Config) -> + M = 'Bitstrings', + P = {M, + <<"Bitstrings DEFINITIONS AUTOMATIC TAGS ::= BEGIN\n" + " Bs1 ::= BIT STRING {a(1), a(1)}\n" + " Bs2 ::= BIT STRING {a(1), b(2), a(3)}\n" + " Bs3 ::= BIT STRING {x(1), y(1)}\n" + " Bs4 ::= BIT STRING {x(-1), y(0)}\n" + "END\n">>}, + {error, + [{structured_error,{M,2},asn1ct_check,{namelist_redefinition,a}}, + {structured_error,{M,3},asn1ct_check,{namelist_redefinition,a}}, + {structured_error,{M,4},asn1ct_check,{value_reused,1}}, + {structured_error,{M,5},asn1ct_check,{invalid_bit_number,-1}} + ]} = run(P, Config), + ok. + enumerated(Config) -> M = 'Enumerated', P = {M, @@ -98,6 +117,21 @@ enumerated(Config) -> } = run(P, Config), ok. +integers(Config) -> + M = 'Integers', + P = {M, + <<"Integers DEFINITIONS AUTOMATIC TAGS ::= BEGIN\n" + " Int1 ::= INTEGER {a(1), a(1)}\n" + " Int2 ::= INTEGER {a(1), b(2), a(3)}\n" + " Int3 ::= INTEGER {x(1), y(1)}\n" + "END\n">>}, + {error, + [{structured_error,{M,2},asn1ct_check,{namelist_redefinition,a}}, + {structured_error,{M,3},asn1ct_check,{namelist_redefinition,a}}, + {structured_error,{M,4},asn1ct_check,{value_reused,1}} + ]} = run(P, Config), + ok. + objects(Config) -> M = 'Objects', P = {M, |