summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2021-02-20 10:55:02 +0000
committerGeorge Peter Banyard <girgias@php.net>2021-02-25 17:39:31 +0000
commit3a4b89661e4b68b3de8ae337a82684bcfeb7dc48 (patch)
tree1164fe7745029b5fa4b9d4d04b740da88eb5605b /tests
parent8c206ba5acf5ce7eb54e22ea561270c223cd7cb4 (diff)
downloadphp-git-3a4b89661e4b68b3de8ae337a82684bcfeb7dc48.tar.gz
Remove quicktester
This is barely used and more of a hinderence than anything else Closes GH-6712
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/bug24054.phpt14
-rw-r--r--tests/quicktester.inc74
2 files changed, 5 insertions, 83 deletions
diff --git a/tests/lang/bug24054.phpt b/tests/lang/bug24054.phpt
index aa098fc524..0b90ee3aff 100644
--- a/tests/lang/bug24054.phpt
+++ b/tests/lang/bug24054.phpt
@@ -8,17 +8,13 @@ define('LONG_MIN', -LONG_MAX - 1);
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
is_int(LONG_MIN-1),is_int(LONG_MAX+1));
- $i = LONG_MAX;
+$i = LONG_MAX;
+$j = $i * 1001;
+$i *= 1001;
- $j = $i * 1001;
- $i *= 1001;
+var_dump($i === $j);
-$tests = <<<TESTS
-$i === $j
-TESTS;
-
-include(__DIR__ . '/../quicktester.inc');
?>
--EXPECT--
1,1,0,0
-OK
+bool(true)
diff --git a/tests/quicktester.inc b/tests/quicktester.inc
deleted file mode 100644
index ba243beba0..0000000000
--- a/tests/quicktester.inc
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
- /*
- Helper for simple tests to check return-value. Usage:
-
- $tests = <<<TESTS
- expected_return_value === expression
- 2 === 1+1
- 4 === 2*2
- FALSE === @ fopen('non_existent_file')
-TESTS;
- include( 'tests/quicktester.inc' );
-
- Expect: OK
-
- Remember to NOT put a trailing ; after a line!
-
- */
-error_reporting(E_ALL);
-$tests = explode("\n",$tests);
-$success = TRUE;
-foreach ($tests as $n=>$test)
-{
- // ignore empty lines
- if (!$test) continue;
-
- // warn for trailing ;
- if (substr(trim($test), -1, 1) === ';') {
- echo "WARNING: trailing ';' found in test ".($n+1)."\n";
- exit;
- }
-
- // try for operators
- $operators = array('===', '~==');
- $operator = NULL;
- foreach ($operators as $a_operator) {
- if (strpos($test, $a_operator)!== FALSE) {
- $operator = $a_operator;
- list($left,$right) = explode($operator, $test);
- break;
- }
- }
- if (!$operator) {
- echo "WARNING: unknown operator in '$test' (1)\n";
- exit;
- }
-
- $left = eval("return ($left );");
- $right = eval("return ($right);");
- switch (@$operator) {
- case '===': // exact match
- $result = $left === $right;
- break;
- case '~==': // may differ after 12th significant number
- if ( !is_float($left ) && !is_int($left )
- || !is_float($right) && !is_int($right)) {
- $result = FALSE;
- break;
- }
- $result = abs(($left-$right) / $left) < 1e-12;
- break;
- default:
- echo "WARNING: unknown operator in '$test' (2)\n";
- exit;
- }
-
- $success = $success && $result;
- if (!$result) {
- echo "\nAssert failed:\n";
- echo "$test\n";
- echo "Left: ";var_dump($left );
- echo "Right: ";var_dump($right);
- }
-}
-if ($success) echo "OK";