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.53 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.52 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.51 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.50 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.49 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.48 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.47 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.46 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.45 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.44 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.43 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.42 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.41 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.40 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.39 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.38 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.37 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.36 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.35 tracks/perl6/exercises/grains/example.yaml
trackler-2.2.1.34 tracks/perl6/exercises/grains/example.yaml