From: Graham B. <gb...@us...> - 2002-02-10 16:12:20
|
Update of /cvsroot/perl-ldap/asn/t In directory usw-pr-cvs1:/tmp/cvs-serv8950/t Modified Files: 00prim.t 03seqof.t Log Message: Add support for units with one sinlge, unamed entry eg test ::= INTEGER or list ::= SEQUENCE OF OCTET STRING Index: 00prim.t =================================================================== RCS file: /cvsroot/perl-ldap/asn/t/00prim.t,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- 00prim.t 22 Sep 2001 00:16:49 -0000 1.6 +++ 00prim.t 10 Feb 2002 16:12:17 -0000 1.7 @@ -6,7 +6,7 @@ use Convert::ASN1 qw(:all); -print "1..146\n"; +print "1..150\n"; BEGIN { require 't/funcs.pl' } @@ -93,6 +93,14 @@ ntest $test++, $val, $ret->{integer}; } + +btest $test++, $asn->prepare('test ::= INTEGER '); + +$result = pack("C*", 0x02, 0x01, 0x09); + +stest $test++, $result, $asn->encode(9); +btest $test++, $ret = $asn->decode($result); +btest $test++, $ret == 9; ## ## STRING Index: 03seqof.t =================================================================== RCS file: /cvsroot/perl-ldap/asn/t/03seqof.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 03seqof.t 21 Sep 2001 22:24:44 -0000 1.2 +++ 03seqof.t 10 Feb 2002 16:12:17 -0000 1.3 @@ -8,7 +8,7 @@ use Convert::ASN1; -print "1..29\n"; +print "1..35\n"; btest 1, $asn = Convert::ASN1->new; btest 2, $asn->prepare(' ints SEQUENCE OF INTEGER '); @@ -106,3 +106,15 @@ stest 27, 'b', $ret->{issuer}{rdnSequence}[0][1]{value}; stest 28, 'c', $ret->{issuer}{rdnSequence}[1][0]{value}; stest 29, 'd', $ret->{issuer}{rdnSequence}[1][1]{value}; + + +btest 30, $asn = Convert::ASN1->new; +btest 31, $asn->prepare('test ::= SEQUENCE OF INTEGER '); + +$result = pack("C*", 0x30, 0x0C, 0x02, 0x01, 0x09, 0x02, 0x01, 0x05, + 0x02, 0x01, 0x03, 0x02, 0x01, 0x01); + +stest 32, $result, $asn->encode([9,5,3,1]); +btest 33, $ret = $asn->decode($result); +btest 34, ref($ret) eq 'ARRAY'; +stest 35, "9:5:3:1", join(":", @{$ret}); |