rosavox/lib/alveolata/structures/map/test.spec.php

44 lines
948 B
PHP
Raw Normal View History

2025-05-23 07:33:29 +00:00
<?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);});
}
],
]
],
]
],
]
]
]
]
);