Skip to content

Commit 4d614e5

Browse files
committed
Adding tests for "3×N tiling".
1 parent 23a3425 commit 4d614e5

25 files changed

+291
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
- Tests for "Simplified Monopoly™ turns prediction".
2525
- Tests for "Regular polygons".
2626
- Tests for "Horse-hyperracing hyperduals".
27+
- Tests for "3×N tiling".
2728

2829
## [1.13.0] - 2022-09-30
2930
### Added
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* The "3×N tiling" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/3n-tiling}
4+
*/
5+
function execute(readline) {
6+
const T = parseInt(readline());
7+
for (let i = 0; i < T; i++) {
8+
var inputs = readline().split(' ');
9+
const K = parseInt(inputs[0]);
10+
const N = parseInt(inputs[1]);
11+
}
12+
for (let i = 0; i < T; i++) {
13+
14+
// Write an answer using console.log()
15+
// To debug: console.error('Debug messages...');
16+
17+
console.log('W');
18+
}
19+
}
20+
21+
export { execute };
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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/medium/threeByNTiling/threeByNTiling.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite("3×N tiling", 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("1×N possible", function() {
22+
let inputFile = new File(__dirname + 'input/01 - 1×N possible.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - 1×N possible.txt');
27+
});
28+
29+
test("1×N impossible", function() {
30+
let inputFile = new File(__dirname + 'input/02 - 1×N impossible.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assertOutputAnswer(__dirname + 'output/02 - 1×N impossible.txt');
35+
});
36+
37+
test("1×N mixed", function() {
38+
let inputFile = new File(__dirname + 'input/03 - 1×N mixed.txt');
39+
40+
execute(inputFile.readline.bind(inputFile));
41+
42+
assertOutputAnswer(__dirname + 'output/03 - 1×N mixed.txt');
43+
});
44+
45+
test("2×N simple", function() {
46+
let inputFile = new File(__dirname + 'input/04 - 2×N simple.txt');
47+
48+
execute(inputFile.readline.bind(inputFile));
49+
50+
assertOutputAnswer(__dirname + 'output/04 - 2×N simple.txt');
51+
});
52+
53+
test("2×N intermediate", function() {
54+
let inputFile = new File(__dirname + 'input/05 - 2×N intermediate.txt');
55+
56+
execute(inputFile.readline.bind(inputFile));
57+
58+
assertOutputAnswer(__dirname + 'output/05 - 2×N intermediate.txt');
59+
});
60+
61+
test("2×N advanced", function() {
62+
let inputFile = new File(__dirname + 'input/06 - 2×N advanced.txt');
63+
64+
execute(inputFile.readline.bind(inputFile));
65+
66+
assertOutputAnswer(__dirname + 'output/06 - 2×N advanced.txt');
67+
});
68+
69+
test("3×N simple", function() {
70+
let inputFile = new File(__dirname + 'input/07 - 3×N simple.txt');
71+
72+
execute(inputFile.readline.bind(inputFile));
73+
74+
assertOutputAnswer(__dirname + 'output/07 - 3×N simple.txt');
75+
});
76+
77+
test("3×N intermediate", function() {
78+
let inputFile = new File(__dirname + 'input/08 - 3×N intermediate.txt');
79+
80+
execute(inputFile.readline.bind(inputFile));
81+
82+
assertOutputAnswer(__dirname + 'output/08 - 3×N intermediate.txt');
83+
});
84+
85+
test("3×N advanced", function() {
86+
let inputFile = new File(__dirname + 'input/09 - 3×N advanced.txt');
87+
88+
execute(inputFile.readline.bind(inputFile));
89+
90+
assertOutputAnswer(__dirname + 'output/09 - 3×N advanced.txt');
91+
});
92+
93+
test("Mixed", function() {
94+
let inputFile = new File(__dirname + 'input/10 - mixed.txt');
95+
96+
execute(inputFile.readline.bind(inputFile));
97+
98+
assertOutputAnswer(__dirname + 'output/10 - mixed.txt');
99+
});
100+
101+
test("You might want to check these", function() {
102+
let inputFile = new File(__dirname + 'input/11 - you might want to check these.txt');
103+
104+
execute(inputFile.readline.bind(inputFile));
105+
106+
assertOutputAnswer(__dirname + 'output/11 - you might want to check these.txt');
107+
});
108+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2
2+
1 6
3+
1 9
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2
2+
1 5
3+
1 10
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
5
2+
1 6
3+
1 19
4+
1 23
5+
1 33
6+
1 69
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3
2+
2 1
3+
2 2
4+
2 3
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
10
2+
2 1
3+
2 12
4+
2 32
5+
2 14
6+
2 35
7+
2 64
8+
2 17
9+
2 84
10+
2 94
11+
2 10
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
10
2+
2 999891
3+
2 929992
4+
2 999993
5+
2 999994
6+
2 999995
7+
2 999996
8+
2 999997
9+
2 999998
10+
2 999999
11+
2 1000000
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3
2+
3 1
3+
3 2
4+
3 3

0 commit comments

Comments
 (0)