|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace CyrilVerloop\Codingame\Tests\Community\Training\Easy\OneDSpreadsheet; |
| 6 | + |
| 7 | +use CyrilVerloop\Codingame\Tests\PuzzleTest; |
| 8 | +use CyrilVerloop\Codingame\Community\Training\Easy\OneDSpreadsheet\OneDSpreadsheet; |
| 9 | + |
| 10 | +/** |
| 11 | + * Tests for the "1D spreadsheet" puzzle. |
| 12 | + * |
| 13 | + * @covers \CyrilVerloop\Codingame\Community\Training\Easy\OneDSpreadsheet\OneDSpreadsheet |
| 14 | + * @group 1DSpreadsheet |
| 15 | + * @medium |
| 16 | + */ |
| 17 | +final class CGTest extends PuzzleTest |
| 18 | +{ |
| 19 | + public function setUp(): void |
| 20 | + { |
| 21 | + $this->puzzle = new OneDSpreadsheet(); |
| 22 | + } |
| 23 | + |
| 24 | + /** |
| 25 | + * Test that the code can be executed for "Simple dependency". |
| 26 | + * |
| 27 | + * @group 1DSpreadsheet_simpleDependency |
| 28 | + */ |
| 29 | + public function testCanExecuteSimpleDependency(): void |
| 30 | + { |
| 31 | + $this->expectExecuteOutputAnswer( |
| 32 | + __DIR__ . '/input/01 - simple dependency.txt', |
| 33 | + file_get_contents(__DIR__ . '/output/01 - simple dependency.txt') |
| 34 | + ); |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Test that the code can be executed for "Double dependency". |
| 39 | + * |
| 40 | + * @group 1DSpreadsheet_doubleDependency |
| 41 | + */ |
| 42 | + public function testCanExecuteDoubleDependency(): void |
| 43 | + { |
| 44 | + $this->expectExecuteOutputAnswer( |
| 45 | + __DIR__ . '/input/02 - double dependency.txt', |
| 46 | + file_get_contents(__DIR__ . '/output/02 - double dependency.txt') |
| 47 | + ); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Test that the code can be executed for "Subtraction". |
| 52 | + * |
| 53 | + * @group 1DSpreadsheet_subtraction |
| 54 | + */ |
| 55 | + public function testCanExecuteSubtraction(): void |
| 56 | + { |
| 57 | + $this->expectExecuteOutputAnswer( |
| 58 | + __DIR__ . '/input/03 - subtraction.txt', |
| 59 | + file_get_contents(__DIR__ . '/output/03 - subtraction.txt') |
| 60 | + ); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Test that the code can be executed for "Multiplication". |
| 65 | + * |
| 66 | + * @group 1DSpreadsheet_multiplication |
| 67 | + */ |
| 68 | + public function testCanExecuteMultiplication(): void |
| 69 | + { |
| 70 | + $this->expectExecuteOutputAnswer( |
| 71 | + __DIR__ . '/input/04 - multiplication.txt', |
| 72 | + file_get_contents(__DIR__ . '/output/04 - multiplication.txt') |
| 73 | + ); |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * Test that the code can be executed for "No dependencies". |
| 78 | + * |
| 79 | + * @group 1DSpreadsheet_noDependencies |
| 80 | + */ |
| 81 | + public function testCanExecuteNoDependencies(): void |
| 82 | + { |
| 83 | + $this->expectExecuteOutputAnswer( |
| 84 | + __DIR__ . '/input/05 - no dependencies.txt', |
| 85 | + file_get_contents(__DIR__ . '/output/05 - no dependencies.txt') |
| 86 | + ); |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * Test that the code can be executed for "Coefficients". |
| 91 | + * |
| 92 | + * @group 1DSpreadsheet_coefficients |
| 93 | + */ |
| 94 | + public function testCanExecuteCoefficients(): void |
| 95 | + { |
| 96 | + $this->expectExecuteOutputAnswer( |
| 97 | + __DIR__ . '/input/06 - coefficients.txt', |
| 98 | + file_get_contents(__DIR__ . '/output/06 - coefficients.txt') |
| 99 | + ); |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * Test that the code can be executed for "Fibonacci". |
| 104 | + * |
| 105 | + * @group 1DSpreadsheet_fibonacci |
| 106 | + */ |
| 107 | + public function testCanExecuteFibonacci(): void |
| 108 | + { |
| 109 | + $this->expectExecuteOutputAnswer( |
| 110 | + __DIR__ . '/input/07 - fibonacci.txt', |
| 111 | + file_get_contents(__DIR__ . '/output/07 - fibonacci.txt') |
| 112 | + ); |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * Test that the code can be executed for "Backward dependency". |
| 117 | + * |
| 118 | + * @group 1DSpreadsheet_backwardDependency |
| 119 | + */ |
| 120 | + public function testCanExecuteBackwardDependency(): void |
| 121 | + { |
| 122 | + $this->expectExecuteOutputAnswer( |
| 123 | + __DIR__ . '/input/08 - backward dependency.txt', |
| 124 | + file_get_contents(__DIR__ . '/output/08 - backward dependency.txt') |
| 125 | + ); |
| 126 | + } |
| 127 | + |
| 128 | + /** |
| 129 | + * Test that the code can be executed for "Diamond dependency". |
| 130 | + * |
| 131 | + * @group 1DSpreadsheet_diamondDependency |
| 132 | + */ |
| 133 | + public function testCanExecuteDiamondDependency(): void |
| 134 | + { |
| 135 | + $this->expectExecuteOutputAnswer( |
| 136 | + __DIR__ . '/input/09 - diamond dependency.txt', |
| 137 | + file_get_contents(__DIR__ . '/output/09 - diamond dependency.txt') |
| 138 | + ); |
| 139 | + } |
| 140 | + |
| 141 | + /** |
| 142 | + * Test that the code can be executed for "Accounting is easy". |
| 143 | + * |
| 144 | + * @group 1DSpreadsheet_accountingIsEasy |
| 145 | + */ |
| 146 | + public function testCanExecuteAccountingIsEasy(): void |
| 147 | + { |
| 148 | + $this->expectExecuteOutputAnswer( |
| 149 | + __DIR__ . '/input/10 - accounting is easy.txt', |
| 150 | + file_get_contents(__DIR__ . '/output/10 - accounting is easy.txt') |
| 151 | + ); |
| 152 | + } |
| 153 | + |
| 154 | + /** |
| 155 | + * Test that the code can be executed for "Accounting is hard 1". |
| 156 | + * |
| 157 | + * @group 1DSpreadsheet_accountingIsHard1 |
| 158 | + */ |
| 159 | + public function testCanExecuteAccountingIsHard1(): void |
| 160 | + { |
| 161 | + $this->expectExecuteOutputAnswer( |
| 162 | + __DIR__ . '/input/11 - accounting is hard 1.txt', |
| 163 | + file_get_contents(__DIR__ . '/output/11 - accounting is hard 1.txt') |
| 164 | + ); |
| 165 | + } |
| 166 | + |
| 167 | + /** |
| 168 | + * Test that the code can be executed for "Accounting is hard 2". |
| 169 | + * |
| 170 | + * @group 1DSpreadsheet_accountingIsHard2 |
| 171 | + */ |
| 172 | + public function testCanExecuteAccountingIsHard2(): void |
| 173 | + { |
| 174 | + $this->expectExecuteOutputAnswer( |
| 175 | + __DIR__ . '/input/12 - accounting is hard 2.txt', |
| 176 | + file_get_contents(__DIR__ . '/output/12 - accounting is hard 2.txt') |
| 177 | + ); |
| 178 | + } |
| 179 | + |
| 180 | + /** |
| 181 | + * Test that the code can be executed for "Deep birecursion". |
| 182 | + * |
| 183 | + * @group 1DSpreadsheet_deepBirecursion |
| 184 | + */ |
| 185 | + public function testCanExecuteDeepBirecursion(): void |
| 186 | + { |
| 187 | + $this->expectExecuteOutputAnswer( |
| 188 | + __DIR__ . '/input/13 - deep birecursion.txt', |
| 189 | + file_get_contents(__DIR__ . '/output/13 - deep birecursion.txt') |
| 190 | + ); |
| 191 | + } |
| 192 | +} |
0 commit comments