Skip to content

Commit cdffa05

Browse files
committed
Adding tests for "Smooth!".
1 parent b2661ae commit cdffa05

File tree

11 files changed

+194
-0
lines changed

11 files changed

+194
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Tests for "Decode the message".
3333
- Tests for "Detective geek".
3434
- Tests for "Largest number".
35+
- Tests for "Smooth!".
3536

3637
## [1.9.0] - 2022-06-01
3738
### Added
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* The "Smooth!" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/smooth}
4+
*/
5+
function execute(readline) {
6+
const N = parseInt(readline());
7+
for (let i = 0; i < N; i++) {
8+
const F = parseInt(readline());
9+
}
10+
11+
// Write an answer using console.log()
12+
// To debug: console.error('Debug messages...');
13+
14+
console.log('DEFEAT');
15+
}
16+
17+
export { execute };
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { assert } from 'chai';
2+
import sinon from 'sinon';
3+
import File from '../../../../File.js';
4+
import { assertOutputAnswer } from '../../../../assertOutputAnswer.js';
5+
import { execute } from '../../../../../lib/community/training/easy/smooth/smooth.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite("Smooth!", function() {
10+
const sandbox = sinon.createSandbox();
11+
12+
setup(function () {
13+
sandbox.stub(console, "log");
14+
});
15+
16+
teardown(function () {
17+
sandbox.restore();
18+
});
19+
20+
21+
test("Small bulk", function() {
22+
let inputFile = new File(__dirname + 'input/01 - small bulk.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - small bulk.txt');
27+
});
28+
29+
test("Easy victories", function() {
30+
let inputFile = new File(__dirname + 'input/02 - easy victories.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assertOutputAnswer(__dirname + 'output/02 - easy victories.txt');
35+
});
36+
37+
test("Easy defeats", function() {
38+
let inputFile = new File(__dirname + 'input/03 - easy defeats.txt');
39+
40+
execute(inputFile.readline.bind(inputFile));
41+
42+
assertOutputAnswer(__dirname + 'output/03 - easy defeats.txt');
43+
});
44+
45+
test("Bigger", function() {
46+
let inputFile = new File(__dirname + 'input/04 - bigger.txt');
47+
48+
execute(inputFile.readline.bind(inputFile));
49+
50+
assertOutputAnswer(__dirname + 'output/04 - bigger.txt');
51+
});
52+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
10
2+
1
3+
2
4+
3
5+
4
6+
5
7+
6
8+
7
9+
8
10+
9
11+
10
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
15
2+
600
3+
640
4+
675
5+
729
6+
768
7+
810
8+
900
9+
972
10+
1024
11+
1125
12+
1200
13+
1250
14+
1296
15+
1440
16+
1500
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
15
2+
630
3+
650
4+
732
5+
760
6+
806
7+
872
8+
966
9+
1001
10+
1092
11+
1160
12+
1216
13+
1290
14+
1400
15+
1460
16+
1539
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
20
2+
8916100448256000
3+
8905786697765618
4+
8978233254014990
5+
8883664392439636
6+
8967378984372715
7+
8906044184985600
8+
8815968460800000
9+
8839938372534426
10+
8887458428319767
11+
8847360000000000
12+
8957952000000000
13+
8898925781250000
14+
8968066875000000
15+
8926168066560000
16+
8857350000000000
17+
8981943434664571
18+
8855835700998201
19+
8910737505679793
20+
8825923015031250
21+
8983733062992534
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
VICTORY
2+
VICTORY
3+
VICTORY
4+
VICTORY
5+
VICTORY
6+
VICTORY
7+
DEFEAT
8+
VICTORY
9+
VICTORY
10+
VICTORY
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
VICTORY
2+
VICTORY
3+
VICTORY
4+
VICTORY
5+
VICTORY
6+
VICTORY
7+
VICTORY
8+
VICTORY
9+
VICTORY
10+
VICTORY
11+
VICTORY
12+
VICTORY
13+
VICTORY
14+
VICTORY
15+
VICTORY
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
DEFEAT
2+
DEFEAT
3+
DEFEAT
4+
DEFEAT
5+
DEFEAT
6+
DEFEAT
7+
DEFEAT
8+
DEFEAT
9+
DEFEAT
10+
DEFEAT
11+
DEFEAT
12+
DEFEAT
13+
DEFEAT
14+
DEFEAT
15+
DEFEAT

0 commit comments

Comments
 (0)