Skip to content

Commit

Permalink
Unfudge Unicode numbers tests for moar
Browse files Browse the repository at this point in the history
  • Loading branch information
ShimmerFairy committed Aug 15, 2015
1 parent bbe6a8c commit 9717b4f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions S15-literals/numbers.t
Expand Up @@ -5,18 +5,18 @@ use Test;
plan 41;

# basic test of literals
#?rakudo 2 skip "is not a valid number"
#?rakudo.jvm 2 skip "is not a valid number"
is ໑໐, 10, "Can use non-ASCII numbers";
is 10, ໑໐, "Can use non-ASCII numbers";

# expression tests
#?rakudo 3 skip "is not a valid number"
#?rakudo.jvm 3 skip "is not a valid number"
is ٢ * ٤٢, 84, "Non-ASCII numbers can be used in expressions";
is 42 + ٤٢, 84, "Non-ASCII numbers can be mixed with ASCII numbers";
is 42 * 2, ٨٤, "ASCII-only expression can be succesfully compared to non-ASCII number";

# mixed numbers
#?rakudo 2 skip "is not a valid number"
#?rakudo.jvm 2 skip "is not a valid number"
is ᱄2, 42, "Can mix scripts in one number";
is 4᱂, 42, "Can mix scripts in one number";

Expand All @@ -31,31 +31,31 @@ eval-dies-ok("say ⓿", "Numerals in category 'No' not allowed as numeric litera

# binary
is 0b101010, 42, "ASCII binary literals work";
#?rakudo 2 skip "Confused"
#?rakudo.jvm 2 skip "Confused"
is 0b༡༠༡༠༡༠, 42, "Non-ASCII binary literals work";
is 0b༡༠༡010, 42, "Binary literals with a mixture of scripts work";
eval-dies-ok("say 0b¹0", "Numerals in category 'No' can't be used in binary literals");
eval-dies-ok("say 0b1〇", "Numerals in category 'Nl' can't be used in binary literals");

# octal
is 0o755, 493, "ASCII octal literals work";
#?rakudo 2 skip "Confused"
#?rakudo.jvm 2 skip "Confused"
is 0o᠗᠕᠕, 493, "Non-ASCII octal literals work";
is 0o᠗5᠕, 493, "Octal literals with a mixture of scripts work";
eval-dies-ok("say 0o7₅₅", "Numerals in category 'No' can't be used in octal literals");
eval-dies-ok("say 0oⅦ55", "Numerals in category 'Nl' can't be used in octal literals");

# hexadecimal
is 0x42, 66, "ASCII hexadecimal literals work";
#?rakudo 2 skip "Confused"
#?rakudo.jvm 2 skip "Confused"
is 0x๔๒, 66, "Non-ASCII hexadecimal literals work";
is 0x๔2, 66, "Hexadecimal literals with a mixture of scripts work";
eval-dies-ok("say 0x④2", "Numerals in category 'No' can't be used in hexadecimal literals");
eval-dies-ok("say 0x4〢", "Numerals in category 'Nl' can't be used in hexadecimal literals");

is 0xCAFE, 51966, "Uppercase ASCII letters work in hexadecimal literals";
is 0xcafe, 51966, "Lowercase ASCII letters work in hexadecimal literals";
#?rakudo 3 skip "Confused"
#?rakudo.jvm 3 skip "Confused"
is 0xCAFE, 51966, "Uppercase fullwidth letters work in hexadecimal literals";
is 0xcafe, 51966, "Lowercase fullwidth letters work in hexadecimal literals";
is 0xCaFe, 51966, "Valid Hex_Digit characters from different scripts can be mixed in hexadecimal literals";
Expand All @@ -65,14 +65,14 @@ eval-dies-ok("say 0xC𐏓FE", "Numerals in category 'Nl' can't be used in hexade

# generic radices
is :36<Unicodez>, 2402100600299, "ASCII letters work in general radix numbers";
#?rakudo 2 skip "Malformed radix number"
#?rakudo.jvm 2 skip "Malformed radix number"
is :36<Unicodez>, 2402100600299, "Fullwidth letters work in general radix numbers";
is :36<Unicodez>, 2402100600299, "Mixture of ASCII and fullwidth letters work in general radix numbers";
eval-dies-ok("say :36<αω>", "Scripts without Hex_Digit characters not allowed in general radix numbers");

#?rakudo 1 skip "Malformed radix number"
#?rakudo.jvm 1 skip "Malformed radix number"
is :36<utf១៦>, 51760986, "Nd numerals can be used in general radix numbers";
eval-dies-ok("say :36<utfⅧ>", "Nl numerals are not allowed in general radix numbers");
eval-dies-ok("say :36<utf㉜>", "No numerals are not allowed in general radix numbers");

done;
done;

0 comments on commit 9717b4f

Please sign in to comment.