Skip to content

Commit

Permalink
fudge series tests for Rakudo
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@31450 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Jun 26, 2010
1 parent 7d3e7d2 commit 5c4df0e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions S03-operators/series-nonnumeric.t
Expand Up @@ -5,6 +5,7 @@ plan *;

# L<S03/List infix precedence/'C<.succ> is assumed'>

#?rakudo skip 'loops'
{
class Alternating {
has Int $.val;
Expand Down Expand Up @@ -45,6 +46,7 @@ is (<a b>, { .succ } ... *).[^7].join(', '), 'a, b, c, d, e, f, g', 'characters
is ('x' ... 'z').join(', '), 'x, y, z', "series ending with 'z' don't cross to two-letter strings";
is ('A' ... 'z').elems, 'z'.ord - 'A'.ord + 1, "series from 'A' to 'z' is finite and of correct length";
is ('Ξ±' ... 'Ο‰').elems, 'Ο‰'.ord - 'Ξ±'.ord + 1, "series from 'Ξ±' to 'Ο‰' is finite and of correct length";
#?rakudo 2 skip 'Unicode stuff'
is ('β˜€' ... 'β˜•').join(''), 'β˜€β˜β˜‚β˜ƒβ˜„β˜…β˜†β˜‡β˜ˆβ˜‰β˜Šβ˜‹β˜Œβ˜β˜Žβ˜β˜β˜‘β˜’β˜“β˜”β˜•', "series from 'β˜€' to 'β˜•'";
is ('β˜€' ...^ 'β˜•').join(''), 'β˜€β˜β˜‚β˜ƒβ˜„β˜…β˜†β˜‡β˜ˆβ˜‰β˜Šβ˜‹β˜Œβ˜β˜Žβ˜β˜β˜‘β˜’β˜“β˜”', "exclusive series from 'β˜€' to 'β˜•'";

Expand All @@ -55,6 +57,7 @@ ok ('A' ... 'ZZ').munch(1000).elems < 1000, "'A' ... 'ZZ' does not go on forever
ok ('AA' ... 'Z').munch(1000).elems < 1000, "'AA' ... 'Z' does not go on forever";
ok ('ZZ' ... 'A').munch(1000).elems < 1000, "'ZZ' ... 'A' does not go on forever";
ok ('Z' ... 'AA').munch(1000).elems < 1000, "'Z' ... 'AA' does not go on forever";
#?rakudo skip '...^'
is ('A' ...^ 'ZZ')[*-1], 'ZY', "'A' ...^ 'ZZ' omits last element";

# be sure the test works as specced even for user classes
Expand All @@ -71,8 +74,10 @@ is ('A' ...^ 'ZZ')[*-1], 'ZY', "'A' ...^ 'ZZ' omits last element";
multi infix:<eqv> (Periodic $x, Int $n) { $x.v eqv $n }
my $f = { Periodic.new(val => $^v) };

#?rakudo todo 'unkonwn'
is ($f(0) ... 5)[^7].join(' '), 'P0 P1 P2 P0 P1 P2 P0', 'increasing periodic series';
is ($f(0) ... -1)[^7].join(' '), 'P0 P2 P1 P0 P2 P1 P0', 'decreasing periodic series';
#?rakudo 4 skip 'loops'
is ($f(0) ... 2).join(' '), 'P0 P1 P2', 'increasing not-quite-periodic series';
is ($f(2) ... 0).join(' '), 'P2 P1 P0', 'decreasing not-quite-periodic series';
is ($f(0) ...^ 2).join(' '), 'P0 P1', 'exclusive increasing not-quite-periodic series';
Expand Down

0 comments on commit 5c4df0e

Please sign in to comment.