Add tests for `Fill` and `Complex`.

This commit is contained in:
CismonX 2019-03-19 13:30:01 +08:00
parent f50d5f1b6d
commit 9e4f51e488
2 changed files with 36 additions and 0 deletions

16
tests/000-fill.phpt Normal file
View File

@ -0,0 +1,16 @@
--TEST--
Test for `Arma\Fill`.
--SKIPIF--
<?php require_once 'includes/loaded.php'; ?>
--FILE--
<?php
require_once 'includes/assert.php';
$arr = [
Arma\Fill::NONE, Arma\Fill::ZEROS,
Arma\Fill::ONES, Arma\Fill::EYE,
Arma\Fill::RANDU, Arma\Fill::RANDN
];
$expected = [0, 1, 2, 3, 4, 5];
batch_assert('Arma\\Fill', [$expected, $arr]);
?>
--EXPECT--

20
tests/001-complex.phpt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
Test for `Arma\Complex`.
--SKIPIF--
<?php require_once 'includes/loaded.php'; ?>
--FILE--
<?php
require_once 'includes/assert.php';
$cx_double = new Arma\CxDouble(1.2, 2.4);
batch_assert('Arma\\Complex',
[1.2, $cx_double->real],
[2.4, $cx_double->imag]
);
$cx_double->real *= 1.1;
$cx_double->imag *= 1.3;
batch_assert('Arma\\Complex',
[1.2 * 1.1, $cx_double->real],
[2.4 * 1.3, $cx_double->imag]
);
?>
--EXPECT--