Skip to content

Commit 41a3c55

Browse files
committed
Adding tests for "Mountain map".
1 parent 00f543d commit 41a3c55

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* The "Next growing number" puzzle.
3+
*/
4+
function execute(readline) {
5+
const n = readline();
6+
7+
// Write an answer using console.log()
8+
// To debug: console.error('Debug messages...');
9+
10+
console.log('answer');
11+
}
12+
13+
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/mayTheTriforceBeWithYou/mayTheTriforceBeWithYou.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite('May the Triforce be with you!', 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('N = 1', function() {
22+
let inputFile = new File(__dirname + 'input/01 - N=1.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - N=1.txt');
27+
});
28+
29+
test('N = 3', function() {
30+
let inputFile = new File(__dirname + 'input/02 - N=3.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assertOutputAnswer(__dirname + 'output/02 - N=3.txt');
35+
});
36+
37+
test('N = 5', function() {
38+
let inputFile = new File(__dirname + 'input/03 - N=5.txt');
39+
40+
execute(inputFile.readline.bind(inputFile));
41+
42+
assertOutputAnswer(__dirname + 'output/03 - N=5.txt');
43+
});
44+
45+
test('N = 10', function() {
46+
let inputFile = new File(__dirname + 'input/04 - N=10.txt');
47+
48+
execute(inputFile.readline.bind(inputFile));
49+
50+
assertOutputAnswer(__dirname + 'output/04 - N=10.txt');
51+
});
52+
});

0 commit comments

Comments
 (0)