X7ROOT File Manager
Current Path:
/opt/alt/tests/alt-php82-pecl-luasandbox_4.1.2-2.el8/tests
opt
/
alt
/
tests
/
alt-php82-pecl-luasandbox_4.1.2-2.el8
/
tests
/
ðŸ“
..
📄
LuaSandboxFunction_construct.phpt
(253 B)
📄
array-key-conversion.phpt
(3.11 KB)
📄
call.phpt
(5.1 KB)
📄
callback_exception.phpt
(392 B)
📄
datatypes-unsupported.phpt
(2.78 KB)
📄
datatypes.phpt
(2.43 KB)
📄
dump_loadBinary_call.phpt
(393 B)
📄
errors-at-call-boundaries.phpt
(1.98 KB)
📄
extending-LuaSandbox.phpt
(845 B)
📄
ipairs.phpt
(1.53 KB)
📄
loadString.phpt
(334 B)
📄
lua_catches_php_exception.phpt
(1.34 KB)
📄
pairs.phpt
(3.31 KB)
📄
pcall.phpt
(1.27 KB)
📄
profiler-sorting.phpt
(1.18 KB)
📄
profiler.phpt
(1.54 KB)
📄
reentrant.phpt
(1.1 KB)
📄
xpcall.phpt
(2.6 KB)
Editing: profiler.phpt
--TEST-- profiler --FILE-- <?php // Note these tests have to waste CPU cycles rather than sleep(), because the // timer counts CPU time used and sleep() doesn't use CPU time. $lua = <<<LUA lua = {} function lua.test() local t = os.clock() + 0.2 while os.clock() < t do end end LUA; $sandbox = new LuaSandbox; $sandbox->loadString( $lua )->call(); $sandbox->enableProfiler( 0.02 ); $sandbox->callFunction( 'lua.test' ); echo "Samples: " . $sandbox->getProfilerFunctionReport( LuaSandbox::SAMPLES )['clock'] . "\n"; echo "Seconds: " . $sandbox->getProfilerFunctionReport( LuaSandbox::SECONDS )['clock'] . "\n"; echo "Seconds > 0: " . ( $sandbox->getProfilerFunctionReport( LuaSandbox::SECONDS )['clock'] > 0 ? 'yes' : 'no' ) . "\n"; echo "Percent: " . $sandbox->getProfilerFunctionReport( LuaSandbox::PERCENT )['clock'] . "\n"; // Test that re-enabling the profiler doesn't explode $sandbox->enableProfiler( 0.03 ); $sandbox->callFunction( 'lua.test' ); echo "Samples: " . $sandbox->getProfilerFunctionReport( LuaSandbox::SAMPLES )['clock'] . "\n"; echo "Seconds: " . $sandbox->getProfilerFunctionReport( LuaSandbox::SECONDS )['clock'] . "\n"; echo "Seconds > 0: " . ( $sandbox->getProfilerFunctionReport( LuaSandbox::SECONDS )['clock'] > 0 ? 'yes' : 'no' ) . "\n"; echo "Percent: " . $sandbox->getProfilerFunctionReport( LuaSandbox::PERCENT )['clock'] . "\n"; // Test that disabling the profiler doesn't explode $sandbox->disableProfiler(); --EXPECTF-- Samples: %d Seconds: %f Seconds > 0: yes Percent: %f Samples: %d Seconds: %f Seconds > 0: yes Percent: %f
Upload File
Create Folder