Skip to content

Commit 7a364fa

Browse files
committed
Add test demonstrating #32.
1 parent 1d9d643 commit 7a364fa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/VectorTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ public function testConstructor()
2727
$this->assertInstanceOf(Vector::class, self::buildVector());
2828
}
2929

30+
public function testMap()
31+
{
32+
$vector = self::buildVector();
33+
34+
$mapped = $vector->map(function ($value, $row, $column) {
35+
return $value + $row + $column;
36+
});
37+
38+
static::assertInstanceOf(Matrix::class, $mapped);
39+
40+
static::assertEquals(1, $mapped->get(0, 0));
41+
static::assertEquals(3, $mapped->get(0, 1));
42+
static::assertEquals(5, $mapped->get(0, 2));
43+
static::assertEquals(7, $mapped->get(0, 3));
44+
}
45+
3046
public function testGetSize()
3147
{
3248
$vector = self::buildVector();

0 commit comments

Comments
 (0)