Sha256: 8000d67486fdf8d72961d0cec0efbfb22e7a540655e90e9297e5565df3f16e02

Contents?: true

Size: 629 Bytes

Versions: 82

Compression:

Stored size: 629 Bytes

Contents

exercise: Grains
version: 1
plan: 13
imports: '&grains-on-square &total-grains'
tests: |
  for @($c-data<cases>[0]<cases>) {
    if .<expected> == -1 {
      throws-like { grains-on-square(.<input>) }, Exception, .<description>;
    } else {
      is grains-on-square(.<input>), |.<expected description>;
    }
  }
  is total-grains, |$c-data<cases>[1]<expected description>;

unit: module
example: |
  sub grains-on-square ($number) is export {
    die if $number < 1 or $number > 64;
    2**($number-1);
  }
  
  sub total-grains is export {
    my Int $total;
    for  1..64 { $total += grains-on-square($_) }
    $total;
  }

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
trackler-2.2.1.13 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.12 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.11 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.10 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.9 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.8 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.7 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.6 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.5 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.4 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.3 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.2 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.1 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.0 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.0.6 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.0.5 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.0.4 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.0.3 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.0.2 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.0.1 tracks/perl6/exercises/grains/example.yaml