Bryan Duxbury | a971fb0 | 2011-03-04 00:49:40 +0000 | [diff] [blame] | 1 | <?php |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 2 | |
| 3 | namespace test\php; |
| 4 | |
| 5 | require_once __DIR__.'/../../lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php'; |
| 6 | |
| 7 | use Thrift\ClassLoader\ThriftClassLoader; |
| 8 | |
| 9 | if (!isset($GEN_DIR)) { |
| 10 | $GEN_DIR = 'gen-php'; |
| 11 | } |
| 12 | if (!isset($MODE)) { |
| 13 | $MODE = 'normal'; |
| 14 | } |
| 15 | |
| 16 | $loader = new ThriftClassLoader(); |
| 17 | $loader->registerNamespace('Thrift', __DIR__ . '/../../lib/php/lib'); |
Andreas Scheja | d1ceba4 | 2016-05-15 21:49:04 +0200 | [diff] [blame^] | 18 | if ($GEN_DIR === 'gen-php-psr4') { |
| 19 | $loader->registerNamespace('ThriftTest', $GEN_DIR); |
| 20 | } else { |
| 21 | $loader->registerDefinition('ThriftTest', $GEN_DIR); |
| 22 | } |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 23 | $loader->register(); |
| 24 | |
David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 25 | /* |
| 26 | * Licensed to the Apache Software Foundation (ASF) under one |
| 27 | * or more contributor license agreements. See the NOTICE file |
| 28 | * distributed with this work for additional information |
| 29 | * regarding copyright ownership. The ASF licenses this file |
| 30 | * to you under the Apache License, Version 2.0 (the |
| 31 | * "License"); you may not use this file except in compliance |
| 32 | * with the License. You may obtain a copy of the License at |
| 33 | * |
| 34 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 35 | * |
| 36 | * Unless required by applicable law or agreed to in writing, |
| 37 | * software distributed under the License is distributed on an |
| 38 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 39 | * KIND, either express or implied. See the License for the |
| 40 | * specific language governing permissions and limitations |
| 41 | * under the License. |
| 42 | */ |
| 43 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 44 | /** Include the Thrift base */ |
Jim King | 5903d67 | 2015-06-29 18:12:48 -0400 | [diff] [blame] | 45 | /** Include the protocols */ |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 46 | use Thrift\Protocol\TBinaryProtocol; |
Jim King | 5903d67 | 2015-06-29 18:12:48 -0400 | [diff] [blame] | 47 | use Thrift\Protocol\TCompactProtocol; |
| 48 | use Thrift\Protocol\TJSONProtocol; |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 49 | |
| 50 | /** Include the socket layer */ |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 51 | use Thrift\Transport\TSocket; |
| 52 | use Thrift\Transport\TSocketPool; |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 53 | |
| 54 | /** Include the socket layer */ |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 55 | use Thrift\Transport\TFramedTransport; |
| 56 | use Thrift\Transport\TBufferedTransport; |
Mark Slee | 5b74307 | 2007-11-13 04:00:29 +0000 | [diff] [blame] | 57 | |
Jim King | 5903d67 | 2015-06-29 18:12:48 -0400 | [diff] [blame] | 58 | function makeProtocol($transport, $PROTO) |
| 59 | { |
| 60 | if ($PROTO == 'binary') { |
| 61 | return new TBinaryProtocol($transport); |
| 62 | } else if ($PROTO == 'compact') { |
| 63 | return new TCompactProtocol($transport); |
| 64 | } else if ($PROTO == 'json') { |
| 65 | return new TJSONProtocol($transport); |
| 66 | } |
| 67 | |
| 68 | die ("--protocol must be one of {binary|compact|json}"); |
| 69 | } |
| 70 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 71 | $host = 'localhost'; |
| 72 | $port = 9090; |
| 73 | |
| 74 | if ($argc > 1) { |
| 75 | $host = $argv[0]; |
| 76 | } |
| 77 | |
| 78 | if ($argc > 2) { |
| 79 | $host = $argv[1]; |
| 80 | } |
| 81 | |
Roger Meier | 41ad434 | 2015-03-24 22:30:40 +0100 | [diff] [blame] | 82 | foreach ($argv as $arg) { |
| 83 | if (substr($arg, 0, 7) == '--port=') { |
| 84 | $port = substr($arg, 7); |
Jim King | 5903d67 | 2015-06-29 18:12:48 -0400 | [diff] [blame] | 85 | } else if (substr($arg, 0, 12) == '--transport=') { |
| 86 | $MODE = substr($arg, 12); |
| 87 | } else if (substr($arg, 0, 11) == '--protocol=') { |
| 88 | $PROTO = substr($arg, 11); |
| 89 | } |
Roger Meier | 41ad434 | 2015-03-24 22:30:40 +0100 | [diff] [blame] | 90 | } |
| 91 | |
Mark Slee | 1dd819c | 2006-10-26 04:56:18 +0000 | [diff] [blame] | 92 | $hosts = array('localhost'); |
Mark Slee | ade2c83 | 2006-09-08 03:41:50 +0000 | [diff] [blame] | 93 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 94 | $socket = new TSocket($host, $port); |
Mark Slee | ade2c83 | 2006-09-08 03:41:50 +0000 | [diff] [blame] | 95 | $socket = new TSocketPool($hosts, $port); |
| 96 | $socket->setDebug(TRUE); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 97 | |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 98 | if ($MODE == 'inline') { |
| 99 | $transport = $socket; |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 100 | $testClient = new \ThriftTest\ThriftTestClient($transport); |
Bryan Duxbury | a971fb0 | 2011-03-04 00:49:40 +0000 | [diff] [blame] | 101 | } else if ($MODE == 'framed') { |
| 102 | $framedSocket = new TFramedTransport($socket); |
| 103 | $transport = $framedSocket; |
Jim King | 5903d67 | 2015-06-29 18:12:48 -0400 | [diff] [blame] | 104 | $protocol = makeProtocol($transport, $PROTO); |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 105 | $testClient = new \ThriftTest\ThriftTestClient($protocol); |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 106 | } else { |
| 107 | $bufferedSocket = new TBufferedTransport($socket, 1024, 1024); |
| 108 | $transport = $bufferedSocket; |
Jim King | 5903d67 | 2015-06-29 18:12:48 -0400 | [diff] [blame] | 109 | $protocol = makeProtocol($transport, $PROTO); |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 110 | $testClient = new \ThriftTest\ThriftTestClient($protocol); |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | $transport->open(); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 114 | |
| 115 | $start = microtime(true); |
| 116 | |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 117 | define(ERR_BASETYPES, 1); |
| 118 | // ERR_STRUCTS = 2; |
| 119 | // ERR_CONTAINERS = 4; |
| 120 | // ERR_EXCEPTIONS = 8; |
| 121 | // ERR_UNKNOWN = 64; |
| 122 | $exitcode = 0; |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 123 | /** |
| 124 | * VOID TEST |
| 125 | */ |
| 126 | print_r("testVoid()"); |
| 127 | $testClient->testVoid(); |
| 128 | print_r(" = void\n"); |
| 129 | |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 130 | function roundtrip($testClient, $method, $value) { |
| 131 | global $exitcode; |
| 132 | print_r("$method($value)"); |
| 133 | $ret = $testClient->$method($value); |
| 134 | print_r(" = \"$ret\"\n"); |
| 135 | if ($value != $ret) { |
| 136 | print_r("*** FAILED ***\n"); |
| 137 | $exitcode |= ERR_BASETYPES; |
| 138 | } |
| 139 | } |
| 140 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 141 | /** |
| 142 | * STRING TEST |
| 143 | */ |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 144 | roundtrip($testClient, 'testString', "Test"); |
Mark Slee | 5b74307 | 2007-11-13 04:00:29 +0000 | [diff] [blame] | 145 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 146 | /** |
| 147 | * BYTE TEST |
| 148 | */ |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 149 | roundtrip($testClient, 'testByte', 1); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 150 | |
| 151 | /** |
| 152 | * I32 TEST |
| 153 | */ |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 154 | roundtrip($testClient, 'testI32', -1); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 155 | |
| 156 | /** |
| 157 | * I64 TEST |
| 158 | */ |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 159 | roundtrip($testClient, 'testI64', -34359738368); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 160 | |
| 161 | /** |
Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 162 | * DOUBLE TEST |
| 163 | */ |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 164 | roundtrip($testClient, 'testDouble', -852.234234234); |
Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 165 | |
| 166 | /** |
Jens Geyer | 8bcfdd9 | 2014-12-14 03:14:26 +0100 | [diff] [blame] | 167 | * BINARY TEST -- TODO |
| 168 | */ |
| 169 | |
| 170 | /** |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 171 | * STRUCT TEST |
| 172 | */ |
| 173 | print_r("testStruct({\"Zero\", 1, -3, -5})"); |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 174 | $out = new \ThriftTest\Xtruct(); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 175 | $out->string_thing = "Zero"; |
| 176 | $out->byte_thing = 1; |
| 177 | $out->i32_thing = -3; |
| 178 | $out->i64_thing = -5; |
| 179 | $in = $testClient->testStruct($out); |
| 180 | print_r(" = {\"".$in->string_thing."\", ". |
| 181 | $in->byte_thing.", ". |
| 182 | $in->i32_thing.", ". |
| 183 | $in->i64_thing."}\n"); |
| 184 | |
| 185 | /** |
| 186 | * NESTED STRUCT TEST |
| 187 | */ |
| 188 | print_r("testNest({1, {\"Zero\", 1, -3, -5}), 5}"); |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 189 | $out2 = new \ThriftTest\Xtruct2(); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 190 | $out2->byte_thing = 1; |
| 191 | $out2->struct_thing = $out; |
| 192 | $out2->i32_thing = 5; |
| 193 | $in2 = $testClient->testNest($out2); |
| 194 | $in = $in2->struct_thing; |
| 195 | print_r(" = {".$in2->byte_thing.", {\"". |
| 196 | $in->string_thing."\", ". |
| 197 | $in->byte_thing.", ". |
| 198 | $in->i32_thing.", ". |
| 199 | $in->i64_thing."}, ". |
| 200 | $in2->i32_thing."}\n"); |
| 201 | |
| 202 | /** |
| 203 | * MAP TEST |
| 204 | */ |
| 205 | $mapout = array(); |
| 206 | for ($i = 0; $i < 5; ++$i) { |
| 207 | $mapout[$i] = $i-10; |
| 208 | } |
| 209 | print_r("testMap({"); |
| 210 | $first = true; |
| 211 | foreach ($mapout as $key => $val) { |
| 212 | if ($first) { |
| 213 | $first = false; |
| 214 | } else { |
| 215 | print_r(", "); |
| 216 | } |
| 217 | print_r("$key => $val"); |
| 218 | } |
| 219 | print_r("})"); |
| 220 | |
| 221 | $mapin = $testClient->testMap($mapout); |
| 222 | print_r(" = {"); |
| 223 | $first = true; |
| 224 | foreach ($mapin as $key => $val) { |
| 225 | if ($first) { |
| 226 | $first = false; |
| 227 | } else { |
| 228 | print_r(", "); |
| 229 | } |
| 230 | print_r("$key => $val"); |
| 231 | } |
| 232 | print_r("}\n"); |
| 233 | |
| 234 | /** |
| 235 | * SET TEST |
| 236 | */ |
| 237 | $setout = array();; |
| 238 | for ($i = -2; $i < 3; ++$i) { |
| 239 | $setout []= $i; |
| 240 | } |
| 241 | print_r("testSet({"); |
| 242 | $first = true; |
| 243 | foreach ($setout as $val) { |
| 244 | if ($first) { |
| 245 | $first = false; |
| 246 | } else { |
| 247 | print_r(", "); |
| 248 | } |
| 249 | print_r($val); |
| 250 | } |
| 251 | print_r("})"); |
| 252 | $setin = $testClient->testSet($setout); |
| 253 | print_r(" = {"); |
| 254 | $first = true; |
| 255 | foreach ($setin as $val) { |
| 256 | if ($first) { |
| 257 | $first = false; |
| 258 | } else { |
| 259 | print_r(", "); |
| 260 | } |
| 261 | print_r($val); |
| 262 | } |
| 263 | print_r("}\n"); |
| 264 | |
| 265 | /** |
| 266 | * LIST TEST |
| 267 | */ |
| 268 | $listout = array(); |
| 269 | for ($i = -2; $i < 3; ++$i) { |
| 270 | $listout []= $i; |
| 271 | } |
| 272 | print_r("testList({"); |
| 273 | $first = true; |
| 274 | foreach ($listout as $val) { |
| 275 | if ($first) { |
| 276 | $first = false; |
| 277 | } else { |
| 278 | print_r(", "); |
| 279 | } |
| 280 | print_r($val); |
| 281 | } |
| 282 | print_r("})"); |
| 283 | $listin = $testClient->testList($listout); |
| 284 | print_r(" = {"); |
| 285 | $first = true; |
| 286 | foreach ($listin as $val) { |
| 287 | if ($first) { |
| 288 | $first = false; |
| 289 | } else { |
| 290 | print_r(", "); |
| 291 | } |
| 292 | print_r($val); |
| 293 | } |
| 294 | print_r("}\n"); |
| 295 | |
| 296 | /** |
| 297 | * ENUM TEST |
| 298 | */ |
| 299 | print_r("testEnum(ONE)"); |
Roger Meier | 87afaac | 2013-01-06 20:10:42 +0100 | [diff] [blame] | 300 | $ret = $testClient->testEnum(\ThriftTest\Numberz::ONE); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 301 | print_r(" = $ret\n"); |
| 302 | |
| 303 | print_r("testEnum(TWO)"); |
Roger Meier | 87afaac | 2013-01-06 20:10:42 +0100 | [diff] [blame] | 304 | $ret = $testClient->testEnum(\ThriftTest\Numberz::TWO); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 305 | print_r(" = $ret\n"); |
| 306 | |
| 307 | print_r("testEnum(THREE)"); |
Roger Meier | 87afaac | 2013-01-06 20:10:42 +0100 | [diff] [blame] | 308 | $ret = $testClient->testEnum(\ThriftTest\Numberz::THREE); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 309 | print_r(" = $ret\n"); |
| 310 | |
| 311 | print_r("testEnum(FIVE)"); |
Roger Meier | 87afaac | 2013-01-06 20:10:42 +0100 | [diff] [blame] | 312 | $ret = $testClient->testEnum(\ThriftTest\Numberz::FIVE); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 313 | print_r(" = $ret\n"); |
| 314 | |
| 315 | print_r("testEnum(EIGHT)"); |
Roger Meier | 87afaac | 2013-01-06 20:10:42 +0100 | [diff] [blame] | 316 | $ret = $testClient->testEnum(\ThriftTest\Numberz::EIGHT); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 317 | print_r(" = $ret\n"); |
| 318 | |
| 319 | /** |
| 320 | * TYPEDEF TEST |
| 321 | */ |
| 322 | print_r("testTypedef(309858235082523)"); |
| 323 | $uid = $testClient->testTypedef(309858235082523); |
| 324 | print_r(" = $uid\n"); |
| 325 | |
| 326 | /** |
| 327 | * NESTED MAP TEST |
| 328 | */ |
| 329 | print_r("testMapMap(1)"); |
| 330 | $mm = $testClient->testMapMap(1); |
| 331 | print_r(" = {"); |
| 332 | foreach ($mm as $key => $val) { |
| 333 | print_r("$key => {"); |
| 334 | foreach ($val as $k2 => $v2) { |
| 335 | print_r("$k2 => $v2, "); |
| 336 | } |
| 337 | print_r("}, "); |
| 338 | } |
| 339 | print_r("}\n"); |
| 340 | |
| 341 | /** |
| 342 | * INSANITY TEST |
| 343 | */ |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 344 | $insane = new \ThriftTest\Insanity(); |
Roger Meier | 87afaac | 2013-01-06 20:10:42 +0100 | [diff] [blame] | 345 | $insane->userMap[\ThriftTest\Numberz::FIVE] = 5000; |
Roger Meier | 21c0a85 | 2012-09-05 19:47:14 +0000 | [diff] [blame] | 346 | $truck = new \ThriftTest\Xtruct(); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 347 | $truck->string_thing = "Truck"; |
| 348 | $truck->byte_thing = 8; |
| 349 | $truck->i32_thing = 8; |
| 350 | $truck->i64_thing = 8; |
| 351 | $insane->xtructs []= $truck; |
| 352 | print_r("testInsanity()"); |
| 353 | $whoa = $testClient->testInsanity($insane); |
| 354 | print_r(" = {"); |
| 355 | foreach ($whoa as $key => $val) { |
| 356 | print_r("$key => {"); |
| 357 | foreach ($val as $k2 => $v2) { |
| 358 | print_r("$k2 => {"); |
| 359 | $userMap = $v2->userMap; |
| 360 | print_r("{"); |
Bryan Duxbury | a971fb0 | 2011-03-04 00:49:40 +0000 | [diff] [blame] | 361 | if (is_array($userMap)) { |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 362 | foreach ($userMap as $k3 => $v3) { |
| 363 | print_r("$k3 => $v3, "); |
| 364 | } |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 365 | } |
| 366 | print_r("}, "); |
Mark Slee | 5b74307 | 2007-11-13 04:00:29 +0000 | [diff] [blame] | 367 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 368 | $xtructs = $v2->xtructs; |
| 369 | print_r("{"); |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 370 | if (is_array($xtructs)) { |
| 371 | foreach ($xtructs as $x) { |
| 372 | print_r("{\"".$x->string_thing."\", ". |
| 373 | $x->byte_thing.", ".$x->i32_thing.", ".$x->i64_thing."}, "); |
| 374 | } |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 375 | } |
| 376 | print_r("}"); |
Mark Slee | 5b74307 | 2007-11-13 04:00:29 +0000 | [diff] [blame] | 377 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 378 | print_r("}, "); |
| 379 | } |
| 380 | print_r("}, "); |
| 381 | } |
| 382 | print_r("}\n"); |
| 383 | |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 384 | /** |
| 385 | * EXCEPTION TEST |
| 386 | */ |
| 387 | print_r("testException('Xception')"); |
| 388 | try { |
| 389 | $testClient->testException('Xception'); |
| 390 | print_r(" void\nFAILURE\n"); |
Roger Meier | 87afaac | 2013-01-06 20:10:42 +0100 | [diff] [blame] | 391 | } catch (\ThriftTest\Xception $x) { |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 392 | print_r(' caught xception '.$x->errorCode.': '.$x->message."\n"); |
| 393 | } |
| 394 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 395 | |
| 396 | /** |
| 397 | * Normal tests done. |
| 398 | */ |
| 399 | |
| 400 | $stop = microtime(true); |
| 401 | $elp = round(1000*($stop - $start), 0); |
| 402 | print_r("Total time: $elp ms\n"); |
| 403 | |
| 404 | /** |
| 405 | * Extraneous "I don't trust PHP to pack/unpack integer" tests |
| 406 | */ |
| 407 | |
| 408 | // Max I32 |
| 409 | $num = pow(2, 30) + (pow(2, 30) - 1); |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 410 | roundtrip($testClient, testI32, $num); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 411 | |
| 412 | // Min I32 |
| 413 | $num = 0 - pow(2, 31); |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 414 | roundtrip($testClient, testI32, $num); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 415 | |
| 416 | // Max I64 |
| 417 | $num = pow(2, 62) + (pow(2, 62) - 1); |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 418 | roundtrip($testClient, testI64, $num); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 419 | |
| 420 | // Min I64 |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 421 | $num = 0 - pow(2, 62) - pow(2, 62); |
| 422 | roundtrip($testClient, testI64, $num); |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 423 | |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 424 | $transport->close(); |
Nobuaki Sukegawa | e4ba164 | 2016-07-22 18:09:32 +0900 | [diff] [blame] | 425 | exit($exitcode); |