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/001-complex.phpt

33 lines
558 B
Plaintext
Raw Normal View History

2019-03-19 05:30:01 +00:00
--TEST--
Test for `Arma\Complex`.
--SKIPIF--
2019-04-16 11:00:50 +00:00
<?php
require_once 'includes/loaded.php';
is_php_arma_loaded();
?>
2019-03-19 05:30:01 +00:00
--FILE--
<?php
2019-04-04 08:07:37 +00:00
2019-03-19 05:30:01 +00:00
require_once 'includes/assert.php';
2019-04-04 08:07:37 +00:00
2019-03-19 05:30:01 +00:00
$cx_double = new Arma\CxDouble(1.2, 2.4);
2019-04-23 13:38:51 +00:00
[$real, $imag] = $cx_double;
2019-04-04 08:07:37 +00:00
2019-03-19 05:30:01 +00:00
batch_assert('Arma\\Complex',
[1.2, $cx_double->real],
2019-04-23 13:38:51 +00:00
[2.4, $cx_double->imag],
[$cx_double->real, $real],
[$cx_double->imag, $imag]
2019-03-19 05:30:01 +00:00
);
2019-04-04 08:07:37 +00:00
2019-03-19 05:30:01 +00:00
$cx_double->real *= 1.1;
$cx_double->imag *= 1.3;
2019-04-04 08:07:37 +00:00
2019-03-19 05:30:01 +00:00
batch_assert('Arma\\Complex',
[1.2 * 1.1, $cx_double->real],
[2.4 * 1.3, $cx_double->imag]
);
2019-04-04 08:07:37 +00:00
2019-03-19 05:30:01 +00:00
?>
--EXPECT--