1# -*- perl -*- 2 3# Copyright (c) 2007 by Jeff Weisberg 4# Author: Jeff Weisberg <jaw+pause @ tcp4me.com> 5# Created: 2007-Feb-10 16:42 (EST) 6# Function: dumper test 7# 8# $Id: t3.t,v 1.3 2015/12/15 20:28:44 jaw Exp $ 9 10use lib 'lib'; 11use Encoding::BER::Dumper; 12use strict; 13 14print "1..5\n"; 15my $tno = 1; 16 17my $b = pl2ber([ 18 0, 1, 2, 3, 19 { foo => 'a' }, 20 undef ]); 21 22my $expect = '301802010002010102010202010363080403666f6f0401610500'; 23 24$expect =~ s/\s//gs; 25$expect = pack('H*', $expect); 26 27test( $expect eq $b); 28 29my $d = ber2pl($b); 30 31test( @$d == 6 ); 32test( $d->[2] == 2 ); 33test( $d->[4]{foo} eq 'a'); 34test( ! defined $d->[5] ); 35 36sub test { 37 my $ok = shift; 38 39 print(($ok ? "ok" : "not ok"), " ", $tno++, "\n"); 40} 41