All files clocks.ts

100% Statements 15/15
100% Branches 0/0
100% Functions 12/12
100% Lines 15/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24    3x 4x 4x 10x 19x       3x 1x 1x 2x 3x       3x 1x 1x 2x 3x  
import IClock from "./IClock";
 
export class Clock1 implements IClock {
    private time = 0
    public reset () : void {this.time = 0}
    public tick () : void { this.time++ }
    public getTime(): number { return this.time }
}
 
// counts down from 0
export class Clock2 implements IClock {
    private time = 0
    public reset () : void {this.time = 0}
    public tick () : void { this.time-- }
    public getTime () :number {return (0 - this.time)}
}
 
// counts from 42
export class Clock3 implements IClock {
    private time = 42
    public reset () : void {this.time = 42}  // I originally put a 0 here :)
    public tick () : void { this.time++ }
    public getTime () : number {return this.time - 42}
}