35 lines
916 B
PHP
35 lines
916 B
PHP
--TEST--
|
|
Test operator overloading for comparisons.
|
|
--SKIPIF--
|
|
<?php
|
|
require_once 'includes/loaded.php';
|
|
require_once 'includes/supports.php';
|
|
if (is_php_arma_loaded()) {
|
|
supports_operator_overloading();
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once 'includes/assert.php';
|
|
|
|
$mat0 = Arma\DMat::init(3, 3, Arma\Fill::RANDU);
|
|
$mat1 = Arma\DMat::init(3, 3, Arma\Fill::RANDU);
|
|
|
|
$comp = function ($expected, $got) {
|
|
$compare_result = $expected->equals($got);
|
|
return $compare_result->max() == 1 && $compare_result->min() == 1;
|
|
};
|
|
|
|
batch_assert_ex('operator overloading for comparisons', $comp,
|
|
[$mat0->equals($mat1), $mat0 == $mat1],
|
|
[$mat0->notEquals($mat1), $mat0 != $mat1],
|
|
[$mat0->smallerThan($mat1), $mat0 < $mat1],
|
|
[$mat0->greaterThan($mat1), $mat0 > $mat1],
|
|
[$mat0->notSmallerThan($mat1), $mat0 >= $mat1],
|
|
[$mat0->notGreaterThan($mat1), $mat0 <= $mat1]
|
|
);
|
|
|
|
?>
|
|
--EXPECT--
|