exercise: Clock version: 1 methods: time add-minutes plan: 54 tests: |- for $c-data»».Array.flat -> %case { given %case { when 'create' { is ::($exercise).?new( |%(.:p) ).?time, |. given %case; } when 'add' { given %case { my $clock = ::($exercise).?new: |%(.:p); $clock.?add-minutes: .; is $clock.?time, |.; } } when 'equal' { is-deeply ([eq] gather { take ::($exercise).?new( |%(.:p) ).?time for %case; }), |%case; } when %*ENV.so { bail-out "no case for property '%case'" } } } todo 'optional test' unless %*ENV; is ::($exercise).?new(:0hour,:0minute).?add-minutes(65).?time, '01:05', 'add-minutes method can be chained'; unit: class example: |- has Int:D $.hour = 0; has Int:D $.minute = 0; method time { sprintf '%02d:%02d', ($!hour + $!minute div 60) % 24, $!minute % 60; } method add-minutes (Int:D $min) { $!minute += $min and return self; } stub: |- has $.hour; has $.minute;