Skip to content

Commit 201e300

Browse files
committed
Adding tests for "Artificial emotional
intelligence".
1 parent 2096dd7 commit 201e300

File tree

14 files changed

+146
-0
lines changed

14 files changed

+146
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
- Tests for "Crop-circles".
2727
- Tests for "Nicholas Breakspeare and Hugh of Evesham".
2828
- Tests for "Nature of triangles".
29+
- Tests for "Artificial emotional intelligence".
2930

3031
### Changed
3132
- Renaming "Linear Bézier curves" to "Cubic Bézier curves".
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\Easy\ArtificialEmotionalIntelligence;
6+
7+
use CyrilVerloop\Codingame\Puzzle;
8+
9+
/**
10+
* The "Artificial emotional intelligence" puzzle.
11+
* @link https://www.codingame.com/ide/puzzle/artificial-emotional-intelligence
12+
*/
13+
class ArtificialEmotionalIntelligence implements Puzzle
14+
{
15+
public function execute($stdin): void
16+
{
17+
$name = stream_get_line($stdin, 256 + 1, "\n");
18+
19+
// Write an answer using echo(). DON'T FORGET THE TRAILING \n
20+
21+
echo("Hello Lisa.\n");
22+
}
23+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Tests\Community\Training\Easy\ArtificialEmotionalIntelligence;
6+
7+
use CyrilVerloop\Codingame\Tests\PuzzleTest;
8+
use CyrilVerloop\Codingame\Community\Training\Easy\ArtificialEmotionalIntelligence\ArtificialEmotionalIntelligence;
9+
10+
/**
11+
* Tests for the "Artificial emotional intelligence" puzzle.
12+
*
13+
* @covers \CyrilVerloop\Codingame\Community\Training\Easy\ArtificialEmotionalIntelligence\ArtificialEmotionalIntelligence
14+
* @group artificialEmotionalIntelligence
15+
* @medium
16+
*/
17+
final class CGTest extends PuzzleTest
18+
{
19+
public function setUp(): void
20+
{
21+
$this->puzzle = new ArtificialEmotionalIntelligence();
22+
}
23+
24+
/**
25+
* Test that the code can be executed for "Simple case".
26+
*
27+
* @group artificialEmotionalIntelligence_simpleCase
28+
*/
29+
public function testCanExecuteSimpleCase(): void
30+
{
31+
$this->expectExecuteOutputAnswer(
32+
__DIR__ . '/input/01 - simple case.txt',
33+
file_get_contents(__DIR__ . '/output/01 - simple case.txt')
34+
);
35+
}
36+
37+
/**
38+
* Test that the code can be executed for "Repeating letters and space".
39+
*
40+
* @group artificialEmotionalIntelligence_repeatingLettersAndSpace
41+
*/
42+
public function testCanExecuteRepeatingLettersAndSpace(): void
43+
{
44+
$this->expectExecuteOutputAnswer(
45+
__DIR__ . '/input/02 - repeating letters and space.txt',
46+
file_get_contents(__DIR__ . '/output/02 - repeating letters and space.txt')
47+
);
48+
}
49+
50+
/**
51+
* Test that the code can be executed for "With hyphen and period".
52+
*
53+
* @group artificialEmotionalIntelligence_withHyphenAndPeriod
54+
*/
55+
public function testCanExecuteWithHyphenAndPeriod(): void
56+
{
57+
$this->expectExecuteOutputAnswer(
58+
__DIR__ . '/input/03 - with hyphen and period.txt',
59+
file_get_contents(__DIR__ . '/output/03 - with hyphen and period.txt')
60+
);
61+
}
62+
63+
/**
64+
* Test that the code can be executed for "Symbols and numbers".
65+
*
66+
* @group artificialEmotionalIntelligence_symbolsAndNumbers
67+
*/
68+
public function testCanExecuteSymbolsAndNumbers(): void
69+
{
70+
$this->expectExecuteOutputAnswer(
71+
__DIR__ . '/input/04 - symbols and numbers.txt',
72+
file_get_contents(__DIR__ . '/output/04 - symbols and numbers.txt')
73+
);
74+
}
75+
76+
/**
77+
* Test that the code can be executed for "You are not enough".
78+
*
79+
* @group artificialEmotionalIntelligence_youAreNotEnough
80+
*/
81+
public function testCanExecuteYouAreNotEnough(): void
82+
{
83+
$this->expectExecuteOutputAnswer(
84+
__DIR__ . '/input/05 - you are not enough.txt',
85+
"Hello Libby." . PHP_EOL
86+
);
87+
}
88+
89+
/**
90+
* Test that the code can be executed for "With 'Y' and 'Z'".
91+
*
92+
* @group artificialEmotionalIntelligence_withYAndZ
93+
*/
94+
public function testCanExecuteWithYAndZ(): void
95+
{
96+
$this->expectExecuteOutputAnswer(
97+
__DIR__ . '/input/06 - with Y and Z.txt',
98+
file_get_contents(__DIR__ . '/output/06 - with Y and Z.txt')
99+
);
100+
}
101+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Frankie
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Meg Eagleton
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
K.D. Lang-McDonald
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sir A$AP the 2nd
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Libby
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lizzy Rae
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
It's so nice to meet you, my dear courageous Frankie.
2+
I sense you are both honest and hardworking.
3+
May our future together have much more love than disasters.

0 commit comments

Comments
 (0)