File: roll.t

package info (click to toggle)
liblist-maker-perl 0.005-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 188 kB
  • ctags: 11
  • sloc: perl: 225; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 725 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use Test::More 'no_plan';

use List::Maker;

for my $n (1..10) {
    my @rolls = <1..20 : N % 2 : roll $n >;

    ok @rolls == $n =>  'Correct number rolled';
    for my $roll (@rolls) {
        ok 1 <= $roll && $roll <= 19 => 'rolled in range';
    }

    my @uniroll = <1..100:/7/:roll>;

    is scalar(@uniroll), 1 =>  'Correct single number rolled';
    ok 1 <= $uniroll[0] && $uniroll[0] <= 100 => 'rolled in range';
    ok $uniroll[0] =~ 7 => 'rolled with filter';


    my @wordroll = <cat dog fish rat :roll 2>;

    is scalar(@wordroll), 2 =>  'Correct words rolled';
    ok $wordroll[0] =~ /cat|dog|fish|rat/ => 'First word rolled right';
    ok $wordroll[1] =~ /cat|dog|fish|rat/ => 'Second word rolled right';

}