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/includes/assert.php
2019-03-19 13:36:50 +08:00

25 lines
539 B
PHP

<?php
/**
* Print message if test fail.
*
* @param string $test
* @param array $cases
* @return bool
*/
function batch_assert($test, ...$cases) {
foreach ($cases as $case) {
[$expected, $got] = $case;
if ($expected == $got) {
continue;
}
echo "Test for $test failed.\n";
$expected = var_export($expected, true);
$got = var_export($got, true);
echo "Expected:\n$expected\n";
echo "Got:\n$got\n";
return false;
}
return true;
}