-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathImplementQueueUsingStacks2Test.php
45 lines (33 loc) · 1.06 KB
/
ImplementQueueUsingStacks2Test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
namespace leetcode\tests;
use leetcode\ImplementQueueUsingStacks2;
use PHPUnit\Framework\TestCase;
class ImplementQueueUsingStacks2Test extends TestCase
{
private ImplementQueueUsingStacks2 $queue;
protected function setUp(): void
{
$this->queue = new ImplementQueueUsingStacks2();
}
public function testQueue(): void
{
self::assertNull($this->queue->peek());
$this->queue->push(1);
self::assertSame(1, $this->queue->peek());
$this->queue->push(2);
self::assertSame(1, $this->queue->peek());
$this->queue->push(3);
self::assertSame(1, $this->queue->peek());
self::assertSame(1, $this->queue->pop());
self::assertSame(2, $this->queue->pop());
self::assertSame(3, $this->queue->pop());
self::assertNull($this->queue->pop());
self::assertNull($this->queue->peek());
self::assertTrue($this->queue->empty());
}
public function testEmpty(): void
{
self::assertTrue($this->queue->empty());
}
}