trackler 2.2.1.120 → 2.2.1.121
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/javascript/.eslintignore +0 -3
- data/tracks/javascript/exercises/bowling/bowling.spec.js +16 -0
- data/tracks/prolog/.github/stale.yml +1 -0
- data/tracks/prolog/config.json +11 -1
- data/tracks/prolog/docs/RESOURCES.md +1 -0
- data/tracks/prolog/exercises/pascals-triangle/README.md +19 -0
- data/tracks/prolog/exercises/pascals-triangle/pascals_triangle.example +15 -0
- data/tracks/prolog/exercises/pascals-triangle/pascals_triangle.pl +1 -0
- data/tracks/prolog/exercises/pascals-triangle/pascals_triangle_tests.plt +43 -0
- data/tracks/scala/exercises/all-your-base/src/test/scala/AllYourBaseTest.scala +25 -23
- data/tracks/scala/exercises/clock/src/test/scala/ClockTest.scala +52 -52
- data/tracks/scala/exercises/grains/src/test/scala/GrainsTest.scala +13 -13
- data/tracks/scala/exercises/house/example.scala +5 -4
- data/tracks/scala/exercises/house/src/test/scala/HouseTest.scala +43 -202
- data/tracks/scala/testgen/src/main/scala/ClockTestGenerator.scala +16 -13
- data/tracks/scala/testgen/src/main/scala/GrainsTestGenerator.scala +13 -7
- data/tracks/typescript/config.json +14 -0
- data/tracks/typescript/exercises/isbn-verifier/README.md +73 -0
- data/tracks/typescript/exercises/isbn-verifier/isbn-verifier.example.ts +24 -0
- data/tracks/typescript/exercises/isbn-verifier/isbn-verifier.test.ts +59 -0
- data/tracks/typescript/exercises/isbn-verifier/isbn-verifier.ts +0 -0
- data/tracks/typescript/exercises/isbn-verifier/package.json +36 -0
- data/tracks/typescript/exercises/isbn-verifier/tsconfig.json +22 -0
- data/tracks/typescript/exercises/isbn-verifier/tslint.json +127 -0
- data/tracks/typescript/exercises/isbn-verifier/yarn.lock +2624 -0
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79523d8a19c7d2f3b248cd1914ca6a5cdd60a08c
|
4
|
+
data.tar.gz: 12d9dc9779fd141256d07b4547a421fa579245fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e61ec423a5e5ec0c1a24f0db7adb7b7d3888b92b7dedb9044c0a77a2b81eedc19d327c9938c82e0a61881e9e8e1d48a9513ddf60bbc75399121b313e3578a3ef
|
7
|
+
data.tar.gz: d6a7ead384bd7881be86acb5801fa158422120e44dc4213dca1f3058cde2ea67ab5c8c727b54d7e93a73d0a09091c5f2478e827fcf3ec02450f245355b1362cb
|
data/lib/trackler/version.rb
CHANGED
@@ -208,5 +208,21 @@ describe('Bowling', function () {
|
|
208
208
|
expect(function () { bowling.score(); }).toThrow(
|
209
209
|
new Error('Score cannot be taken until the end of the game'));
|
210
210
|
});
|
211
|
+
|
212
|
+
xit('cannot roll after bonus roll for a spare', function () {
|
213
|
+
var rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2];
|
214
|
+
var bowling = new Bowling();
|
215
|
+
previousRolls(bowling, rolls);
|
216
|
+
expect(function () { bowling.roll(2); }).toThrow(
|
217
|
+
new Error('Cannot roll after game is over'));
|
218
|
+
});
|
219
|
+
|
220
|
+
xit('cannot roll after bonus rolls for a strike', function () {
|
221
|
+
var rolls = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2];
|
222
|
+
var bowling = new Bowling();
|
223
|
+
previousRolls(bowling, rolls);
|
224
|
+
expect(function () { bowling.roll(2); }).toThrow(
|
225
|
+
new Error('Cannot roll after game is over'));
|
226
|
+
});
|
211
227
|
});
|
212
228
|
});
|
@@ -0,0 +1 @@
|
|
1
|
+
|
data/tracks/prolog/config.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"language": "Prolog",
|
3
|
-
"active":
|
3
|
+
"active": true,
|
4
4
|
"exercises": [
|
5
5
|
{
|
6
6
|
"uuid": "68a85ec5-acdd-4f4f-9b9e-a5e39f1f7ac0",
|
@@ -140,6 +140,16 @@
|
|
140
140
|
"difficulty": 1,
|
141
141
|
"topics": [
|
142
142
|
|
143
|
+
]
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"uuid": "b7022a0f-9fda-4144-ae1e-11615bac0f56",
|
147
|
+
"slug": "pascals-triangle",
|
148
|
+
"core": false,
|
149
|
+
"unlocked_by": null,
|
150
|
+
"difficulty": 1,
|
151
|
+
"topics": [
|
152
|
+
|
143
153
|
]
|
144
154
|
}
|
145
155
|
],
|
@@ -3,3 +3,4 @@
|
|
3
3
|
* [SWISH - An online Prolog REPL](http://swish.swi-prolog.org/)
|
4
4
|
* [Prolog on Stack Overflow](https://stackoverflow.com/tags/prolog)
|
5
5
|
* [Tutorials and Resources](http://www.swi-prolog.org/Links.html)
|
6
|
+
* [A Taste of Prolog by Aja Hammerly](https://www.youtube.com/watch?v=hEOVcLAPRG8)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Compute Pascal's triangle up to a given number of rows.
|
2
|
+
|
3
|
+
In Pascal's Triangle each number is computed by adding the numbers to
|
4
|
+
the right and left of the current position in the previous row.
|
5
|
+
|
6
|
+
```text
|
7
|
+
1
|
8
|
+
1 1
|
9
|
+
1 2 1
|
10
|
+
1 3 3 1
|
11
|
+
1 4 6 4 1
|
12
|
+
# ... etc
|
13
|
+
```
|
14
|
+
## Source
|
15
|
+
|
16
|
+
[Pascal's Triangle at Wolfram Math World](http://mathworld.wolfram.com/PascalsTriangle.html)
|
17
|
+
|
18
|
+
## Submitting Incomplete Solutions
|
19
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
pascal(0, []) :- !.
|
2
|
+
pascal(X, P) :-
|
3
|
+
numlist(1, X, NL),
|
4
|
+
maplist(pascalH, NL, P).
|
5
|
+
|
6
|
+
pascalH(1, [1]) :- !.
|
7
|
+
pascalH(N, [X|L]) :-
|
8
|
+
succ(N1, N),
|
9
|
+
pascalH(N1, [X|L1]),
|
10
|
+
build([X|L1], L), !.
|
11
|
+
|
12
|
+
build([X], [X]).
|
13
|
+
build([X,Y|Z], [H|R]) :-
|
14
|
+
H is X+Y,
|
15
|
+
build([Y|Z], R).
|
@@ -0,0 +1 @@
|
|
1
|
+
pascal(false).
|
@@ -0,0 +1,43 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
7
|
+
:- begin_tests(pascal).
|
8
|
+
|
9
|
+
test(zero_rows, condition(true)) :-
|
10
|
+
pascal(0, []).
|
11
|
+
|
12
|
+
test(single_row, condition(pending)) :-
|
13
|
+
pascal(1, [[1]]).
|
14
|
+
|
15
|
+
test(two_rows, condition(pending)) :-
|
16
|
+
pascal(2, [[1], [1,1]]).
|
17
|
+
|
18
|
+
test(three_rows, condition(pending)) :-
|
19
|
+
pascal(3, [[1], [1,1], [1,2,1]]).
|
20
|
+
|
21
|
+
test(four_rows, condition(pending)) :-
|
22
|
+
pascal(4, [[1], [1,1], [1,2,1], [1,3,3,1]]).
|
23
|
+
|
24
|
+
test(five_rows, condition(pending)) :-
|
25
|
+
pascal(5, [[1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]).
|
26
|
+
|
27
|
+
test(six_rows, condition(pending)) :-
|
28
|
+
pascal(6, [[1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1], [1,5,10,10,5,1]]).
|
29
|
+
|
30
|
+
test(ten_rows, condition(pending)) :-
|
31
|
+
pascal(10, [ [1],
|
32
|
+
[1,1],
|
33
|
+
[1,2,1],
|
34
|
+
[1,3,3,1],
|
35
|
+
[1,4,6,4,1],
|
36
|
+
[1,5,10,10,5,1],
|
37
|
+
[1,6,15,20,15,6,1],
|
38
|
+
[1,7,21,35,35,21,7,1],
|
39
|
+
[1,8,28,56,70,56,28,8,1],
|
40
|
+
[1,9,36,84,126,126,84,36,9,1]
|
41
|
+
]).
|
42
|
+
|
43
|
+
:- end_tests(pascal).
|
@@ -1,109 +1,111 @@
|
|
1
1
|
import org.scalatest.{Matchers, FunSuite}
|
2
2
|
|
3
|
-
/** @version 2.
|
3
|
+
/** @version 2.3.0 */
|
4
4
|
class AllYourBaseTest extends FunSuite with Matchers {
|
5
5
|
|
6
6
|
test("single bit one to decimal") {
|
7
|
-
AllYourBase.rebase(2, List(1), 10) should be
|
7
|
+
AllYourBase.rebase(2, List(1), 10) should be(Some(List(1)))
|
8
8
|
}
|
9
9
|
|
10
10
|
test("binary to single decimal") {
|
11
11
|
pending
|
12
|
-
AllYourBase.rebase(2, List(1, 0, 1), 10) should be
|
12
|
+
AllYourBase.rebase(2, List(1, 0, 1), 10) should be(Some(List(5)))
|
13
13
|
}
|
14
14
|
|
15
15
|
test("single decimal to binary") {
|
16
16
|
pending
|
17
|
-
AllYourBase.rebase(10, List(5), 2) should be
|
17
|
+
AllYourBase.rebase(10, List(5), 2) should be(Some(List(1, 0, 1)))
|
18
18
|
}
|
19
19
|
|
20
20
|
test("binary to multiple decimal") {
|
21
21
|
pending
|
22
|
-
AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0), 10) should be
|
22
|
+
AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0), 10) should be(
|
23
|
+
Some(List(4, 2)))
|
23
24
|
}
|
24
25
|
|
25
26
|
test("decimal to binary") {
|
26
27
|
pending
|
27
|
-
AllYourBase.rebase(10, List(4, 2), 2) should be
|
28
|
+
AllYourBase.rebase(10, List(4, 2), 2) should be(
|
29
|
+
Some(List(1, 0, 1, 0, 1, 0)))
|
28
30
|
}
|
29
31
|
|
30
32
|
test("trinary to hexadecimal") {
|
31
33
|
pending
|
32
|
-
AllYourBase.rebase(3, List(1, 1, 2, 0), 16) should be
|
34
|
+
AllYourBase.rebase(3, List(1, 1, 2, 0), 16) should be(Some(List(2, 10)))
|
33
35
|
}
|
34
36
|
|
35
37
|
test("hexadecimal to trinary") {
|
36
38
|
pending
|
37
|
-
AllYourBase.rebase(16, List(2, 10), 3) should be
|
39
|
+
AllYourBase.rebase(16, List(2, 10), 3) should be(Some(List(1, 1, 2, 0)))
|
38
40
|
}
|
39
41
|
|
40
42
|
test("15-bit integer") {
|
41
43
|
pending
|
42
|
-
AllYourBase.rebase(97, List(3, 46, 60), 73) should be
|
44
|
+
AllYourBase.rebase(97, List(3, 46, 60), 73) should be(Some(List(6, 10, 45)))
|
43
45
|
}
|
44
46
|
|
45
47
|
test("empty list") {
|
46
48
|
pending
|
47
|
-
AllYourBase.rebase(2, List(), 10) should be
|
49
|
+
AllYourBase.rebase(2, List(), 10) should be(Some(List(0)))
|
48
50
|
}
|
49
51
|
|
50
52
|
test("single zero") {
|
51
53
|
pending
|
52
|
-
AllYourBase.rebase(10, List(0), 2) should be
|
54
|
+
AllYourBase.rebase(10, List(0), 2) should be(Some(List(0)))
|
53
55
|
}
|
54
56
|
|
55
57
|
test("multiple zeros") {
|
56
58
|
pending
|
57
|
-
AllYourBase.rebase(10, List(0, 0, 0), 2) should be
|
59
|
+
AllYourBase.rebase(10, List(0, 0, 0), 2) should be(Some(List(0)))
|
58
60
|
}
|
59
61
|
|
60
62
|
test("leading zeros") {
|
61
63
|
pending
|
62
|
-
AllYourBase.rebase(7, List(0, 6, 0), 10) should be
|
64
|
+
AllYourBase.rebase(7, List(0, 6, 0), 10) should be(Some(List(4, 2)))
|
63
65
|
}
|
64
66
|
|
65
67
|
test("input base is one") {
|
66
68
|
pending
|
67
|
-
AllYourBase.rebase(1, List(), 10) should be
|
69
|
+
AllYourBase.rebase(1, List(0), 10) should be(None)
|
68
70
|
}
|
69
71
|
|
70
72
|
test("input base is zero") {
|
71
73
|
pending
|
72
|
-
AllYourBase.rebase(0, List(), 10) should be
|
74
|
+
AllYourBase.rebase(0, List(), 10) should be(None)
|
73
75
|
}
|
74
76
|
|
75
77
|
test("input base is negative") {
|
76
78
|
pending
|
77
|
-
AllYourBase.rebase(-2, List(1), 10) should be
|
79
|
+
AllYourBase.rebase(-2, List(1), 10) should be(None)
|
78
80
|
}
|
79
81
|
|
80
82
|
test("negative digit") {
|
81
83
|
pending
|
82
|
-
AllYourBase.rebase(2, List(1, -1, 1, 0, 1, 0), 10) should be
|
84
|
+
AllYourBase.rebase(2, List(1, -1, 1, 0, 1, 0), 10) should be(None)
|
83
85
|
}
|
84
86
|
|
85
87
|
test("invalid positive digit") {
|
86
88
|
pending
|
87
|
-
AllYourBase.rebase(2, List(1, 2, 1, 0, 1, 0), 10) should be
|
89
|
+
AllYourBase.rebase(2, List(1, 2, 1, 0, 1, 0), 10) should be(None)
|
88
90
|
}
|
89
91
|
|
90
92
|
test("output base is one") {
|
91
93
|
pending
|
92
|
-
AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0), 1) should be
|
94
|
+
AllYourBase.rebase(2, List(1, 0, 1, 0, 1, 0), 1) should be(None)
|
93
95
|
}
|
94
96
|
|
95
97
|
test("output base is zero") {
|
96
98
|
pending
|
97
|
-
AllYourBase.rebase(10, List(7), 0) should be
|
99
|
+
AllYourBase.rebase(10, List(7), 0) should be(None)
|
98
100
|
}
|
99
101
|
|
100
102
|
test("output base is negative") {
|
101
103
|
pending
|
102
|
-
AllYourBase.rebase(2, List(1), -7) should be
|
104
|
+
AllYourBase.rebase(2, List(1), -7) should be(None)
|
103
105
|
}
|
104
106
|
|
105
107
|
test("both bases are negative") {
|
106
108
|
pending
|
107
|
-
AllYourBase.rebase(-2, List(1), -7) should be
|
109
|
+
AllYourBase.rebase(-2, List(1), -7) should be(None)
|
108
110
|
}
|
109
|
-
}
|
111
|
+
}
|
@@ -1,254 +1,254 @@
|
|
1
1
|
import org.scalatest.{Matchers, FunSuite}
|
2
2
|
|
3
|
-
/** @version
|
3
|
+
/** @version 2.2.1 */
|
4
4
|
class ClockTest extends FunSuite with Matchers {
|
5
5
|
|
6
6
|
test("on the hour") {
|
7
|
-
Clock(8, 0) should be
|
7
|
+
Clock(8, 0) should be(Clock(8, 0))
|
8
8
|
}
|
9
9
|
|
10
10
|
test("past the hour") {
|
11
11
|
pending
|
12
|
-
Clock(11, 9) should be
|
12
|
+
Clock(11, 9) should be(Clock(11, 9))
|
13
13
|
}
|
14
14
|
|
15
15
|
test("midnight is zero hours") {
|
16
16
|
pending
|
17
|
-
Clock(24, 0) should be
|
17
|
+
Clock(24, 0) should be(Clock(0, 0))
|
18
18
|
}
|
19
19
|
|
20
20
|
test("hour rolls over") {
|
21
21
|
pending
|
22
|
-
Clock(25, 0) should be
|
22
|
+
Clock(25, 0) should be(Clock(1, 0))
|
23
23
|
}
|
24
24
|
|
25
25
|
test("hour rolls over continuously") {
|
26
26
|
pending
|
27
|
-
Clock(100, 0) should be
|
27
|
+
Clock(100, 0) should be(Clock(4, 0))
|
28
28
|
}
|
29
29
|
|
30
30
|
test("sixty minutes is next hour") {
|
31
31
|
pending
|
32
|
-
Clock(1, 60) should be
|
32
|
+
Clock(1, 60) should be(Clock(2, 0))
|
33
33
|
}
|
34
34
|
|
35
35
|
test("minutes roll over") {
|
36
36
|
pending
|
37
|
-
Clock(0, 160) should be
|
37
|
+
Clock(0, 160) should be(Clock(2, 40))
|
38
38
|
}
|
39
39
|
|
40
40
|
test("minutes roll over continuously") {
|
41
41
|
pending
|
42
|
-
Clock(0, 1723) should be
|
42
|
+
Clock(0, 1723) should be(Clock(4, 43))
|
43
43
|
}
|
44
44
|
|
45
45
|
test("hour and minutes roll over") {
|
46
46
|
pending
|
47
|
-
Clock(25, 160) should be
|
47
|
+
Clock(25, 160) should be(Clock(3, 40))
|
48
48
|
}
|
49
49
|
|
50
50
|
test("hour and minutes roll over continuously") {
|
51
51
|
pending
|
52
|
-
Clock(201, 3001) should be
|
52
|
+
Clock(201, 3001) should be(Clock(11, 1))
|
53
53
|
}
|
54
54
|
|
55
55
|
test("hour and minutes roll over to exactly midnight") {
|
56
56
|
pending
|
57
|
-
Clock(72, 8640) should be
|
57
|
+
Clock(72, 8640) should be(Clock(0, 0))
|
58
58
|
}
|
59
59
|
|
60
60
|
test("negative hour") {
|
61
61
|
pending
|
62
|
-
Clock(-1, 15) should be
|
62
|
+
Clock(-1, 15) should be(Clock(23, 15))
|
63
63
|
}
|
64
64
|
|
65
65
|
test("negative hour rolls over") {
|
66
66
|
pending
|
67
|
-
Clock(-25, 0) should be
|
67
|
+
Clock(-25, 0) should be(Clock(23, 0))
|
68
68
|
}
|
69
69
|
|
70
70
|
test("negative hour rolls over continuously") {
|
71
71
|
pending
|
72
|
-
Clock(-91, 0) should be
|
72
|
+
Clock(-91, 0) should be(Clock(5, 0))
|
73
73
|
}
|
74
74
|
|
75
75
|
test("negative minutes") {
|
76
76
|
pending
|
77
|
-
Clock(1, -40) should be
|
77
|
+
Clock(1, -40) should be(Clock(0, 20))
|
78
78
|
}
|
79
79
|
|
80
80
|
test("negative minutes roll over") {
|
81
81
|
pending
|
82
|
-
Clock(1, -160) should be
|
82
|
+
Clock(1, -160) should be(Clock(22, 20))
|
83
83
|
}
|
84
84
|
|
85
85
|
test("negative minutes roll over continuously") {
|
86
86
|
pending
|
87
|
-
Clock(1, -4820) should be
|
87
|
+
Clock(1, -4820) should be(Clock(16, 40))
|
88
88
|
}
|
89
89
|
|
90
90
|
test("negative hour and minutes both roll over") {
|
91
91
|
pending
|
92
|
-
Clock(-25, -160) should be
|
92
|
+
Clock(-25, -160) should be(Clock(20, 20))
|
93
93
|
}
|
94
94
|
|
95
95
|
test("negative hour and minutes both roll over continuously") {
|
96
96
|
pending
|
97
|
-
Clock(-121, -5810) should be
|
97
|
+
Clock(-121, -5810) should be(Clock(22, 10))
|
98
98
|
}
|
99
99
|
|
100
100
|
test("add minutes") {
|
101
101
|
pending
|
102
|
-
Clock(10, 0) + Clock(3) should be
|
102
|
+
Clock(10, 0) + Clock(3) should be(Clock(10, 3))
|
103
103
|
}
|
104
104
|
|
105
105
|
test("add no minutes") {
|
106
106
|
pending
|
107
|
-
Clock(6, 41) + Clock(0) should be
|
107
|
+
Clock(6, 41) + Clock(0) should be(Clock(6, 41))
|
108
108
|
}
|
109
109
|
|
110
110
|
test("add to next hour") {
|
111
111
|
pending
|
112
|
-
Clock(0, 45) + Clock(40) should be
|
112
|
+
Clock(0, 45) + Clock(40) should be(Clock(1, 25))
|
113
113
|
}
|
114
114
|
|
115
115
|
test("add more than one hour") {
|
116
116
|
pending
|
117
|
-
Clock(10, 0) + Clock(61) should be
|
117
|
+
Clock(10, 0) + Clock(61) should be(Clock(11, 1))
|
118
118
|
}
|
119
119
|
|
120
120
|
test("add more than two hours with carry") {
|
121
121
|
pending
|
122
|
-
Clock(0, 45) + Clock(160) should be
|
122
|
+
Clock(0, 45) + Clock(160) should be(Clock(3, 25))
|
123
123
|
}
|
124
124
|
|
125
125
|
test("add across midnight") {
|
126
126
|
pending
|
127
|
-
Clock(23, 59) + Clock(2) should be
|
127
|
+
Clock(23, 59) + Clock(2) should be(Clock(0, 1))
|
128
128
|
}
|
129
129
|
|
130
130
|
test("add more than one day (1500 min = 25 hrs)") {
|
131
131
|
pending
|
132
|
-
Clock(5, 32) + Clock(1500) should be
|
132
|
+
Clock(5, 32) + Clock(1500) should be(Clock(6, 32))
|
133
133
|
}
|
134
134
|
|
135
135
|
test("add more than two days") {
|
136
136
|
pending
|
137
|
-
Clock(1, 1) + Clock(3500) should be
|
137
|
+
Clock(1, 1) + Clock(3500) should be(Clock(11, 21))
|
138
138
|
}
|
139
139
|
|
140
140
|
test("subtract minutes") {
|
141
141
|
pending
|
142
|
-
Clock(10, 3) - Clock(3) should be
|
142
|
+
Clock(10, 3) - Clock(3) should be(Clock(10, 0))
|
143
143
|
}
|
144
144
|
|
145
145
|
test("subtract to previous hour") {
|
146
146
|
pending
|
147
|
-
Clock(10, 3) - Clock(30) should be
|
147
|
+
Clock(10, 3) - Clock(30) should be(Clock(9, 33))
|
148
148
|
}
|
149
149
|
|
150
150
|
test("subtract more than an hour") {
|
151
151
|
pending
|
152
|
-
Clock(10, 3) - Clock(70) should be
|
152
|
+
Clock(10, 3) - Clock(70) should be(Clock(8, 53))
|
153
153
|
}
|
154
154
|
|
155
155
|
test("subtract across midnight") {
|
156
156
|
pending
|
157
|
-
Clock(0, 3) - Clock(4) should be
|
157
|
+
Clock(0, 3) - Clock(4) should be(Clock(23, 59))
|
158
158
|
}
|
159
159
|
|
160
160
|
test("subtract more than two hours") {
|
161
161
|
pending
|
162
|
-
Clock(0, 0) - Clock(160) should be
|
162
|
+
Clock(0, 0) - Clock(160) should be(Clock(21, 20))
|
163
163
|
}
|
164
164
|
|
165
165
|
test("subtract more than two hours with borrow") {
|
166
166
|
pending
|
167
|
-
Clock(6, 15) - Clock(160) should be
|
167
|
+
Clock(6, 15) - Clock(160) should be(Clock(3, 35))
|
168
168
|
}
|
169
169
|
|
170
170
|
test("subtract more than one day (1500 min = 25 hrs)") {
|
171
171
|
pending
|
172
|
-
Clock(5, 32) - Clock(1500) should be
|
172
|
+
Clock(5, 32) - Clock(1500) should be(Clock(4, 32))
|
173
173
|
}
|
174
174
|
|
175
175
|
test("subtract more than two days") {
|
176
176
|
pending
|
177
|
-
Clock(2, 20) - Clock(3000) should be
|
177
|
+
Clock(2, 20) - Clock(3000) should be(Clock(0, 20))
|
178
178
|
}
|
179
179
|
|
180
180
|
test("clocks with same time") {
|
181
181
|
pending
|
182
|
-
Clock(15, 37) == Clock(15, 37) should be
|
182
|
+
Clock(15, 37) == Clock(15, 37) should be(true)
|
183
183
|
}
|
184
184
|
|
185
185
|
test("clocks a minute apart") {
|
186
186
|
pending
|
187
|
-
Clock(15, 36) == Clock(15, 37) should be
|
187
|
+
Clock(15, 36) == Clock(15, 37) should be(false)
|
188
188
|
}
|
189
189
|
|
190
190
|
test("clocks an hour apart") {
|
191
191
|
pending
|
192
|
-
Clock(14, 37) == Clock(15, 37) should be
|
192
|
+
Clock(14, 37) == Clock(15, 37) should be(false)
|
193
193
|
}
|
194
194
|
|
195
195
|
test("clocks with hour overflow") {
|
196
196
|
pending
|
197
|
-
Clock(10, 37) == Clock(34, 37) should be
|
197
|
+
Clock(10, 37) == Clock(34, 37) should be(true)
|
198
198
|
}
|
199
199
|
|
200
200
|
test("clocks with hour overflow by several days") {
|
201
201
|
pending
|
202
|
-
Clock(3, 11) == Clock(99, 11) should be
|
202
|
+
Clock(3, 11) == Clock(99, 11) should be(true)
|
203
203
|
}
|
204
204
|
|
205
205
|
test("clocks with negative hour") {
|
206
206
|
pending
|
207
|
-
Clock(22, 40) == Clock(-2, 40) should be
|
207
|
+
Clock(22, 40) == Clock(-2, 40) should be(true)
|
208
208
|
}
|
209
209
|
|
210
210
|
test("clocks with negative hour that wraps") {
|
211
211
|
pending
|
212
|
-
Clock(17, 3) == Clock(-31, 3) should be
|
212
|
+
Clock(17, 3) == Clock(-31, 3) should be(true)
|
213
213
|
}
|
214
214
|
|
215
215
|
test("clocks with negative hour that wraps multiple times") {
|
216
216
|
pending
|
217
|
-
Clock(13, 49) == Clock(-83, 49) should be
|
217
|
+
Clock(13, 49) == Clock(-83, 49) should be(true)
|
218
218
|
}
|
219
219
|
|
220
220
|
test("clocks with minute overflow") {
|
221
221
|
pending
|
222
|
-
Clock(0, 1) == Clock(0, 1441) should be
|
222
|
+
Clock(0, 1) == Clock(0, 1441) should be(true)
|
223
223
|
}
|
224
224
|
|
225
225
|
test("clocks with minute overflow by several days") {
|
226
226
|
pending
|
227
|
-
Clock(2, 2) == Clock(2, 4322) should be
|
227
|
+
Clock(2, 2) == Clock(2, 4322) should be(true)
|
228
228
|
}
|
229
229
|
|
230
230
|
test("clocks with negative minute") {
|
231
231
|
pending
|
232
|
-
Clock(2, 40) == Clock(3, -20) should be
|
232
|
+
Clock(2, 40) == Clock(3, -20) should be(true)
|
233
233
|
}
|
234
234
|
|
235
235
|
test("clocks with negative minute that wraps") {
|
236
236
|
pending
|
237
|
-
Clock(4, 10) == Clock(5, -1490) should be
|
237
|
+
Clock(4, 10) == Clock(5, -1490) should be(true)
|
238
238
|
}
|
239
239
|
|
240
240
|
test("clocks with negative minute that wraps multiple times") {
|
241
241
|
pending
|
242
|
-
Clock(6, 15) == Clock(6, -4305) should be
|
242
|
+
Clock(6, 15) == Clock(6, -4305) should be(true)
|
243
243
|
}
|
244
244
|
|
245
245
|
test("clocks with negative hours and minutes") {
|
246
246
|
pending
|
247
|
-
Clock(7, 32) == Clock(-12, -268) should be
|
247
|
+
Clock(7, 32) == Clock(-12, -268) should be(true)
|
248
248
|
}
|
249
249
|
|
250
250
|
test("clocks with negative hours and minutes that wrap") {
|
251
251
|
pending
|
252
|
-
Clock(18, 7) == Clock(-54, -11513) should be
|
252
|
+
Clock(18, 7) == Clock(-54, -11513) should be(true)
|
253
253
|
}
|
254
|
-
}
|
254
|
+
}
|