Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t/spec] Comments explaining what the previous tests were and a new t…

…est, with a limit that will never be triggered.

git-svn-id: http://svn.pugscode.org/pugs@29922 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit bdc54119b50483341e79bc0d62c729660e3a948e 1 parent a5c64f1
colomon authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 S03-operators/series-arity0.t
View
13 S03-operators/series-arity0.t
@@ -5,8 +5,7 @@ use Test;
plan *;
-# some tests without regard to ending
-
+# Test with Whatever limit
{
my @rolls = ({ (1..6).pick } ... *).batch(20);
is +@rolls, 20, 'Got the number of rolls we asked for';
@@ -14,6 +13,7 @@ plan *;
is @rolls.grep(1..6).elems, 20, 'all the rolls are in the Range 1..6';
}
+# Test with exact limit
{
my @rolls = ({ (1..2).pick } ... 2).batch(100);
ok +@rolls > 0, 'the series had at least one element...';
@@ -23,6 +23,7 @@ plan *;
is @rolls[@rolls.elems - 1], 2, '...and it was the last roll';
}
+# Test with limit between possible values
{
my @rolls = ({ (1..2).pick } ... 1.5).batch(100);
ok +@rolls > 0, 'the series had at least one element...';
@@ -31,5 +32,13 @@ plan *;
is @rolls.grep(@rolls[0]).elems, +@rolls, 'All the rolls are the same';
}
+# Test with limit that cannot be hit
+{
+ my @rolls = ({ (1..6).pick } ... 7).batch(40);
+ is +@rolls, 40, 'Got the number of rolls we asked for';
+ is @rolls.grep(Int).elems, 40, 'all the rolls are Ints';
+ is @rolls.grep(1..6).elems, 40, 'all the rolls are in the Range 1..6';
+}
+
done_testing;
Please sign in to comment.
Something went wrong with that request. Please try again.