File: grow.t

package info (click to toggle)
libencode-perl 2.63-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 10,944 kB
  • ctags: 220
  • sloc: perl: 4,185; ansic: 120; makefile: 7
file content (39 lines) | stat: -rw-r--r-- 820 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!../perl
our $POWER;
BEGIN {
     if ($ENV{'PERL_CORE'}){
         chdir 't';
         unshift @INC, '../lib';
     }
     require Config; import Config;
     if ($Config{'extensions'} !~ /\bEncode\b/) {
         print "1..0 # Skip: Encode was not built\n";
             exit 0;
     }
     $POWER = 12; # up to 1 MB.  You may adjust the figure here
}

use strict;
use Encode;

my $seed = "";
for my $i (0x00..0xff){
     my $c = chr($i);
     $seed .= ($c =~ /^\p{IsPrint}/o) ? $c : " ";
}

use Test::More tests => $POWER*2;
my $octs = $seed;
use bytes ();
for my $i (1..$POWER){
     $octs .= $octs;
     my $len = bytes::length($octs);
     my $utf8 = Encode::decode('latin1', $octs);
     ok(1, "decode $len bytes");
     is($octs,
        Encode::encode('latin1', $utf8),
        "encode $len bytes");
}
__END__