Skip to content

Commit d74e6f5

Browse files
committed
add newline at end of output
1 parent 8d3f6d3 commit d74e6f5

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

exercises/practice/tournament/.meta/proof.ci.wat

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,6 @@
270270
(local.set $outputLength (i32.add (local.get $outputLength) (global.get $lineLength)))))
271271
(local.set $team (i32.add (local.get $team) (i32.const 1)))
272272
(br_if $write (local.get $pos)))
273-
(global.get $outputOffset) (i32.sub (local.get $outputLength) (i32.const 1))
273+
(global.get $outputOffset) (local.get $outputLength)
274274
)
275275
)

exercises/practice/tournament/tournament.spec.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -52,50 +52,50 @@ describe('Tournament', () => {
5252

5353
test('just the header if no input', () => {
5454
const tally = tournamentTally('');
55-
const expected = 'Team | MP | W | D | L | P';
55+
const expected = 'Team | MP | W | D | L | P\n';
5656
expect(tally).toEqual(expected);
5757
});
5858
xtest('a win is three points, a loss is zero points', () => {
5959
const tally = tournamentTally('Allegoric Alaskans;Blithering Badgers;win');
6060
const expected =
6161
'Team | MP | W | D | L | P\n' +
6262
'Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n' +
63-
'Blithering Badgers | 1 | 0 | 0 | 1 | 0';
63+
'Blithering Badgers | 1 | 0 | 0 | 1 | 0\n';
6464
expect(tally).toEqual(expected);
6565
});
6666
xtest('a win can also be expressed as a loss', () => {
6767
const tally = tournamentTally('Blithering Badgers;Allegoric Alaskans;loss');
6868
const expected =
6969
'Team | MP | W | D | L | P\n' +
7070
'Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n' +
71-
'Blithering Badgers | 1 | 0 | 0 | 1 | 0';
71+
'Blithering Badgers | 1 | 0 | 0 | 1 | 0\n';
7272
expect(tally).toEqual(expected);
7373
});
7474
xtest('a different team can win', () => {
7575
const tally = tournamentTally('Blithering Badgers;Allegoric Alaskans;win');
7676
const expected =
7777
'Team | MP | W | D | L | P\n' +
7878
'Blithering Badgers | 1 | 1 | 0 | 0 | 3\n' +
79-
'Allegoric Alaskans | 1 | 0 | 0 | 1 | 0';
79+
'Allegoric Alaskans | 1 | 0 | 0 | 1 | 0\n';
8080
expect(tally).toEqual(expected);
8181
});
8282
xtest('a draw is one point each', () => {
8383
const tally = tournamentTally('Allegoric Alaskans;Blithering Badgers;draw');
8484
const expected =
8585
'Team | MP | W | D | L | P\n' +
8686
'Allegoric Alaskans | 1 | 0 | 1 | 0 | 1\n' +
87-
'Blithering Badgers | 1 | 0 | 1 | 0 | 1';
87+
'Blithering Badgers | 1 | 0 | 1 | 0 | 1\n';
8888
expect(tally).toEqual(expected);
8989
});
9090
xtest('there can be more than one match', () => {
9191
const input =
9292
'Allegoric Alaskans;Blithering Badgers;win\n' +
93-
'Allegoric Alaskans;Blithering Badgers;win';
93+
'Allegoric Alaskans;Blithering Badgers;win\n';
9494
const tally = tournamentTally(input);
9595
const expected =
9696
'Team | MP | W | D | L | P\n' +
9797
'Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n' +
98-
'Blithering Badgers | 2 | 0 | 0 | 2 | 0';
98+
'Blithering Badgers | 2 | 0 | 0 | 2 | 0\n';
9999
expect(tally).toEqual(expected);
100100
});
101101
xtest('there can be more than one winner', () => {
@@ -106,7 +106,7 @@ describe('Tournament', () => {
106106
const expected =
107107
'Team | MP | W | D | L | P\n' +
108108
'Allegoric Alaskans | 2 | 1 | 0 | 1 | 3\n' +
109-
'Blithering Badgers | 2 | 1 | 0 | 1 | 3';
109+
'Blithering Badgers | 2 | 1 | 0 | 1 | 3\n';
110110
expect(tally).toEqual(expected);
111111
});
112112
xtest('there can be more than two teams', () => {
@@ -119,7 +119,7 @@ describe('Tournament', () => {
119119
'Team | MP | W | D | L | P\n' +
120120
'Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n' +
121121
'Blithering Badgers | 2 | 1 | 0 | 1 | 3\n' +
122-
'Courageous Californians | 2 | 0 | 0 | 2 | 0';
122+
'Courageous Californians | 2 | 0 | 0 | 2 | 0\n';
123123
expect(tally).toEqual(expected);
124124
});
125125
xtest('typical input', () => {
@@ -136,7 +136,7 @@ describe('Tournament', () => {
136136
'Devastating Donkeys | 3 | 2 | 1 | 0 | 7\n' +
137137
'Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n' +
138138
'Blithering Badgers | 3 | 1 | 0 | 2 | 3\n' +
139-
'Courageous Californians | 3 | 0 | 1 | 2 | 1';
139+
'Courageous Californians | 3 | 0 | 1 | 2 | 1\n';
140140
expect(tally).toEqual(expected);
141141
});
142142
xtest('incomplete competition (not all pairs have played)', () => {
@@ -151,7 +151,7 @@ describe('Tournament', () => {
151151
'Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n' +
152152
'Blithering Badgers | 2 | 1 | 1 | 0 | 4\n' +
153153
'Courageous Californians | 2 | 0 | 1 | 1 | 1\n' +
154-
'Devastating Donkeys | 1 | 0 | 0 | 1 | 0';
154+
'Devastating Donkeys | 1 | 0 | 0 | 1 | 0\n';
155155
expect(tally).toEqual(expected);
156156
});
157157
xtest('ties broken alphabetically', () => {
@@ -168,7 +168,7 @@ describe('Tournament', () => {
168168
'Allegoric Alaskans | 3 | 2 | 1 | 0 | 7\n' +
169169
'Courageous Californians | 3 | 2 | 1 | 0 | 7\n' +
170170
'Blithering Badgers | 3 | 0 | 1 | 2 | 1\n' +
171-
'Devastating Donkeys | 3 | 0 | 1 | 2 | 1';
171+
'Devastating Donkeys | 3 | 0 | 1 | 2 | 1\n';
172172
expect(tally).toEqual(expected);
173173
});
174174
xtest('ensure points sorted numerically', () => {
@@ -182,7 +182,7 @@ describe('Tournament', () => {
182182
const expected =
183183
'Team | MP | W | D | L | P\n' +
184184
'Devastating Donkeys | 5 | 4 | 0 | 1 | 12\n' +
185-
'Blithering Badgers | 5 | 1 | 0 | 4 | 3';
185+
'Blithering Badgers | 5 | 1 | 0 | 4 | 3\n';
186186
expect(tally).toEqual(expected);
187187
});
188188
});

0 commit comments

Comments
 (0)