44 lines
948 B
PHP
44 lines
948 B
PHP
|
<?php
|
||
|
|
||
|
// require_once(DIR_ALVEOLATA . '/definitions.php');
|
||
|
require_once(DIR_ALVEOLATA . '/structures/map/wrapper-class.php');
|
||
|
|
||
|
|
||
|
\alveolata\test\add(
|
||
|
[
|
||
|
'name' => 'alveolata',
|
||
|
'sections' => [
|
||
|
[
|
||
|
'name' => 'structures',
|
||
|
'sections' => [
|
||
|
[
|
||
|
'name' => 'map',
|
||
|
'sections' => [
|
||
|
[
|
||
|
'name' => 'set_get',
|
||
|
'cases' => [
|
||
|
[
|
||
|
'name' => 'test',
|
||
|
'procedure' => function ($assert) {
|
||
|
$map = \alveolata\structures\class_map::make(
|
||
|
function ($x, $y) {return ($x === $y);}
|
||
|
);
|
||
|
$map->set(2, 'zwei');
|
||
|
$map->set(3, 'drei');
|
||
|
$map->set(5, 'fünf');
|
||
|
$assert->runs(function () use ($map) {return $map->get(3);});
|
||
|
$assert->equal($map->get(3), 'drei');
|
||
|
$assert->crashes(function () use ($map) {return $map->get(4);});
|
||
|
}
|
||
|
],
|
||
|
]
|
||
|
],
|
||
|
]
|
||
|
],
|
||
|
]
|
||
|
]
|
||
|
]
|
||
|
]
|
||
|
);
|
||
|
|