Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 43 lines (36 sloc) 1.455 kb
acc5445 [t/spec] Arity-0 test added.
colomon authored
1 use v6;
2 use Test;
3
53704ce [t/spec/S03-operators/series*.t] Deleted redundant tests, reorganized…
Kodi authored
4 # L<S03/List infix precedence/"can be 0-ary as well">
acc5445 [t/spec] Arity-0 test added.
colomon authored
5
cb28dfa @patrickas Changed more tests to follow the new spec
patrickas authored
6 plan 13;
acc5445 [t/spec] Arity-0 test added.
colomon authored
7
bdc5411 [t/spec] Comments explaining what the previous tests were and a new t…
colomon authored
8 # Test with Whatever limit
acc5445 [t/spec] Arity-0 test added.
colomon authored
9 {
9e9686f [t/spec] replace .batch($x) with .[^$x]
moritz authored
10 my @rolls = ({ (1..6).pick } ... *).[^20];
acc5445 [t/spec] Arity-0 test added.
colomon authored
11 is +@rolls, 20, 'Got the number of rolls we asked for';
12 is @rolls.grep(Int).elems, 20, 'all the rolls are Ints';
13 is @rolls.grep(1..6).elems, 20, 'all the rolls are in the Range 1..6';
14 }
15
bdc5411 [t/spec] Comments explaining what the previous tests were and a new t…
colomon authored
16 # Test with exact limit
e8eb581 @coke niecza fudging
coke authored
17 #?niecza skip 'Unable to resolve method munch in class List'
028b4dc [t/spec] Some interesting arity-0 tests for limit conditions.
colomon authored
18 {
1d6d882 Replace .[N] with .munch(N) so that results are not padded with Any().
colomon authored
19 my @rolls = ({ (1..2).pick } ... 2).munch(100);
ef86bef @moritz [sequence] is the new series
moritz authored
20 ok +@rolls > 0, 'the sequence had at least one element...';
21 ok +@rolls < 100, '... and the sequence terminated';
028b4dc [t/spec] Some interesting arity-0 tests for limit conditions.
colomon authored
22 is @rolls.grep(Int).elems, +@rolls, 'all the rolls are Ints';
23 is @rolls.grep(2).elems, 1, 'There was exactly one 2 rolled...';
24 is @rolls[@rolls.elems - 1], 2, '...and it was the last roll';
25 }
26
bdc5411 [t/spec] Comments explaining what the previous tests were and a new t…
colomon authored
27 # Test with limit between possible values
e8eb581 @coke niecza fudging
coke authored
28 #?niecza skip 'Unable to resolve method munch in class List'
028b4dc [t/spec] Some interesting arity-0 tests for limit conditions.
colomon authored
29 {
1d6d882 Replace .[N] with .munch(N) so that results are not padded with Any().
colomon authored
30 my @rolls = ({ (1..2).pick } ... 1.5).munch(100);
ef86bef @moritz [sequence] is the new series
moritz authored
31 ok +@rolls == 100, 'the sequence is infinite...';
028b4dc [t/spec] Some interesting arity-0 tests for limit conditions.
colomon authored
32 is @rolls.grep(Int).elems, +@rolls, 'all the rolls are Ints';
33 }
34
bdc5411 [t/spec] Comments explaining what the previous tests were and a new t…
colomon authored
35 # Test with limit that cannot be hit
e8eb581 @coke niecza fudging
coke authored
36 #?niecza skip 'Unable to resolve method munch in class List'
bdc5411 [t/spec] Comments explaining what the previous tests were and a new t…
colomon authored
37 {
1d6d882 Replace .[N] with .munch(N) so that results are not padded with Any().
colomon authored
38 my @rolls = ({ (1..6).pick } ... 7).munch(40);
bdc5411 [t/spec] Comments explaining what the previous tests were and a new t…
colomon authored
39 is +@rolls, 40, 'Got the number of rolls we asked for';
40 is @rolls.grep(Int).elems, 40, 'all the rolls are Ints';
41 is @rolls.grep(1..6).elems, 40, 'all the rolls are in the Range 1..6';
42 }
Something went wrong with that request. Please try again.