File: str.t

package info (click to toggle)
perl 5.42.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (44 lines) | stat: -rw-r--r-- 832 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
#!perl
BEGIN {
    chdir 't' if -d 't';
    @INC = "../lib";
    require './test.pl';
}

use Config qw(%Config);

# 2G each for the $p2g, $n2g and $t

$ENV{PERL_TEST_MEMORY} >= 11
    or skip_all("Need ~11Gb for this test");
$Config{ptrsize} >= 8
    or skip_all("Need 64-bit pointers for this test");

my $p = "A";
my $n = ~$p;

my $sz = 0x8000_0001;

my $p2g = ($p x $sz);

is(length $p2g, $sz, "check p2g size");

my $t = ($p x $sz);
ok($t eq $p2g, "check scalar repeat with large count");
undef $t;
my $two = 2; # no constant folding

$t = ($p2g x $two);
ok($t eq "$p2g$p2g", "check scalar repeat with large source");
undef $t;

$t = ~$p2g;
my $n2g = ($n x $sz);

is(length $n2g, $sz, "check p2g size");

# don't risk a 4GB diagnostic if they don't match
ok($t eq $n2g, "string complement very large string");

done_testing();