| 1 |
root |
1.1 |
BEGIN { $| = 1; print "1..4\n"; } |
| 2 |
|
|
|
| 3 |
|
|
# various bugs fixed after 1.0 |
| 4 |
|
|
|
| 5 |
|
|
use common::sense; |
| 6 |
|
|
use Convert::BER::XS ':all'; |
| 7 |
|
|
|
| 8 |
|
|
our $test; |
| 9 |
|
|
sub ok($;$) { |
| 10 |
|
|
print $_[0] ? "" : "not ", "ok ", ++$test, " # $_[1]\n"; |
| 11 |
|
|
} |
| 12 |
|
|
|
| 13 |
|
|
my ($bin, $ber); |
| 14 |
|
|
|
| 15 |
|
|
# length 127 |
| 16 |
|
|
$bin = ber_encode [0, ASN_OCTET_STRING, 0, "\x01" x 127]; |
| 17 |
root |
1.2 |
ok ($bin =~ /^\x04\x7f\x01{127}/, unpack "H*", $bin); |
| 18 |
root |
1.1 |
$ber = ber_decode $bin; |
| 19 |
|
|
ok (127 == length $ber->[BER_DATA]); |
| 20 |
|
|
|
| 21 |
|
|
# internal 0-octet in length |
| 22 |
|
|
$bin = ber_encode [0, ASN_OCTET_STRING, 0, "\x01" x 0x10013]; |
| 23 |
|
|
ok ($bin =~ /^\x04\x83\x01\x00\x13\x01.*$/s, unpack "H*", substr $bin, 0, 64); |
| 24 |
|
|
$ber = ber_decode $bin; |
| 25 |
|
|
ok (0x10013 == length $ber->[BER_DATA]); |