This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Create a block around some code; indent
[perl5.git] / t / bigmem / pos.t
CommitLineData
6174b39a
FC
1#!perl
2BEGIN {
a817e89d 3 chdir 't' if -d 't';
9224f6d1 4 @INC = "../lib";
6174b39a
FC
5 require './test.pl';
6}
7
8use Config qw(%Config);
9
10$ENV{PERL_TEST_MEMORY} >= 2
11 or skip_all("Need ~2Gb for this test");
12$Config{ptrsize} >= 8
13 or skip_all("Need 64-bit pointers for this test");
14
15plan(3);
16
17# [perl #116907]
18# ${\2} to defeat constant folding, which in this case actually slows
19# things down
20my $x=" "x(${\2}**31+20);
21pos $x = 2**31-5;
22is pos $x, 2147483643, 'setting pos on large string';
23pos $x += 10;
24is pos $x, 2147483653, 'reading lvalue pos after setting it > 2**31';
25is scalar(pos $x), 2147483653, 'reading it with pos() in rvalue context';