Skip to content

Commit c7e800b

Browse files
committed
Adding tests for "NGR - basic radar".
1 parent b02d9b8 commit c7e800b

File tree

10 files changed

+696
-1
lines changed

10 files changed

+696
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ 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]
7+
## [3.5.0] - 2022-02-22
88
### Added
99
- Tests for "1000000000D world".
1010
- Tests for "Rooks movements".
1111
- Tests for "Jack Silver: the casino".
1212
- Tests for "Fax machine".
13+
- Tests for "NGR - basic radar".
1314

1415
## [3.4.0] - 2022-02-21
1516
### Added
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Community\Training\Easy\NGRBasicRadar;
6+
7+
use CyrilVerloop\Codingame\Puzzle;
8+
9+
/**
10+
* The "NGR - basic radar" puzzle.
11+
*/
12+
class NGRBasicRadar implements Puzzle
13+
{
14+
public function execute($stdin): void
15+
{
16+
fscanf($stdin, "%d", $N);
17+
for ($i = 0; $i < $N; $i++)
18+
{
19+
fscanf($stdin, "%s %s %d", $plate, $radarname, $timestamp);
20+
}
21+
22+
// Write an answer using echo(). DON'T FORGET THE TRAILING \n
23+
24+
echo("ticket\n");
25+
}
26+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CyrilVerloop\Codingame\Tests\Community\Training\Easy\NGRBasicRadar;
6+
7+
use CyrilVerloop\Codingame\Tests\PuzzleTest;
8+
use CyrilVerloop\Codingame\Community\Training\Easy\NGRBasicRadar\NGRBasicRadar;
9+
10+
/**
11+
* Tests for the "NGR - basic radar" puzzle.
12+
*
13+
* @covers \CyrilVerloop\Codingame\Community\Training\Easy\NGRBasicRadar\NGRBasicRadar
14+
* @group NGRBasicRadar
15+
* @medium
16+
*/
17+
final class CGTest extends PuzzleTest
18+
{
19+
public function setUp(): void
20+
{
21+
$this->puzzle = new NGRBasicRadar();
22+
}
23+
24+
/**
25+
* Test that the code can be executed for "Low density, 1 ticket".
26+
*
27+
* @group NGRBasicRadar_lowDensity1Ticket
28+
*/
29+
public function testCanExecuteLowDensity1Ticket(): void
30+
{
31+
$this->expectExecuteOutputAnswer(
32+
__DIR__ . '/input/01 - low density 1 ticket.txt',
33+
'FZ-792-EC 134' . PHP_EOL
34+
);
35+
}
36+
37+
/**
38+
* Test that the code can be executed for "Low density, many ticket".
39+
*
40+
* @group NGRBasicRadar_lowDensityManyTicket
41+
*/
42+
public function testCanExecuteLowDensityManyTicket(): void
43+
{
44+
$this->expectExecuteOutputAnswer(
45+
__DIR__ . '/input/02 - low density many ticket.txt',
46+
file_get_contents(__DIR__ . '/output/02 - low density many ticket.txt')
47+
);
48+
}
49+
50+
/**
51+
* Test that the code can be executed for "Medium density".
52+
*
53+
* @group NGRBasicRadar_mediumDensity
54+
*/
55+
public function testCanExecuteMediumDensity(): void
56+
{
57+
$this->expectExecuteOutputAnswer(
58+
__DIR__ . '/input/03 - medium density.txt',
59+
file_get_contents(__DIR__ . '/output/03 - medium density.txt')
60+
);
61+
}
62+
63+
/**
64+
* Test that the code can be executed for "Test 4".
65+
*
66+
* @group NGRBasicRadar_test4
67+
*/
68+
public function testCanExecuteTest4(): void
69+
{
70+
$this->expectExecuteOutputAnswer(
71+
__DIR__ . '/input/04 - test 4.txt',
72+
file_get_contents(__DIR__ . '/output/04 - test 4.txt')
73+
);
74+
}
75+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
20
2+
FH-790-HH A21-42 1620040132000
3+
ET-318-NQ A21-42 1620040623000
4+
BV-670-GV A21-42 1620040665000
5+
FH-790-HH A21-55 1620040747000
6+
DV-046-YY A21-42 1620040839000
7+
ET-318-NQ A21-55 1620041044000
8+
BV-670-GV A21-55 1620041071000
9+
FZ-792-EC A21-42 1620041284000
10+
DV-046-YY A21-55 1620041326000
11+
FZ-792-EC A21-55 1620041633000
12+
BP-301-UL A21-42 1620041863000
13+
BV-047-TT A21-42 1620042133000
14+
BP-301-UL A21-55 1620042487000
15+
BV-047-TT A21-55 1620042570000
16+
FT-918-CZ A21-42 1620042842000
17+
DZ-507-JZ A21-42 1620043072000
18+
DF-857-ZR A21-42 1620043398000
19+
FT-918-CZ A21-55 1620043609000
20+
DZ-507-JZ A21-55 1620043803000
21+
DF-857-ZR A21-55 1620043835000
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
20
2+
BD-303-WY A21-42 1620041442000
3+
FJ-222-LU A21-42 1620041609000
4+
ES-727-NH A21-42 1620041865000
5+
EW-331-SN A21-42 1620041877000
6+
BD-303-WY A21-55 1620041879000
7+
BC-226-UH A21-42 1620042043000
8+
ES-727-NH A21-55 1620042181000
9+
EW-331-SN A21-55 1620042257000
10+
FJ-222-LU A21-55 1620042329000
11+
EW-499-FB A21-42 1620042699000
12+
BC-226-UH A21-55 1620042810000
13+
EW-499-FB A21-55 1620043358000
14+
CB-840-VU A21-42 1620043630000
15+
DD-230-WY A21-42 1620043684000
16+
EJ-638-JP A21-42 1620043800000
17+
DD-230-WY A21-55 1620044011000
18+
FQ-068-WK A21-42 1620044037000
19+
CB-840-VU A21-55 1620044093000
20+
EJ-638-JP A21-55 1620044151000
21+
FQ-068-WK A21-55 1620044474000

0 commit comments

Comments
 (0)