You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
73
vendor/swoole/tests/swoole_serialize/007.phpt
vendored
Executable file
73
vendor/swoole/tests/swoole_serialize/007.phpt
vendored
Executable file
@ -0,0 +1,73 @@
|
||||
--TEST--
|
||||
swoole_serialize: Check for simple array serialization
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require __DIR__ . '/../include/skipif.inc';
|
||||
if (!class_exists("swoole_serialize", false))
|
||||
{
|
||||
echo "skip";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/../include/bootstrap.php';
|
||||
|
||||
function test($type, $variable) {
|
||||
$serialized = swoole_serialize::pack($variable);
|
||||
$unserialized = swoole_serialize::unpack($serialized);
|
||||
|
||||
echo $type, PHP_EOL;
|
||||
var_dump($unserialized);
|
||||
echo $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
|
||||
}
|
||||
|
||||
test('empty array:', array());
|
||||
test('array(1, 2, 3)', array(1, 2, 3));
|
||||
test('array(array(1, 2, 3), arr...', array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9)));
|
||||
?>
|
||||
--EXPECT--
|
||||
empty array:
|
||||
array(0) {
|
||||
}
|
||||
OK
|
||||
array(1, 2, 3)
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
OK
|
||||
array(array(1, 2, 3), arr...
|
||||
array(3) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
[1]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(4)
|
||||
[1]=>
|
||||
int(5)
|
||||
[2]=>
|
||||
int(6)
|
||||
}
|
||||
[2]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(7)
|
||||
[1]=>
|
||||
int(8)
|
||||
[2]=>
|
||||
int(9)
|
||||
}
|
||||
}
|
||||
OK
|
Reference in New Issue
Block a user