Skip to content

Commit

Permalink
Test passing numbers with a unparsed suffix to nqp::radix*
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Dec 10, 2017
1 parent d586ebd commit 4aa561b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion t/nqp/081-radix.t
@@ -1,4 +1,4 @@
plan(26*3*2 + 3);
plan(31*3*2 + 3);

sub test_radix($radix,$str,$pos,$flags,$value,$mult,$offset,$desc) {
my $result := nqp::radix($radix,$str,$pos,$flags);
Expand Down Expand Up @@ -69,3 +69,10 @@ if nqp::getcomp('nqp').backend.name eq 'jvm' {
test_radix_both(16,$full_width_capital,0,2, 51966,65536,4, "fullwidth capital letters");
test_radix_both(16,$full_width_small,0,2, 51966,65536,4, "fullwidth small letters");
}

test_radix_both(8,"8238321",0,2, 0,1,-1, "all digits outside of radix");
test_radix_both(8,"1838321",0,2, 1,8,1, "all but one digits outside of radix");

test_radix_both(10,"123foobar",0,2, 123,1000,3, "no digits consumed with digit outside radix");
test_radix_both(8,"1238321",0,2, 83,512,3, "no digits consumed with digit outside radix");
test_radix_both(8,"-1238321",1,2, 83,512,4, "no digits consumed with digit outside radix");

0 comments on commit 4aa561b

Please sign in to comment.