|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace CyrilVerloop\Codingame\Tests\Training\Hard\RollerCoaster; |
| 6 | + |
| 7 | +use CyrilVerloop\Codingame\Tests\PuzzleTest; |
| 8 | +use CyrilVerloop\Codingame\Training\Hard\RollerCoaster\RollerCoaster; |
| 9 | + |
| 10 | +/** |
| 11 | + * Tests for the "RollerCoaster" puzzle. |
| 12 | + * |
| 13 | + * @covers \CyrilVerloop\Codingame\Training\Hard\RollerCoaster\RollerCoaster |
| 14 | + * @group rollerCoaster |
| 15 | + */ |
| 16 | +final class RollerCoasterTest extends PuzzleTest |
| 17 | +{ |
| 18 | + public function setUp(): void |
| 19 | + { |
| 20 | + $this->puzzle = new RollerCoaster(); |
| 21 | + } |
| 22 | + |
| 23 | + /** |
| 24 | + * Test that the code can be executed for "Simple case". |
| 25 | + * |
| 26 | + * @group rollerCoaster_simpleCase |
| 27 | + */ |
| 28 | + public function testCanExecuteSimpleCase(): void |
| 29 | + { |
| 30 | + $this->expectExecuteOutputAnswer( |
| 31 | + __DIR__ . '/input/01 - simple case.txt', |
| 32 | + 7 . PHP_EOL |
| 33 | + ); |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Test that the code can be executed for "1000 groups of a few people". |
| 38 | + * |
| 39 | + * @group rollerCoaster_1000GroupsOfAFewPeople |
| 40 | + */ |
| 41 | + public function testCanExecute1000GroupsOfAFewPeople(): void |
| 42 | + { |
| 43 | + $this->expectExecuteOutputAnswer( |
| 44 | + __DIR__ . '/input/02 - 1000 groups of a few people.txt', |
| 45 | + 3935 . PHP_EOL |
| 46 | + ); |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Test that the code can be executed for "The same groups go on the ride several times during the day". |
| 51 | + * |
| 52 | + * @group rollerCoaster_theSameGroupsGoOnTheRideSeveralTimesDuringTheDay |
| 53 | + */ |
| 54 | + public function testCanExecuteTheSameGroupsGoOnTheRideSeveralTimesDuringTheDay(): void |
| 55 | + { |
| 56 | + $this->expectExecuteOutputAnswer( |
| 57 | + __DIR__ . '/input/03 - the same groups go on the ride several times during the day.txt', |
| 58 | + 15 . PHP_EOL |
| 59 | + ); |
| 60 | + } |
| 61 | + |
| 62 | + /** |
| 63 | + * Test that the code can be executed for "All the people get on the roller coaster at least once". |
| 64 | + * |
| 65 | + * @group rollerCoaster_allThePeopleGetOnTheRollerCoasterAtLeastOnce |
| 66 | + */ |
| 67 | + public function testCanExecuteAllThePeopleGetOnTheRollerCoasterAtLeastOnce(): void |
| 68 | + { |
| 69 | + $this->expectExecuteOutputAnswer( |
| 70 | + __DIR__ . '/input/04 - all the people get on the roller coaster at least once.txt', |
| 71 | + 15000 . PHP_EOL |
| 72 | + ); |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Test that the code can be executed for "High earnings during the day (> 2^32)". |
| 77 | + * |
| 78 | + * @group rollerCoaster_highEarningsduringTheDay |
| 79 | + */ |
| 80 | + public function testCanExecuteHighEarningsduringTheDay(): void |
| 81 | + { |
| 82 | + $this->expectExecuteOutputAnswer( |
| 83 | + __DIR__ . '/input/05 - high earnings during the day.txt', |
| 84 | + 4999975000 . PHP_EOL |
| 85 | + ); |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Test that the code can be executed for "Works with a large dataset". |
| 90 | + * |
| 91 | + * @group rollerCoaster_worksWithALargeDataset |
| 92 | + */ |
| 93 | + public function testCanExecuteWorksWithALargeDataset(): void |
| 94 | + { |
| 95 | + $this->expectExecuteOutputAnswer( |
| 96 | + __DIR__ . '/input/06 - works with a large dataset.txt', |
| 97 | + 89744892565569 . PHP_EOL |
| 98 | + ); |
| 99 | + } |
| 100 | +} |
0 commit comments