exercise: Clock version: 3 methods: time add-minutes subtract-minutes plan: 53 tests: |- for $c-data»»<>.flat -> %case { given %case { when 'create' { is Clock.?new( |%(.:p) ).?time, |. given %case; } when 'add'|'subtract' { given %case { my $clock = Clock.?new: |%(.:p); $clock.?add-minutes: . if . eq 'add'; $clock.?subtract-minutes: . if . eq 'subtract'; is $clock.?time, |.; } } when 'equal' { is-deeply ([eq] gather { take Clock.?new( |%(.:p) ).?time for %case; }), |%case; } } } is Clock.?new(:0hour,:0minute).?add-minutes(65).?time, '01:05', 'add-minutes method can be chained'; is Clock.?new(:0hour,:0minute).?subtract-minutes(65).?time, '22:55', 'subtract-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; } method subtract-minutes (Int:D $min) { self.add-minutes(-$min); } stub: |- has $.hour; has $.minute;