Skip to content

Commit 2aa164c

Browse files
committed
Adding tests for "1000000000D world".
1 parent e217634 commit 2aa164c

File tree

10 files changed

+155
-0
lines changed

10 files changed

+155
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
### Added
9+
- Tests for "1000000000D world".
10+
711
## [3.4.0] - 2022-02-21
812
### Added
913
- Tests for "1D bush fire".
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\OneBillionDWorld;
6+
7+
use CyrilVerloop\Codingame\Puzzle;
8+
9+
/**
10+
* The "1000000000D world" puzzle.
11+
*/
12+
class OneBillionDWorld implements Puzzle
13+
{
14+
public function execute($stdin): void
15+
{
16+
$a = stream_get_line($stdin, 1000 + 1, "\n");
17+
$b = stream_get_line($stdin, 1000 + 1, "\n");
18+
19+
// Write an answer using echo(). DON'T FORGET THE TRAILING \n
20+
21+
echo("a DOT b\n");
22+
}
23+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Tests\Community\Training\Easy\OneBillionDWorld;
6+
7+
use CyrilVerloop\Codingame\Tests\PuzzleTest;
8+
use CyrilVerloop\Codingame\Community\Training\Easy\OneBillionDWorld\OneBillionDWorld;
9+
10+
/**
11+
* Tests for the "1000000000D world" puzzle.
12+
*
13+
* @covers \CyrilVerloop\Codingame\Community\Training\Easy\OneBillionDWorld\OneBillionDWorld
14+
* @group oneBillionDWorld
15+
* @medium
16+
*/
17+
final class CGTest extends PuzzleTest
18+
{
19+
public function setUp(): void
20+
{
21+
$this->puzzle = new OneBillionDWorld();
22+
}
23+
24+
/**
25+
* Test that the code can be executed for "Test 1".
26+
*
27+
* @group oneBillionDWorld_test1
28+
*/
29+
public function testCanExecuteTest1(): void
30+
{
31+
$this->expectExecuteOutputAnswer(
32+
__DIR__ . '/input/01 - test 1.txt',
33+
2 . PHP_EOL
34+
);
35+
}
36+
37+
/**
38+
* Test that the code can be executed for "Test 2".
39+
*
40+
* @group oneBillionDWorld_test2
41+
*/
42+
public function testCanExecuteTest2(): void
43+
{
44+
$this->expectExecuteOutputAnswer(
45+
__DIR__ . '/input/02 - test 2.txt',
46+
17 . PHP_EOL
47+
);
48+
}
49+
50+
/**
51+
* Test that the code can be executed for "Test 3".
52+
*
53+
* @group oneBillionDWorld_test3
54+
*/
55+
public function testCanExecuteTest3(): void
56+
{
57+
$this->expectExecuteOutputAnswer(
58+
__DIR__ . '/input/03 - test 3.txt',
59+
-1000000000 . PHP_EOL
60+
);
61+
}
62+
63+
/**
64+
* Test that the code can be executed for "Test 4".
65+
*
66+
* @group oneBillionDWorld_test4
67+
*/
68+
public function testCanExecuteTest4(): void
69+
{
70+
$this->expectExecuteOutputAnswer(
71+
__DIR__ . '/input/04 - test 4.txt',
72+
-1999999395 . PHP_EOL
73+
);
74+
}
75+
76+
/**
77+
* Test that the code can be executed for "Test 5".
78+
*
79+
* @group oneBillionDWorld_test5
80+
*/
81+
public function testCanExecuteTest5(): void
82+
{
83+
$this->expectExecuteOutputAnswer(
84+
__DIR__ . '/input/05 - test 5.txt',
85+
9221165894 . PHP_EOL
86+
);
87+
}
88+
89+
/**
90+
* Test that the code can be executed for "Test 6".
91+
*
92+
* @group oneBillionDWorld_test6
93+
*/
94+
public function testCanExecuteTest6(): void
95+
{
96+
$this->expectExecuteOutputAnswer(
97+
__DIR__ . '/input/06 - test 6.txt',
98+
0 . PHP_EOL
99+
);
100+
}
101+
102+
/**
103+
* Test that the code can be executed for "Test 7".
104+
*
105+
* @group oneBillionDWorld_test7
106+
*/
107+
public function testCanExecuteTest7(): void
108+
{
109+
$this->expectExecuteOutputAnswer(
110+
__DIR__ . '/input/07 - test 7.txt',
111+
-213982941 . PHP_EOL
112+
);
113+
}
114+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
500000001 1 499999999 -1
2+
1000000000 1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
5 1 5 2 999999990 0
2+
3 1 3 2 3 1 999999991 0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1000000000 1
2+
1000000000 -1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 999999945 -1
2+
999999945 2 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
61293583 -5 60141391 -10 30705144 6 18209987 8 3623360 -5 3715666 4 18252771 -5 24739354 7 107410335 -1 18585831 1 37735014 9 4459884 -3 10163437 -6 67811650 10 49967223 3 29661998 1 34417955 8 5997538 -5 12037693 0 12536915 1 35929119 10 17059584 -4 10232854 7 13870276 6 3519983 6 55936984 7 72768589 2 29183804 -3 33351647 7 20893540 5 17190111 1 27370514 5 17869452 -3 1811597 10 31545217 -10
2+
29853135 2 7370169 0 9807376 -5 90278577 -7 27976028 -3 131519266 1 68154 -9 2173005 -9 40036660 5 63310669 9 25674306 -10 24212637 -3 29203142 2 79327039 2 18493184 -9 1854019 1 47335765 -5 38838995 10 49608857 1 13201908 3 85586590 4 30040431 -10 30620504 6 16642661 2 52716485 5 31264011 -5 22986427 -5
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
100000000 1 100000000 1 100000000 1 100000000 1 100000000 1 100000000 1 100000000 1 100000000 1 100000000 1 100000000 1
2+
100000000 1 100000000 -1 100000000 1 100000000 -1 100000000 1 100000000 -1 100000000 1 100000000 -1 100000000 1 100000000 -1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
26751891 1 12423842 0 24697032 -1 75825948 0 16058842 -1 5056344 -1 14781040 -1 48256886 0 37330872 1 68962932 1 37555307 1 2970721 0 26201429 1 48967194 -1 17837665 0 74719356 -2 17461041 -2 20765736 0 15044838 1 6518283 -2 10432178 -2 15225674 -2 6160520 0 32060077 0 52545144 0 3848757 -2 91480452 -1 99032044 1 89501141 1 1526814 0
2+
40312847 1 84841395 -2 43849784 1 3228664 -1 98445257 -1 22318921 0 42672597 0 4577041 0 5240860 -2 31151717 1 30451395 -2 35469153 -2 25313187 -2 40128193 1 15893237 1 6369211 1 3672509 -1 22259551 0 25942846 -2 12180032 1 4202901 0 68816164 1 520373 -2 107835622 1 50661951 -2 67145499 0 88144650 -1 18354443 -1

0 commit comments

Comments
 (0)