This repository has been archived on 2018-05-01. You can view files and clone it, but cannot push or open issues or pull requests.
ext-ioctl/tests/01-helpers.phpt

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--