Skip to content

Commit c6e9584

Browse files
committed
Adding tests for "Detective geek".
1 parent 4bda009 commit c6e9584

File tree

17 files changed

+167
-0
lines changed

17 files changed

+167
-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
## [3.9.0] - 2022-06-01
3536
### Added
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Community\Training\Easy\DetectiveGeek;
6+
7+
use CyrilVerloop\Codingame\Puzzle;
8+
9+
/**
10+
* The "Detective geek" puzzle.
11+
* @link https://www.codingame.com/ide/puzzle/detective-geek
12+
*/
13+
class DetectiveGeek implements Puzzle
14+
{
15+
public function execute($stdin): void
16+
{
17+
$time = stream_get_line($stdin, 32 + 1, "\n");
18+
$address = stream_get_line($stdin, 2048 + 1, "\n");
19+
20+
// Write an answer using echo(). DON'T FORGET THE TRAILING \n
21+
22+
echo("answer\n");
23+
}
24+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Tests\Community\Training\Easy\DetectiveGeek;
6+
7+
use CyrilVerloop\Codingame\Tests\PuzzleTest;
8+
use CyrilVerloop\Codingame\Community\Training\Easy\DetectiveGeek\DetectiveGeek;
9+
10+
/**
11+
* Tests for the "Detective geek" puzzle.
12+
*
13+
* @covers \CyrilVerloop\Codingame\Community\Training\Easy\DetectiveGeek\DetectiveGeek
14+
* @group detectiveGeek
15+
* @medium
16+
*/
17+
final class CGTest extends PuzzleTest
18+
{
19+
public function setUp(): void
20+
{
21+
$this->puzzle = new DetectiveGeek();
22+
}
23+
24+
/**
25+
* Test that the code can be executed for "Test 1".
26+
*
27+
* @group detectiveGeek_test1
28+
*/
29+
public function testCanExecuteTest1(): void
30+
{
31+
$this->expectExecuteOutputAnswer(
32+
__DIR__ . '/input/01 - test 1.txt',
33+
file_get_contents(__DIR__ . '/output/01 - test 1.txt')
34+
);
35+
}
36+
37+
/**
38+
* Test that the code can be executed for "Algeria".
39+
*
40+
* @group detectiveGeek_algeria
41+
*/
42+
public function testCanExecuteAlgeria(): void
43+
{
44+
$this->expectExecuteOutputAnswer(
45+
__DIR__ . '/input/02 - algeria.txt',
46+
file_get_contents(__DIR__ . '/output/02 - algeria.txt')
47+
);
48+
}
49+
50+
/**
51+
* Test that the code can be executed for "Egypt".
52+
*
53+
* @group detectiveGeek_egypt
54+
*/
55+
public function testCanExecuteEgypt(): void
56+
{
57+
$this->expectExecuteOutputAnswer(
58+
__DIR__ . '/input/03 - egypt.txt',
59+
file_get_contents(__DIR__ . '/output/03 - egypt.txt')
60+
);
61+
}
62+
63+
/**
64+
* Test that the code can be executed for "India".
65+
*
66+
* @group detectiveGeek_india
67+
*/
68+
public function testCanExecuteIndia(): void
69+
{
70+
$this->expectExecuteOutputAnswer(
71+
__DIR__ . '/input/04 - india.txt',
72+
file_get_contents(__DIR__ . '/output/04 - india.txt')
73+
);
74+
}
75+
76+
/**
77+
* Test that the code can be executed for "Japan".
78+
*
79+
* @group detectiveGeek_japan
80+
*/
81+
public function testCanExecuteJapan(): void
82+
{
83+
$this->expectExecuteOutputAnswer(
84+
__DIR__ . '/input/05 - japan.txt',
85+
file_get_contents(__DIR__ . '/output/05 - japan.txt')
86+
);
87+
}
88+
89+
/**
90+
* Test that the code can be executed for "Italy".
91+
*
92+
* @group detectiveGeek_italy
93+
*/
94+
public function testCanExecuteItaly(): void
95+
{
96+
$this->expectExecuteOutputAnswer(
97+
__DIR__ . '/input/06 - italy.txt',
98+
file_get_contents(__DIR__ . '/output/06 - italy.txt')
99+
);
100+
}
101+
102+
/**
103+
* Test that the code can be executed for "South korea".
104+
*
105+
* @group detectiveGeek_southKorea
106+
*/
107+
public function testCanExecuteSouthKorea(): void
108+
{
109+
$this->expectExecuteOutputAnswer(
110+
__DIR__ . '/input/07 - south korea.txt',
111+
file_get_contents(__DIR__ . '/output/07 - south korea.txt')
112+
);
113+
}
114+
}
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)