Skip to content

Commit 315ea17

Browse files
committed
Adding tests for "Queneau numbers".
1 parent 33b77fa commit 315ea17

File tree

11 files changed

+110
-0
lines changed

11 files changed

+110
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3434
- Tests for "Bijective numeration".
3535
- Tests for "Plight of the fellowship of the ring".
3636
- Tests for "DDCG Mapper".
37+
- Tests for "Queneau numbers".
3738

3839
## [1.15.0] - 2022-11-30
3940
### Added
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* The "Queneau numbers" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/queneau-numbers}
4+
*/
5+
function execute(readline) {
6+
const N = parseInt(readline());
7+
8+
// Write an answer using console.log()
9+
// To debug: console.error('Debug messages...');
10+
11+
console.log('IMPOSSIBLE');
12+
}
13+
14+
export { execute };
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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/queneauNumbers/queneauNumbers.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite("Queneau numbers", 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("Terine", function() {
22+
let inputFile = new File(__dirname + 'input/01 - terine.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - terine.txt');
27+
});
28+
29+
test("Impossible", function() {
30+
let inputFile = new File(__dirname + 'input/02 - impossible.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assert.strictEqual(
35+
console.log.getCall(0).args[0],
36+
"IMPOSSIBLE"
37+
);
38+
});
39+
40+
test("Sextine", function() {
41+
let inputFile = new File(__dirname + 'input/03 - sextine.txt');
42+
43+
execute(inputFile.readline.bind(inputFile));
44+
45+
assertOutputAnswer(__dirname + 'output/03 - sextine.txt');
46+
});
47+
48+
test("So big yet so perfect", function() {
49+
let inputFile = new File(__dirname + 'input/04 - so big yet so perfect.txt');
50+
51+
execute(inputFile.readline.bind(inputFile));
52+
53+
assertOutputAnswer(__dirname + 'output/04 - so big yet so perfect.txt');
54+
});
55+
56+
test("So big yet so ugly", function() {
57+
let inputFile = new File(__dirname + 'input/05 - so big yet so ugly.txt');
58+
59+
execute(inputFile.readline.bind(inputFile));
60+
61+
assert.strictEqual(
62+
console.log.getCall(0).args[0],
63+
"IMPOSSIBLE"
64+
);
65+
});
66+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
15
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
27
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
3,1,2
2+
2,3,1
3+
1,2,3
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
6,1,5,2,4,3
2+
3,6,4,1,2,5
3+
5,3,2,6,1,4
4+
4,5,1,3,6,2
5+
2,4,6,5,3,1
6+
1,2,3,4,5,6

0 commit comments

Comments
 (0)