diff options
author | Gustav Simonsson <[email protected]> | 2012-07-11 14:37:31 +0200 |
---|---|---|
committer | Gustav Simonsson <[email protected]> | 2012-07-11 14:37:31 +0200 |
commit | cf6ecce1921a7ebbbbf428188a67aabb48566df8 (patch) | |
tree | bb4a5413f6c0ff7ce68dd68cb94135c6c087f8d1 /lib/asn1/test | |
parent | 7a70f331e65e831585afa195bf29ef7d823e55f6 (diff) | |
download | otp-cf6ecce1921a7ebbbbf428188a67aabb48566df8.tar.gz otp-cf6ecce1921a7ebbbbf428188a67aabb48566df8.tar.bz2 otp-cf6ecce1921a7ebbbbf428188a67aabb48566df8.zip |
Add support for extensible enumeration types in n2n
generated functions.
OTP-10144
Diffstat (limited to 'lib/asn1/test')
-rw-r--r-- | lib/asn1/test/asn1_SUITE.erl | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 10b929b2a9..e9b680d1be 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -1238,18 +1238,25 @@ testName2Number(Config) -> 'unknown-PLMN' = 'S1AP-IEs':num2name_CauseMisc(5), %% OTP-10144 - %% Test that n2n option generates name2num and num2name functions that - %% do not crash on values not within the extension root if the enumeration - %% type has an extension marker. - %% Also, previously name2num and num2name was only generated if the type - %% had an extension marker. So we also tests to check this. + %% Test that n2n option generates name2num and num2name functions supporting + %% values not within the extension root if the enumeration type has an + %% extension marker. N2NOptionsExt = [{n2n, 'NoExt'}, {n2n, 'Ext'}, {n2n, 'Ext2'}], asn1_test_lib:compile("EnumN2N", Config, N2NOptionsExt), + %% Previously, name2num and num2name was not generated if the type didn't + %% have an extension marker: 0 = 'EnumN2N':name2num_NoExt('blue'), 2 = 'EnumN2N':name2num_NoExt('green'), blue = 'EnumN2N':num2name_NoExt(0), green = 'EnumN2N':num2name_NoExt(2), - + + %% Test enumeration extension: + 7 = 'EnumN2N':name2num_Ext2('orange'), + orange = 'EnumN2N':num2name_Ext2(7), + %% 7 is not defined in Ext, only in Ext2. + {asn1_enum, 7} = 'EnumN2N':num2name_Ext(7), + 7 = 'EnumN2N':name2num_Ext({asn1_enum, 7}), + 42 = 'EnumN2N':name2num_Ext2({asn1_enum, 42}), ok. ticket_7407(Config) -> |