Skip to content

Commit cf86d61

Browse files
committed
Adding tests for "Horse-hyperracing
hyperduals".
1 parent 5f06cff commit cf86d61

16 files changed

+2846
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- Tests for "Box of cigars".
2424
- Tests for "Simplified Monopoly™ turns prediction".
2525
- Tests for "Regular polygons".
26+
- Tests for "Horse-hyperracing hyperduals".
2627

2728
## [3.13.0] - 2022-09-30
2829
### Added
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Community\Training\Medium\HorseHyperracingHyperduals;
6+
7+
use CyrilVerloop\Codingame\Puzzle;
8+
9+
/**
10+
* The "Horse-hyperracing hyperduals" puzzle.
11+
* @link https://www.codingame.com/ide/puzzle/horse-hyperracing-hyperduals
12+
*/
13+
class HorseHyperracingHyperduals implements Puzzle
14+
{
15+
public function execute($stdin): void
16+
{
17+
fscanf($stdin, "%d %d %d", $N, $M, $X);
18+
for ($i = 0; $i < $N; $i++)
19+
{
20+
fscanf($stdin, "%d %d", $V, $E);
21+
}
22+
23+
// Write an answer using echo(). DON'T FORGET THE TRAILING \n
24+
25+
echo("42\n");
26+
}
27+
}
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Tests\Community\Training\Medium\HorseHyperracingHyperduals;
6+
7+
use CyrilVerloop\Codingame\Tests\PuzzleTest;
8+
use CyrilVerloop\Codingame\Community\Training\Medium\HorseHyperracingHyperduals\HorseHyperracingHyperduals;
9+
10+
/**
11+
* Tests for the "Horse-hyperracing hyperduals" puzzle.
12+
*
13+
* @covers \CyrilVerloop\Codingame\Community\Training\Medium\HorseHyperracingHyperduals\HorseHyperracingHyperduals
14+
* @group horseHyperracingHyperduals
15+
* @medium
16+
*/
17+
final class CGTest extends PuzzleTest
18+
{
19+
public function setUp(): void
20+
{
21+
$this->puzzle = new HorseHyperracingHyperduals();
22+
}
23+
24+
/**
25+
* Test that the code can be executed for "Check your LCG".
26+
*
27+
* @group horseHyperracingHyperduals_checkYourLCG
28+
*/
29+
public function testCanExecuteCheckYourLCG(): void
30+
{
31+
$this->expectExecuteOutputAnswer(
32+
__DIR__ . '/input/01 - check your LCG.txt',
33+
1372193593 . PHP_EOL
34+
);
35+
}
36+
37+
/**
38+
* Test that the code can be executed for "2D horses".
39+
*
40+
* @group horseHyperracingHyperduals_2DHorses
41+
*/
42+
public function testCanExecute2DHorses(): void
43+
{
44+
$this->expectExecuteOutputAnswer(
45+
__DIR__ . '/input/02 - 2D horses.txt',
46+
345805 . PHP_EOL
47+
);
48+
}
49+
50+
/**
51+
* Test that the code can be executed for "A fistful of horses".
52+
*
53+
* @group horseHyperracingHyperduals_aFistfulOfHorses
54+
*/
55+
public function testCanExecuteAFistfulOfHorses(): void
56+
{
57+
$this->expectExecuteOutputAnswer(
58+
__DIR__ . '/input/03 - a fistful of horses.txt',
59+
97225 . PHP_EOL
60+
);
61+
}
62+
63+
/**
64+
* Test that the code can be executed for "For a few horse more".
65+
*
66+
* @group horseHyperracingHyperduals_forAFewHorseMore
67+
*/
68+
public function testCanExecuteForAFewHorseMore(): void
69+
{
70+
$this->expectExecuteOutputAnswer(
71+
__DIR__ . '/input/04 - for a few horse more.txt',
72+
35608 . PHP_EOL
73+
);
74+
}
75+
76+
/**
77+
* Test that the code can be executed for "All your horse are belong to us".
78+
*
79+
* @group horseHyperracingHyperduals_allYourHorseAreBelongToUs
80+
*/
81+
public function testCanExecuteAllYourHorseAreBelongToUs(): void
82+
{
83+
$this->expectExecuteOutputAnswer(
84+
__DIR__ . '/input/05 - all your horse are belong to us.txt',
85+
33322 . PHP_EOL
86+
);
87+
}
88+
89+
/**
90+
* Test that the code can be executed for "Many horses".
91+
*
92+
* @group horseHyperracingHyperduals_manyHorses
93+
*/
94+
public function testCanExecuteManyHorses(): void
95+
{
96+
$this->expectExecuteOutputAnswer(
97+
__DIR__ . '/input/06 - many horses.txt',
98+
1293 . PHP_EOL
99+
);
100+
}
101+
102+
/**
103+
* Test that the code can be executed for "More horse".
104+
*
105+
* @group horseHyperracingHyperduals_moreHorse
106+
*/
107+
public function testCanExecuteMoreHorse(): void
108+
{
109+
$this->expectExecuteOutputAnswer(
110+
__DIR__ . '/input/07 - more horse.txt',
111+
4748656 . PHP_EOL
112+
);
113+
}
114+
115+
/**
116+
* Test that the code can be executed for "Horse OVER 9000!".
117+
*
118+
* @group horseHyperracingHyperduals_horseOVER9000
119+
*/
120+
public function testCanExecuteHorseOVER9000(): void
121+
{
122+
$this->expectExecuteOutputAnswer(
123+
__DIR__ . '/input/08 - horse OVER 9000!.txt',
124+
225840 . PHP_EOL
125+
);
126+
}
127+
128+
/**
129+
* Test that the code can be executed for "Horse overflow".
130+
*
131+
* @group horseHyperracingHyperduals_horseOverflow
132+
*/
133+
public function testCanExecuteHorseOverflow(): void
134+
{
135+
$this->expectExecuteOutputAnswer(
136+
__DIR__ . '/input/09 - horse overflow.txt',
137+
75280 . PHP_EOL
138+
);
139+
}
140+
141+
/**
142+
* Test that the code can be executed for "Can't leave racers sitting horizontally".
143+
*
144+
* @group horseHyperracingHyperduals_cantLeaveRacersSittingHorizontally
145+
*/
146+
public function testCanExecuteCantLeaveRacersSittingHorizontally(): void
147+
{
148+
$this->expectExecuteOutputAnswer(
149+
__DIR__ . '/input/10 - can\'t leave racers sitting horizontally.txt',
150+
1713883 . PHP_EOL
151+
);
152+
}
153+
154+
/**
155+
* Test that the code can be executed for "Can't leave racers sitting vertically either".
156+
*
157+
* @group horseHyperracingHyperduals_cantLeaveRacersSittingVerticallyEither
158+
*/
159+
public function testCanExecuteCantLeaveRacersSittingVerticallyEither(): void
160+
{
161+
$this->expectExecuteOutputAnswer(
162+
__DIR__ . '/input/11 - can\'t leave racers sitting vertically either.txt',
163+
1713883 . PHP_EOL
164+
);
165+
}
166+
167+
/**
168+
* Test that the code can be executed for "Peak zexion".
169+
*
170+
* @group horseHyperracingHyperduals_peakZexion
171+
*/
172+
public function testCanExecutePeakZexion(): void
173+
{
174+
$this->expectExecuteOutputAnswer(
175+
__DIR__ . '/input/12 - peak zexion.txt',
176+
75242 . PHP_EOL
177+
);
178+
}
179+
180+
/**
181+
* Test that the code can be executed for "Roll JBM".
182+
*
183+
* @group horseHyperracingHyperduals_rollJBM
184+
*/
185+
public function testCanExecuteRollJBM(): void
186+
{
187+
$this->expectExecuteOutputAnswer(
188+
__DIR__ . '/input/13 - roll JBM.txt',
189+
75279 . PHP_EOL
190+
);
191+
}
192+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1 2 42424242
2+
0 0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
20 0 0
2+
4618437 6674593
3+
3514840 7691515
4+
2672663 1665342
5+
5631166 6201289
6+
9945095 3677291
7+
1512462 4361
8+
2505387 5874765
9+
1291399 7215528
10+
1660077 787560
11+
9931494 5381878
12+
7915213 4933424
13+
4831249 1702132
14+
8635501 764174
15+
4280909 6682870
16+
5130005 1332040
17+
2404884 8112820
18+
6220969 1077590
19+
1304552 5025490
20+
8009975 8931210
21+
3783886 8177379
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
100 0 0
2+
476232 6099056
3+
1252195 8195024
4+
5179797 3726665
5+
2529858 9172796
6+
7961959 2561085
7+
9263926 3845617
8+
2456202 6000415
9+
9192480 3336489
10+
8385706 3436795
11+
7633011 3341236
12+
9600683 7771955
13+
4180801 4369825
14+
7882543 5920460
15+
7642730 151115
16+
1369927 8322244
17+
2964558 6707262
18+
7788173 1490791
19+
8991412 7392994
20+
5321429 413931
21+
8568890 6052054
22+
3473046 1616509
23+
7091766 49737
24+
3913880 9460643
25+
3515415 2384655
26+
6699786 7028201
27+
9970257 1358714
28+
710257 3086432
29+
5400992 2792219
30+
2362365 222315
31+
2561008 2817585
32+
3011758 8441447
33+
729903 4583383
34+
670590 8216624
35+
2721940 4369326
36+
4237122 7149588
37+
179753 7677875
38+
110994 2742519
39+
6396540 3760912
40+
9410680 8086228
41+
8608224 4098416
42+
4845345 8038040
43+
9002862 1814263
44+
6233776 6318808
45+
4797363 1542758
46+
2600525 2196497
47+
6352079 3404672
48+
2388101 2490411
49+
9183978 7476586
50+
5558651 6629134
51+
1182081 2311080
52+
6955727 686161
53+
2639207 9963413
54+
7273848 9616226
55+
737340 1784216
56+
139513 4394573
57+
5737251 1535489
58+
3222188 4149579
59+
6734466 1672743
60+
828881 9560738
61+
5892729 2810128
62+
1233882 7310373
63+
1523550 7254201
64+
5979735 925498
65+
9248067 3268740
66+
761882 8279829
67+
3288654 4536675
68+
9263699 2854534
69+
5256788 7641273
70+
6708636 4746187
71+
8726430 1728770
72+
8990622 8683541
73+
4535498 7676634
74+
4362813 2949997
75+
3800137 6819590
76+
6919651 3240441
77+
4746861 730059
78+
6890407 4900751
79+
1886958 6767077
80+
247994 1652869
81+
5027767 8561296
82+
5779668 7401376
83+
3919775 4662213
84+
8802825 3808880
85+
6791371 2012836
86+
7656948 1433158
87+
6970220 7418201
88+
8260610 7911150
89+
7608637 9825366
90+
7970563 7182155
91+
6128062 8027917
92+
8079463 8449669
93+
5314462 2747934
94+
3182400 9529169
95+
9502662 3239530
96+
9753972 3615219
97+
1485409 7313285
98+
8312047 1178908
99+
7705447 9619362
100+
6988250 4685659
101+
7000551 7174156

0 commit comments

Comments
 (0)