From 6513ceb4dce3b780c541c76989dc68fff332aea4 Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Mon, 29 Jun 2009 07:31:15 +0000 Subject: [PATCH] Basic tests for sleep() and usleep(). Tested on Windows, Linux and Linux 64 bit --- .../tests/general_functions/sleep_basic.phpt | 40 +++++++++++++++++ .../tests/general_functions/sleep_error.phpt | 45 +++++++++++++++++++ .../tests/general_functions/usleep_basic.phpt | 39 ++++++++++++++++ .../tests/general_functions/usleep_error.phpt | 45 +++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 ext/standard/tests/general_functions/sleep_basic.phpt create mode 100644 ext/standard/tests/general_functions/sleep_error.phpt create mode 100644 ext/standard/tests/general_functions/usleep_basic.phpt create mode 100644 ext/standard/tests/general_functions/usleep_error.phpt diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt new file mode 100644 index 00000000000..cfc00c6eaba --- /dev/null +++ b/ext/standard/tests/general_functions/sleep_basic.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test sleep() function : basic functionality +--FILE-- += $sleeplow) { + echo "TEST PASSED\n"; +} else { + echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n"; +} +?> +===DONE=== +--EXPECTF-- +*** Testing sleep() : basic functionality *** +Thread slept for %f seconds +TEST PASSED +===DONE=== diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt new file mode 100644 index 00000000000..1499198d99b --- /dev/null +++ b/ext/standard/tests/general_functions/sleep_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test sleep() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing sleep() : error conditions *** + +-- Testing sleep() function with zero arguments -- + +Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing sleep() function with more than expected no. of arguments -- + +Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) + +-- Testing sleep() function with negative interval -- + +Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt new file mode 100644 index 00000000000..229226f0834 --- /dev/null +++ b/ext/standard/tests/general_functions/usleep_basic.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test usleep() function +--FILE-- += $sleeplow) { + echo "TEST PASSED\n"; +} else { + echo "TEST FAILED\n"; +} +?> +===DONE=== +--EXPECTF-- +*** Testing usleep() : basic functionality *** +Thread slept for %f micro-seconds +TEST PASSED +===DONE=== diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt new file mode 100644 index 00000000000..1ba6f734fea --- /dev/null +++ b/ext/standard/tests/general_functions/usleep_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test usleep() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing usleep() : error conditions *** + +-- Testing usleep() function with zero arguments -- + +Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing usleep() function with more than expected no. of arguments -- + +Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +-- Testing usleep() function with negative interval -- + +Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d +bool(false) +===DONE===