39 lines
690 B
PHP
39 lines
690 B
PHP
--TEST--
|
|
Test for methods `fill()` and `imbue()`.
|
|
--SKIPIF--
|
|
<?php
|
|
require_once 'includes/loaded.php';
|
|
is_php_arma_loaded();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once 'includes/assert.php';
|
|
|
|
$mat = Arma\IMat::init(2, 2, Arma\Fill::ZEROS);
|
|
|
|
$mat->fill(5);
|
|
batch_assert('method `fill()`',
|
|
[5, $mat->max()],
|
|
[5, $mat->min()]
|
|
);
|
|
|
|
$cnt = 0;
|
|
$mat1 = Arma\IMat::fromArray([
|
|
[1, 3],
|
|
[2, 4]
|
|
]);
|
|
$mat->imbue(function () use (&$cnt) {
|
|
return ++$cnt;
|
|
});
|
|
$comp = function ($expected, $got) {
|
|
$compare_result = $expected->equals($got);
|
|
return $compare_result->max() == 1 && $compare_result->min() == 1;
|
|
};
|
|
batch_assert_ex('method `imbue()`', $comp,
|
|
[$mat1, $mat]
|
|
);
|
|
|
|
?>
|
|
--EXPECT--
|