1#!perl 2BEGIN { 3 chdir 't'; 4 unshift @INC, "../lib"; 5} 6 7use strict; 8require './test.pl'; 9use Config qw(%Config); 10 11$ENV{PERL_TEST_MEMORY} >= 1 12 or skip_all("Need ~1Gb for this test"); 13$Config{ptrsize} >= 8 14 or skip_all("Need 64-bit pointers for this test"); 15 16plan(7); 17 18# RT #111730: Negative offset to vec in lvalue context 19 20my $v = ""; 21ok(scalar eval { vec($v, 0x80000000, 1) = 1 }, "set a bit at a large offset"); 22ok(vec($v, 0x80000000, 1), "check a bit at a large offset"); 23 24ok(scalar eval { vec($v, 0x100000000, 1) = 1 }, 25 "set a bit at a larger offset"); 26ok(vec($v, 0x100000000, 1), "check a bit at a larger offset"); 27 28# real out of range values 29ok(!eval { vec($v, -0x80000000, 1) = 1 }, 30 "shouldn't be able to set at a large negative offset"); 31ok(!eval { vec($v, -0x100000000, 1) = 1 }, 32 "shouldn't be able to set at a larger negative offset"); 33 34ok(!vec($v, 0, 1), "make sure we didn't wrap"); 35