X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fbenchmark.php;h=43cbc42e58bcd76426c499eeaf9b256a513b3ed7;hb=d8e180b0ca87bf675d5fda2099d49c9d0043cd42;hp=32a3fed55ae84edb08e26db673e799c4faffd933;hpb=885d7355f6b00f4b7f931d4d50c0e7b31d29bb32;p=plcapi.git diff --git a/tests/benchmark.php b/tests/benchmark.php index 32a3fed..43cbc42 100644 --- a/tests/benchmark.php +++ b/tests/benchmark.php @@ -4,7 +4,7 @@ * * @author Gaetano Giunta * @copyright (c) 2005-2015 G. Giunta - * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt + * @license code licensed under the BSD License: see file license.txt * * @todo add a test for response ok in call testing * @todo add support for --help option to give users the list of supported parameters @@ -86,7 +86,7 @@ if ($is_web) { } } -// test 'old style' data encoding vs. 'automatic style' encoding +// test 'manual style' data encoding vs. 'automatic style' encoding begin_test('Data encoding (large array)', 'manual encoding'); for ($i = 0; $i < $num_tests; $i++) { $vals = array(); @@ -145,12 +145,32 @@ for ($i = 0; $i < $num_tests; $i++) { $response = $dummy->ParseResponse($in, true); $value = $response->value(); $result = array(); - for ($k = 0; $k < $value->arraysize(); $k++) { + foreach($value as $val1) { + $out = array(); + foreach($val1 as $name => $val) { + $out[$name] = array(); + foreach($val as $data) { + $out[$name][] = $data->scalarval(); + } + } + $result[] = $out; + } +} +end_test('Data decoding (large array)', 'manual decoding', $result); + +begin_test('Data decoding (large array)', 'manual decoding deprecated'); +for ($i = 0; $i < $num_tests; $i++) { + $response = $dummy->ParseResponse($in, true); + $value = $response->value(); + $result = array(); + $l = $value->arraysize(); + for ($k = 0; $k < $l; $k++) { $val1 = $value->arraymem($k); $out = array(); while (list($name, $val) = $val1->structeach()) { $out[$name] = array(); - for ($j = 0; $j < $val->arraysize(); $j++) { + $m = $val->arraysize(); + for ($j = 0; $j < $m; $j++) { $data = $val->arraymem($j); $out[$name][] = $data->scalarval(); } @@ -158,7 +178,7 @@ for ($i = 0; $i < $num_tests; $i++) { $result[] = $out; } } -end_test('Data decoding (large array)', 'manual decoding', $result); +end_test('Data decoding (large array)', 'manual decoding deprecated', $result); begin_test('Data decoding (large array)', 'automatic decoding'); for ($i = 0; $i < $num_tests; $i++) {