|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace CyrilVerloop\Codingame\Tests\Training\Expert\TheResistance; |
| 6 | + |
| 7 | +use CyrilVerloop\Codingame\Tests\PuzzleTest; |
| 8 | +use CyrilVerloop\Codingame\Training\Expert\TheResistance\TheResistance; |
| 9 | + |
| 10 | +/** |
| 11 | + * Tests for "The resistance" puzzle. |
| 12 | + * |
| 13 | + * @covers \CyrilVerloop\Codingame\Training\Expert\TheResistance\TheResistance |
| 14 | + * @group theResistance |
| 15 | + */ |
| 16 | +final class TheResistanceTest extends PuzzleTest |
| 17 | +{ |
| 18 | + public function setUp(): void |
| 19 | + { |
| 20 | + $this->puzzle = new TheResistance(); |
| 21 | + } |
| 22 | + |
| 23 | + /** |
| 24 | + * Test that the code can be executed for "Correct detection of a letter". |
| 25 | + * |
| 26 | + * @group theResistance_correctDetectionOfALetter |
| 27 | + */ |
| 28 | + public function testCanExecuteCorrectDetectionOfALetter(): void |
| 29 | + { |
| 30 | + $this->expectExecuteOutputAnswer( |
| 31 | + __DIR__ . '/input/01 - correct detection of a letter.txt', |
| 32 | + 1 . PHP_EOL |
| 33 | + ); |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Test that the code can be executed for "Correct detection of a word". |
| 38 | + * |
| 39 | + * @group theResistance_correctDetectionOfAWord |
| 40 | + */ |
| 41 | + public function testCanExecuteCorrectDetectionOfAWord(): void |
| 42 | + { |
| 43 | + $this->expectExecuteOutputAnswer( |
| 44 | + __DIR__ . '/input/02 - correct detection of a word.txt', |
| 45 | + 1 . PHP_EOL |
| 46 | + ); |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Test that the code can be executed for "Simple messages". |
| 51 | + * |
| 52 | + * @group theResistance_simpleMessages |
| 53 | + */ |
| 54 | + public function testCanExecuteSimpleMessages(): void |
| 55 | + { |
| 56 | + $this->expectExecuteOutputAnswer( |
| 57 | + __DIR__ . '/input/03 - simple messages.txt', |
| 58 | + 2 . PHP_EOL |
| 59 | + ); |
| 60 | + } |
| 61 | + |
| 62 | + /** |
| 63 | + * Test that the code can be executed for "Long sequence, large dictionary". |
| 64 | + * |
| 65 | + * @group theResistance_longSequenceLargeDictionary |
| 66 | + */ |
| 67 | + public function testCanExecuteLongSequenceLargeDictionary(): void |
| 68 | + { |
| 69 | + $this->expectExecuteOutputAnswer( |
| 70 | + __DIR__ . '/input/04 - long sequence, large dictionary.txt', |
| 71 | + 57330892800 . PHP_EOL |
| 72 | + ); |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Test that the code can be executed for "Same encoding for different words". |
| 77 | + * |
| 78 | + * @group theResistance_sameEncodingForDifferentWords |
| 79 | + */ |
| 80 | + public function testCanExecuteSameEncodingForDifferentWords(): void |
| 81 | + { |
| 82 | + $this->expectExecuteOutputAnswer( |
| 83 | + __DIR__ . '/input/05 - same encoding for different words.txt', |
| 84 | + 125 . PHP_EOL |
| 85 | + ); |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Test that the code can be executed for "Many possibilities". |
| 90 | + * |
| 91 | + * @group theResistance_manyPossibilities |
| 92 | + */ |
| 93 | + public function testCanExecuteManyPossibilities(): void |
| 94 | + { |
| 95 | + $this->expectExecuteOutputAnswer( |
| 96 | + __DIR__ . '/input/06 - many possibilities.txt', |
| 97 | + 2971215073 . PHP_EOL |
| 98 | + ); |
| 99 | + } |
| 100 | +} |
0 commit comments