This repository has been archived on 2020-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
php-armadillo/tests/007-scalar-operators.phpt

30 lines
674 B
Plaintext
Raw Normal View History

2019-06-06 16:30:50 +00:00
--TEST--
Test for `Internal\Scalar`.
--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';
$mat = Arma\IMat::fromString('1 2; 3 4');
$mapval = $mat(1, 0);
$mapval = 5;
// Unfortunately, the Zend Engine prevents us from writing something like:
// $mat(1, 0) = 5;
// because function return values are not supposed to be used in write context.
// Function `zend_ensure_writable_variable()` does that check in compile time.
batch_assert('operator overloading of `MapVal`',
2019-06-06 16:44:19 +00:00
[5, +$mat->at(1, 0)]
2019-06-06 16:30:50 +00:00
);
?>
--EXPECT--