Skip to content

Commit

Permalink
test method forms of uni functions
Browse files Browse the repository at this point in the history
  • Loading branch information
TimToady committed Apr 17, 2015
1 parent 347b68e commit fe2c47b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
12 changes: 11 additions & 1 deletion S15-unicode-information/unimatch-general.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 209;
plan 217;

#use unicode :v(6.3)

Expand All @@ -20,6 +20,16 @@ nok unimatch(0x3a, 'Nd'), "0x3a is not Nd";
ok unimatch('β…“', 'No'), "'β…“' is No";
nok unimatch('β…“', 'Nd'), "'β…“' is not Nd";

nok 0x29.uniname('Nd'), "0x29 is not Nd";
ok 0x30.uniname('Nd'), "0x30 is Nd";
ok '0'.uniname('Nd'), "'0' is Nd";
ok 0x39.uniname('Nd'), "0x39 is Nd";
ok '9'.uniname('Nd'), "'9' is Nd";
nok 0x3a.uniname('Nd'), "0x3a is not Nd";

ok 'β…“'.uniname('No'), "'β…“' is No";
nok 'β…“'.uniname('Nd'), "'β…“' is not Nd";

ok unimatch("\c[AEGEAN NUMBER NINETY THOUSAND]", 'No'), "AEGEAN NUMBER NINETY THOUSAND is No";
ok unimatch("\c[MATHEMATICAL MONOSPACE DIGIT ZERO]", 'Nd'), "MATHEMATICAL MONOSPACE DIGIT ZERO is Nd";

Expand Down
10 changes: 8 additions & 2 deletions S15-unicode-information/uniname.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ use v6;

use Test;

plan 24;
plan 26;

# Unicode version pragma not needed here, as names cannot change.

# L<S15/Character Name>

# method forms
#?niecza 2 skip "uniname NYI"
is 0x30.uniname, "DIGIT ZERO", "method uniname returns a name";
is "0".uniname, "DIGIT ZERO", "method uniname works in string form";

#?niecza 24 skip "uniname NYI"

is uniname(0x30), "DIGIT ZERO", "uniname returns a name";
Expand Down Expand Up @@ -43,5 +48,6 @@ is uniname("ΒΆ", :either :one), "PARAGRAPH SIGN", "uniname(:eithe
is uniname("\x[2028]", :either :one), "LINE SEPARATOR", "uniname(:either :one) returns current Unicode name for formatting character.";
is uniname("\x[80]", :either :one), "<control-0080>", "uniname(:either :one) returns codepoint label for control character without any name.";

#?rakudo skip "uninames NYI"
#?rakudo 2 skip "uninames NYI"
is uninames("AB"), ("LATIN CAPITAL LETTER A", "LATIN CAPITAL LETTER B"), "uninames correctly works on every character";
is "AB".uninames, ("LATIN CAPITAL LETTER A", "LATIN CAPITAL LETTER B"), "uninames correctly works on every character";
11 changes: 10 additions & 1 deletion S15-unicode-information/unival.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 25;
plan 32;

#use unicode :v(6.3);

Expand All @@ -19,6 +19,15 @@ is unival('9'), 9, "'9' has numeric value 9";
is unival('β…“').WHAT.gist, '(Rat)', "'β…“' is a Rat";
is unival('β…“'), 1/3, "'β…“' has the value 1/3";

is 0x30.unival.WHAT.gist, '(Int)', "0x30 is Int";
is 0x30.unival, 0, "0x30 has numeric value 0";
is '0'.unival, 0, "'0' has numeric value 0";
is 0x39.unival, 9, "0x39 has numeric value 9";
is '9'.unival, 9, "'9' has numeric value 9";

is 'β…“'.unival.WHAT.gist, '(Rat)', "'β…“' is a Rat";
is 'β…“'.unival, 1/3, "'β…“' has the value 1/3";

is unival("\c[VULGAR FRACTION ONE TENTH]").WHAT.gist, '(Rat)', "'β…’' is a Rat";
is unival('β…’'), 1/10, "'β…’' has the value 1/10";

Expand Down

0 comments on commit fe2c47b

Please sign in to comment.