mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 13:24:46 +00:00
30 lines
599 B
PHP
30 lines
599 B
PHP
|
<?php
|
||
|
/**
|
||
|
* MadLisp language
|
||
|
* @link http://madlisp.com/
|
||
|
* @copyright Copyright (c) 2020 Pekka Laiho
|
||
|
*/
|
||
|
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
use MadLisp\MadLispException;
|
||
|
use MadLisp\Vector;
|
||
|
|
||
|
class VectorTest extends TestCase
|
||
|
{
|
||
|
public function testGet()
|
||
|
{
|
||
|
$list = new Vector([1, 2, 3]);
|
||
|
$this->assertSame(2, $list->get(1));
|
||
|
}
|
||
|
|
||
|
public function testNotFound()
|
||
|
{
|
||
|
$this->expectException(MadLispException::class);
|
||
|
$this->expectExceptionMessage('vector does not contain index 3');
|
||
|
|
||
|
$list = new Vector([1, 2, 3]);
|
||
|
$list->get(3);
|
||
|
}
|
||
|
}
|