43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
--TEST--
|
|
Test for `SvMat`.
|
|
--SKIPIF--
|
|
<?php
|
|
require_once 'includes/loaded.php';
|
|
is_php_arma_loaded();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once 'includes/assert.php';
|
|
|
|
$mat = Arma\IMat::init(3, 3, Arma\Fill::RANDN);
|
|
$sub_cols = $mat->cols(1, 2);
|
|
$sub_rows = $mat->rows(1, 2);
|
|
$submat = $mat->submat(1, 1, 2, 2);
|
|
$sub_cols->at(0, 1)->setTo(PHP_INT_MAX);
|
|
$sub_rows->at(0, 1)->setTo(PHP_INT_MAX);
|
|
$submat->at(0, 1)->setTo(PHP_INT_MAX);
|
|
|
|
batch_assert('`SvMat`',
|
|
[$mat->at(0, 1)->val(), $sub_cols->at(0, 0)->val()],
|
|
[$mat->at(1, 0)->val(), $sub_rows->at(0, 0)->val()],
|
|
[$mat->at(2, 2)->val(), $submat->at(1, 1)->val()],
|
|
[PHP_INT_MAX, $mat->at(0, 2)->val()],
|
|
[PHP_INT_MAX, $mat->at(1, 1)->val()],
|
|
[PHP_INT_MAX, $mat->at(1, 2)->val()]
|
|
);
|
|
|
|
// When parent class is destroyed...
|
|
$orphaned_submat = Arma\IMat::fromString('1 2; 3 4')->cols(0, 0);
|
|
|
|
batch_assert('orphaned `SvMat`',
|
|
[$orphaned_submat->at(0, 0)->val(), 1],
|
|
[$orphaned_submat->at(1, 0)->val(), 3]
|
|
);
|
|
$orphaned_submat->getParent()->rawPrint();
|
|
|
|
?>
|
|
--EXPECT--
|
|
1 2
|
|
3 4
|