2
2
3
3
# Test nqp::op pseudo-functions.
4
4
5
- plan (254 );
5
+ plan (257 );
6
6
7
7
ok ( nqp ::add_i(5 ,2 ) == 7 , ' nqp::add_i' );
8
8
ok ( nqp ::sub_i(5 ,2 ) == 3 , ' nqp::sub_i' );
@@ -321,6 +321,8 @@ ok(nqp::getcomp("noSuchLanguageEver1")[0] eq "compiler1", "nqp::getcomp");
321
321
my $ b := nqp ::list_i(1 ,2 ,30.4 );
322
322
ok (nqp ::atpos_i($ b ,2 ) == 30 , ' atpos_i' );
323
323
324
+ ok (nqp ::atpos_i($ b , -2 ) == 2 , ' atpos_i with negative index' );
325
+
324
326
ok (nqp ::atpos_i($ b , 100 ) == 0 , ' nqp::atpos_i ouside of array' );
325
327
326
328
@@ -344,6 +346,7 @@ ok(nqp::getcomp("noSuchLanguageEver1")[0] eq "compiler1", "nqp::getcomp");
344
346
my $ b := nqp ::list_s(" A" ," B" ," C" );
345
347
ok (nqp ::bindpos_s($ b , 2 , " D" ), ' nqp::bindpos_s' );
346
348
ok (nqp ::atpos_s($ b ,2 ) eq " D" , ' nqp::atpos_s' );
349
+ ok (nqp ::atpos_s($ b , -2 ) eq " B" , ' nqp::atpos_s with negative index' );
347
350
ok (nqp ::isnull_s(nqp ::atpos_s($ a , 10 )), ' nqp::atpos_s with element outside of array' );
348
351
}
349
352
@@ -366,6 +369,7 @@ ok(nqp::getcomp("noSuchLanguageEver1")[0] eq "compiler1", "nqp::getcomp");
366
369
nqp ::bindpos_n($ c , 1 , 103.5 );
367
370
nqp ::bindpos_n($ c , 0 , 101 );
368
371
ok (nqp ::atpos_n($ c , 1 ) == 103.5 , ' bindpos_n works' );
372
+ ok (nqp ::atpos_n($ c , -1 ) == 103.5 , ' nqp::atpos_n with negative index' );
369
373
ok (nqp ::atpos_n($ c , 10 ) == 0.0 , ' atpos_n with element outside of the array' );
370
374
371
375
}
0 commit comments