25 lines
567 B
PHP
25 lines
567 B
PHP
--TEST--
|
|
Test whether helpers works normally.
|
|
--SKIPIF--
|
|
<?php
|
|
if (!function_exists('res2fd'))
|
|
echo 'skip helper functions are disabled';
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$buf = str_alloc(10);
|
|
if (strlen($buf) != 10) {
|
|
echo 'Test for `str_alloc()` failed.', PHP_EOL;
|
|
}
|
|
$str = 'hello';
|
|
$str_addr = str2ptr($str);
|
|
if ($str != ptr2str($str_addr, strlen($str))) {
|
|
echo 'Test for `str2ptr()` and `ptr2str()` failed.', PHP_EOL;
|
|
}
|
|
$res = stream_socket_server('tcp://0.0.0.0:4567');
|
|
if (res2fd($res) === false) {
|
|
echo 'Test for `res2fd()` failed.', PHP_EOL;
|
|
}
|
|
?>
|
|
--EXPECT--
|