8 eval { require Encode; Encode->import(); };
11 print "1..0 # Skip: Encode is not available\n";
17 exit 0 if $::bomb_out ;
27 #++ $totalBad unless $ok ;
29 print "ok $no\n" if $ok ;
30 print "not ok $no\n" unless $ok ;
38 open (F, "<$filename")
39 or die "Cannot open $filename: $!\n" ;
49 # Check zlib_version and ZLIB_VERSION are the same.
50 ok(1, Compress::Zlib::zlib_version eq ZLIB_VERSION) ;
54 # length of this string is 2 characters
55 my $s = "\x{df}\x{100}";
57 my $cs = Compress::Zlib::memGzip($s);
59 # length stored at end of gzip file should be 4
60 my ($crc, $len) = unpack ("VV", substr($cs, -8, 8));
66 # length of this string is 2 characters
67 my $s = "\x{df}\x{100}";
69 my $cs = Compress::Zlib::memGzip(Encode::encode_utf8($s));
71 # length stored at end of gzip file should be 4
72 my ($crc, $len) = unpack ("VV", substr($cs, -8, 8));
78 my $s = "\x{df}\x{100}";
81 my $cs = compress($s);
82 my $ces = compress(Encode::encode_utf8($s_copy));
86 my $un = uncompress($cs);
89 $un = uncompress($ces);
92 $un = Encode::decode_utf8(uncompress($cs));
98 my $name = "test.gz" ;
99 my $s = "\x{df}\x{100}";
100 my $byte_len = length( Encode::encode_utf8($s) );
103 ok(8, my $fil = gzopen($name, "wb")) ;
105 ok(9, $fil->gzwrite($s) == $byte_len) ;
107 ok(10, ! $fil->gzclose ) ;
109 ok(11, $fil = gzopen($name, "rb") ) ;
111 ok(12, $fil->gzread($uncomp) == $byte_len) ;
112 ok(13, length($uncomp) == $byte_len);
114 ok(14, ! $fil->gzclose ) ;
118 ok(15, $s eq Encode::decode_utf8($uncomp)) ;