diff options
| author | Björn Gustavsson <bjorn@erlang.org> | 2022-09-12 05:50:38 +0200 |
|---|---|---|
| committer | Björn Gustavsson <bjorn@erlang.org> | 2022-09-14 09:05:01 +0200 |
| commit | 8b0548f1f31704651145d9847e8b4df591d65a9c (patch) | |
| tree | cad89dee3978783fbeda59eccaf24c1ace10e0f2 /lib/asn1/test | |
| parent | 0863bd30aabd035c83158c78046c5ffda16127e1 (diff) | |
| download | erlang-8b0548f1f31704651145d9847e8b4df591d65a9c.tar.gz | |
asn1: Support SEQUENCE OF with 16384 or more items
Implement support for the `per` and `uper` ASN.1 encoding to
handle encoding and decoding of SEQUENCE OF/SET OF with 16384
or more items.
Diffstat (limited to 'lib/asn1/test')
| -rw-r--r-- | lib/asn1/test/asn1_SUITE_data/Fragmented.asn1 | 9 | ||||
| -rw-r--r-- | lib/asn1/test/testFragmented.erl | 30 |
2 files changed, 39 insertions, 0 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/Fragmented.asn1 b/lib/asn1/test/asn1_SUITE_data/Fragmented.asn1 index bfc939737f..e784feff8c 100644 --- a/lib/asn1/test/asn1_SUITE_data/Fragmented.asn1 +++ b/lib/asn1/test/asn1_SUITE_data/Fragmented.asn1 @@ -21,4 +21,13 @@ PDU ::= SEQUENCE { arg FUNCTION.&ArgumentType ({ObjSet}{@code}) } +IntBoolSeqs ::= SEQUENCE (SIZE (1..65536)) OF IntBoolSeq + +IntBoolSeqsU ::= SEQUENCE OF IntBoolSeq + +IntBoolSeq ::= SEQUENCE { + a INTEGER, + b BOOLEAN +} + END diff --git a/lib/asn1/test/testFragmented.erl b/lib/asn1/test/testFragmented.erl index bd63bd83fc..fe23b13d3a 100644 --- a/lib/asn1/test/testFragmented.erl +++ b/lib/asn1/test/testFragmented.erl @@ -36,7 +36,37 @@ main(_Erule) -> K8,K8,K8,K8,K8,K8]}), roundtrip('PDU', {'PDU',1,false,[K8,K8,K8,K8,K8,K8,K8,K8, K8,K8,K8,K8,K8,K8,K8,K8]}), + + K16 = 16384, + K64 = 4 * K16, + K144 = 2 * K64 + K16, + roundtrips([1, 2, 3, 17, + K16-1, K16, K16+1, + 2*K16-1, 2*K16, 2*K16+1, + 3*K16-1, 3*K16, 3*K16+1, + K64-1, K64, K64+1, + K64+K16, + K144-1, K144, K144+1]), + ok. + +roundtrips([Size|Sizes]) -> + L = make_seq(Size, []), + io:format("~p: ~P\n", [Size,L,6]), + roundtrip('IntBoolSeqsU', L), + if + Size =< 65536 -> + roundtrip('IntBoolSeqs', L); + true -> + ok + end, + roundtrips(Sizes); +roundtrips([]) -> ok. roundtrip(T, V) -> asn1_test_lib:roundtrip('Fragmented', T, V). + +make_seq(0, Acc) -> + Acc; +make_seq(N, Acc) -> + make_seq(N - 1, [{'IntBoolSeq',N,N rem 7 =:= 0}|Acc]). |
