Skip to content

Commit 940a6b3

Browse files
committed
Adding tests for "Detective geek".
1 parent e90b36d commit 940a6b3

File tree

17 files changed

+120
-0
lines changed

17 files changed

+120
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
- Tests for "Faro shuffle".
3131
- Tests for "Morellet’s random lines".
3232
- Tests for "Decode the message".
33+
- Tests for "Detective geek".
3334

3435
## [1.9.0] - 2022-06-01
3536
### Added
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* The "Detective geek" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/detective-geek}
4+
*/
5+
function execute(readline) {
6+
const time = readline();
7+
const address = readline();
8+
9+
// Write an answer using console.log()
10+
// To debug: console.error('Debug messages...');
11+
12+
console.log('answer');
13+
}
14+
15+
export { execute };
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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/detectiveGeek/detectiveGeek.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite("Detective geek", 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("Test 1", function() {
22+
let inputFile = new File(__dirname + 'input/01 - test 1.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - test 1.txt');
27+
});
28+
29+
test("Algeria", function() {
30+
let inputFile = new File(__dirname + 'input/02 - algeria.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assertOutputAnswer(__dirname + 'output/02 - algeria.txt');
35+
});
36+
37+
test("Egypt", function() {
38+
let inputFile = new File(__dirname + 'input/03 - egypt.txt');
39+
40+
execute(inputFile.readline.bind(inputFile));
41+
42+
assertOutputAnswer(__dirname + 'output/03 - egypt.txt');
43+
});
44+
45+
test("India", function() {
46+
let inputFile = new File(__dirname + 'input/04 - india.txt');
47+
48+
execute(inputFile.readline.bind(inputFile));
49+
50+
assertOutputAnswer(__dirname + 'output/04 - india.txt');
51+
});
52+
53+
test("Japan", function() {
54+
let inputFile = new File(__dirname + 'input/05 - japan.txt');
55+
56+
execute(inputFile.readline.bind(inputFile));
57+
58+
assertOutputAnswer(__dirname + 'output/05 - japan.txt');
59+
});
60+
61+
test("Italy", function() {
62+
let inputFile = new File(__dirname + 'input/06 - italy.txt');
63+
64+
execute(inputFile.readline.bind(inputFile));
65+
66+
assertOutputAnswer(__dirname + 'output/06 - italy.txt');
67+
});
68+
69+
test("South korea", function() {
70+
let inputFile = new File(__dirname + 'input/07 - south korea.txt');
71+
72+
execute(inputFile.readline.bind(inputFile));
73+
74+
assertOutputAnswer(__dirname + 'output/07 - south korea.txt');
75+
});
76+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#*######*#*
2+
mayjul sepsep octapr octsep sepjun octjan
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#**##**###*
2+
sepjul octjul sepjun octaug sepsep junsep sepjun sepjun sepmay marsep octjul sepjun octaug octsep sepfeb octoct octjul sepfeb octmar octsep
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
##*#**#**
2+
maysep mayfeb marsep junoct octjan marsep jundec sepsep octapr octjul sepjul sepfeb marsep junoct octjan marsep augjan octapr sepaug sepfeb octjul sepjun novfeb sepfeb marsep juldec octsep aprnov marsep julnov sepfeb octfeb octjan marsep juldec octsep sepfeb octsep sepoct octapr octmar
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
######*###
2+
maymay maymar aprdec mayapr mayfeb aprsep marsep julaug octmay octmay marsep junaug marsep mayfeb mayfeb mayapr aprsep marsep juljul sepjun octdec marsep juljun octapr octsep sepoct marsep juljul sepfeb sepaug sepfeb octjul
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#***#*#**###
2+
mayfeb mayaug mayfeb aproct mayfeb mayjan maysep mayaug aprsep marsep augjun sepfeb octjul sepfeb sepoct sepapr sepsep octapr aprsep marsep juldec sepsep sepoct octmar sepnov octoct sepdec octoct aproct sepdec octoct aprsep marsep augjan octapr sepdec novfeb octapr
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
##**##*#***
2+
augmar sepoct sepfeb marsep julmay sepjun octapr octmay sepfeb octjul sepmay sepoct marsep mayaug mayjun
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
##*#*###
2+
mayfeb maymar mayjun aproct mayaug aprsep marsep augapr octapr octmar octmay novfeb sepjun octapr octmar sepaug marsep maymar aprmay sepoct aprjun aproct sepmay octapr octmar sepaug aprsep marsep jundec octoct octfeb sepoct aproct octaug sepoct aprsep marsep jundec novfeb sepjun octapr octmar sepaug octaug sepfeb octmar sepaug sepmar octoct sepdec aproct sepmay octapr

0 commit comments

Comments
 (0)