Skip to content

Commit cb62bae

Browse files
committed
Adding tests for "Queneau numbers".
1 parent cd9f562 commit cb62bae

File tree

11 files changed

+141
-0
lines changed

11 files changed

+141
-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
### Fixed
3940
- Tests groups for "CGFunge interpreter".
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Community\Training\Medium\QueneauNumbers;
6+
7+
use CyrilVerloop\Codingame\Puzzle;
8+
9+
/**
10+
* The "Queneau numbers" puzzle.
11+
* @link https://www.codingame.com/ide/puzzle/queneau-numbers
12+
*/
13+
class QueneauNumbers implements Puzzle
14+
{
15+
public function execute($stdin): void
16+
{
17+
fscanf($stdin, "%d", $N);
18+
19+
// Write an answer using echo(). DON'T FORGET THE TRAILING \n
20+
21+
echo("IMPOSSIBLE\n");
22+
}
23+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Tests\Community\Training\Medium\QueneauNumbers;
6+
7+
use CyrilVerloop\Codingame\Tests\PuzzleTest;
8+
use CyrilVerloop\Codingame\Community\Training\Medium\QueneauNumbers\QueneauNumbers;
9+
10+
/**
11+
* Tests for the "Queneau numbers" puzzle.
12+
*
13+
* @covers \CyrilVerloop\Codingame\Community\Training\Medium\QueneauNumbers\QueneauNumbers
14+
* @group queneauNumbers
15+
* @medium
16+
*/
17+
final class CGTest extends PuzzleTest
18+
{
19+
public function setUp(): void
20+
{
21+
$this->puzzle = new QueneauNumbers();
22+
}
23+
24+
/**
25+
* Test that the code can be executed for "Terine".
26+
*
27+
* @group queneauNumbers_terine
28+
*/
29+
public function testCanExecuteTerine(): void
30+
{
31+
$this->expectExecuteOutputAnswer(
32+
__DIR__ . '/input/01 - terine.txt',
33+
file_get_contents(__DIR__ . '/output/01 - terine.txt')
34+
);
35+
}
36+
37+
/**
38+
* Test that the code can be executed for "Impossible".
39+
*
40+
* @group queneauNumbers_impossible
41+
*/
42+
public function testCanExecuteImpossible(): void
43+
{
44+
$this->expectExecuteOutputAnswer(
45+
__DIR__ . '/input/02 - impossible.txt',
46+
"IMPOSSIBLE" . PHP_EOL
47+
);
48+
}
49+
50+
/**
51+
* Test that the code can be executed for "Sextine".
52+
*
53+
* @group queneauNumbers_sextine
54+
*/
55+
public function testCanExecuteSextine(): void
56+
{
57+
$this->expectExecuteOutputAnswer(
58+
__DIR__ . '/input/03 - sextine.txt',
59+
file_get_contents(__DIR__ . '/output/03 - sextine.txt')
60+
);
61+
}
62+
63+
/**
64+
* Test that the code can be executed for "So big yet so perfect".
65+
*
66+
* @group queneauNumbers_soBigYetSoPerfect
67+
*/
68+
public function testCanExecuteSoBigYetSoPerfect(): void
69+
{
70+
$this->expectExecuteOutputAnswer(
71+
__DIR__ . '/input/04 - so big yet so perfect.txt',
72+
file_get_contents(__DIR__ . '/output/04 - so big yet so perfect.txt')
73+
);
74+
}
75+
76+
/**
77+
* Test that the code can be executed for "So big yet so ugly".
78+
*
79+
* @group queneauNumbers_soBigYetSoUgly
80+
*/
81+
public function testCanExecuteSoBigYetSoUgly(): void
82+
{
83+
$this->expectExecuteOutputAnswer(
84+
__DIR__ . '/input/05 - so big yet so ugly.txt',
85+
"IMPOSSIBLE" . PHP_EOL
86+
);
87+
}
88+
}
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)