Update of /cvsroot/perl-ldap/asn/t
In directory sc8-pr-cvs1:/tmp/cvs-serv12187/t
Modified Files:
08set.t 13utf8.t
Added Files:
12der.t
Log Message:
CER and DER SET encoding
--- NEW FILE: 12der.t ---
#!/usr/local/bin/perl
#
# Test the use of sets
#
use Convert::ASN1;
BEGIN { require 't/funcs.pl' }
print "1..18\n";
btest 1, $asn = Convert::ASN1->new(encoding => 'DER') or warn $asn->error;
btest 2, $asn->prepare(q(
SET {
integer INTEGER,
str STRING,
bool BOOLEAN
}
)) or warn $asn->error;
my $result = pack("C*", 0x31, 0x10, 0x01, 0x01, 0x00, 0x02, 0x01, 0x09,
0x04, 0x08, 0x41, 0x20, 0x73, 0x74, 0x72, 0x69,
0x6E, 0x67
);
stest 3, $result, $asn->encode(integer => 9, bool => 0, str => "A string") or warn $asn->error;
btest 4, $ret = $asn->decode($result) or warn $asn->error;
ntest 5, 9, $ret->{integer};
ntest 6, 0, $ret->{bool};
stest 7, "A string", $ret->{str};
btest 8, $asn = Convert::ASN1->new or warn $asn->error;
btest 9, $asn->prepare(q(
SET {
bool BOOLEAN,
str STRING,
integer INTEGER
}
)) or warn $asn->error;
btest 10, $ret = $asn->decode($result) or warn $asn->error;
ntest 11, 9, $ret->{integer};
ntest 12, 0, $ret->{bool};
stest 13, "A string", $ret->{str};
btest 14, $asn->prepare(q(
SEQUENCE {
true BOOLEAN,
false BOOLEAN
}
)) or warn $asn->error;
$result = pack("C*", 0x30, 0x06, 0x01, 0x01, 0xff, 0x01, 0x01, 0x00);
stest 15, $result, $asn->encode(true => 99, false => 0) or warn $asn->error;
btest 16, $ret = $asn->decode($result) or warn $asn->error;
btest 17, $ret->{true};
btest 18, !$ret->{false};
Index: 08set.t
===================================================================
RCS file: /cvsroot/perl-ldap/asn/t/08set.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- 08set.t 25 Mar 2002 14:59:28 -0000 1.2
+++ 08set.t 6 May 2003 12:40:32 -0000 1.3
@@ -19,7 +19,7 @@
}
)) or warn $asn->error;
-my $result = pack("C*", 0x31, 0x10, 0x02, 0x01, 0x09, 0x01, 0x01, 0x00,
+my $result = pack("C*", 0x31, 0x10, 0x01, 0x01, 0x00, 0x02, 0x01, 0x09,
0x04, 0x08, 0x41, 0x20, 0x73, 0x74, 0x72, 0x69,
0x6E, 0x67
);
Index: 13utf8.t
===================================================================
RCS file: /cvsroot/perl-ldap/asn/t/13utf8.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 13utf8.t 6 May 2003 11:07:18 -0000 1.1
+++ 13utf8.t 6 May 2003 12:40:32 -0000 1.2
@@ -7,7 +7,7 @@
use Convert::ASN1;
BEGIN { require 't/funcs.pl' }
-if ($] < 5.006) {
+if ($] < 5.007) {
print "1..0\n";
exit;
}
@@ -37,8 +37,8 @@
btest 8, $ret = $asn->decode($result) or warn $asn->error;
stest 9, $utf_str, $ret->{str};
-# Test that UTF8String will upgrade on encoding, except in 5.6
-$result = $] > 5.007 ? pack("C*", 0x0c, 0x02, 0xc2, 0x81) : pack("C*", 0x0c, 0x01, 0x81);
+# Test that UTF8String will upgrade on encoding
+$result = pack("C*", 0x0c, 0x02, 0xc2, 0x81);
stest 10, $result, $asn->encode(str => chr(0x81)) or warn $asn->error;
btest 11, $ret = $asn->decode($result) or warn $asn->error;
|