Skip to content

Commit 19d10c6

Browse files
committed
Adding tests for "1010(1)".
1 parent 4375846 commit 19d10c6

File tree

7 files changed

+112
-0
lines changed

7 files changed

+112
-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 "The urinal problem".
3333
- Tests for "2×2×2 rubik’s cube movements".
3434
- Tests for "The polish dictionary".
35+
- Tests for "1010(1)".
3536

3637
## [1.16.0] - 2022-12-31
3738
### Added
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* The "1010(1)" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/10101}
4+
*/
5+
function execute(readline) {
6+
const W = parseInt(readline());
7+
const H = parseInt(readline());
8+
for (let i = 0; i < H; i++) {
9+
const ROW = readline();
10+
}
11+
12+
// Write an answer using console.log()
13+
// To debug: console.error('Debug messages...');
14+
15+
console.log('answer');
16+
}
17+
18+
export { execute };
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { assert } from 'chai';
2+
import sinon from 'sinon';
3+
import File from '../../../../File.js';
4+
import { execute } from '../../../../../lib/community/training/medium/one0One0One/one0One0One.js';
5+
6+
const __dirname = new URL('.', import.meta.url).pathname;
7+
8+
suite("1010(1)", function() {
9+
const sandbox = sinon.createSandbox();
10+
11+
setup(function () {
12+
sandbox.stub(console, "log");
13+
});
14+
15+
teardown(function () {
16+
sandbox.restore();
17+
});
18+
19+
20+
test("Tiny", function() {
21+
let inputFile = new File(__dirname + 'input/01 - tiny.txt');
22+
23+
execute(inputFile.readline.bind(inputFile));
24+
25+
assert.strictEqual(
26+
console.log.getCall(0).args[0],
27+
4
28+
);
29+
});
30+
31+
test("Stretch", function() {
32+
let inputFile = new File(__dirname + 'input/02 - stretch.txt');
33+
34+
execute(inputFile.readline.bind(inputFile));
35+
36+
assert.strictEqual(
37+
console.log.getCall(0).args[0],
38+
2
39+
);
40+
});
41+
42+
test("You lose", function() {
43+
let inputFile = new File(__dirname + 'input/03 - you lose.txt');
44+
45+
execute(inputFile.readline.bind(inputFile));
46+
47+
assert.strictEqual(
48+
console.log.getCall(0).args[0],
49+
0
50+
);
51+
});
52+
53+
test("Big", function() {
54+
let inputFile = new File(__dirname + 'input/04 - big.txt');
55+
56+
execute(inputFile.readline.bind(inputFile));
57+
58+
assert.strictEqual(
59+
console.log.getCall(0).args[0],
60+
3
61+
);
62+
});
63+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
3
2+
3
3+
..#
4+
..#
5+
##.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
5
2+
3
3+
###..
4+
###..
5+
.....
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
6
2+
6
3+
.#.#.#
4+
#.#.#.
5+
.#.#.#
6+
#.#.#.
7+
.#.#.#
8+
#.#.#.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
10
2+
10
3+
#########.
4+
########..
5+
#######..#
6+
.#........
7+
#######.##
8+
########..
9+
########..
10+
#..#######
11+
#..#######
12+
.#..#..#..

0 commit comments

Comments
 (0)