You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
41
vendor/swoole/tests/swoole_channel/pusu_pop_stats.phpt
vendored
Executable file
41
vendor/swoole/tests/swoole_channel/pusu_pop_stats.phpt
vendored
Executable file
@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
swoole_channel: push & pop & stats
|
||||
|
||||
--SKIPIF--
|
||||
<?php require __DIR__ . '/../include/skipif.inc'; ?>
|
||||
--INI--
|
||||
assert.active=1
|
||||
assert.warning=1
|
||||
assert.bail=0
|
||||
assert.quiet_eval=0
|
||||
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/../include/bootstrap.php';
|
||||
|
||||
use Swoole\Channel;
|
||||
|
||||
const N = 100;
|
||||
$chan = new Channel(1024 * 256);
|
||||
|
||||
$worker_num = 4;
|
||||
$workers = array();
|
||||
|
||||
for ($i = 0; $i < N; $i++)
|
||||
{
|
||||
$n = rand(100, 200);
|
||||
$chan->push(['value' => str_repeat('A', $n), 'len' => $n]);
|
||||
}
|
||||
|
||||
$stats = $chan->stats();
|
||||
assert($stats['queue_num'] == N);
|
||||
|
||||
for ($i = 0; $i < N; $i++)
|
||||
{
|
||||
$ret = $chan->pop();
|
||||
assert(is_array($ret));
|
||||
}
|
||||
?>
|
||||
|
||||
--EXPECT--
|
Reference in New Issue
Block a user