PATCH: Large omnibus patch to clean up the JRRT quotes
[p5sagit/p5-mst-13.2.git] / ext / Encode / t / grow.t
CommitLineData
26b787bb 1#!../perl
2our $POWER;
3BEGIN {
4 if ($ENV{'PERL_CORE'}){
5 chdir 't';
6 unshift @INC, '../lib';
7 }
8 require Config; import Config;
9 if ($Config{'extensions'} !~ /\bEncode\b/) {
10 print "1..0 # Skip: Encode was not built\n";
11 exit 0;
12 }
13 $POWER = 12; # up to 1 MB. You may adjust the figure here
14}
15
16use strict;
17use Encode;
18
19my $seed = "";
20for my $i (0x00..0xff){
21 my $c = chr($i);
22 $seed .= ($c =~ /^\p{IsPrint}/o) ? $c : " ";
23}
24
25use Test::More tests => $POWER*2;
26my $octs = $seed;
27use bytes ();
28for my $i (1..$POWER){
29 $octs .= $octs;
30 my $len = bytes::length($octs);
31 my $utf8 = Encode::decode('latin1', $octs);
32 ok(1, "decode $len bytes");
33 is($octs,
34 Encode::encode('latin1', $utf8),
35 "encode $len bytes");
36}
37__END__
38
39