From: Thiemo Mättig Date: Wed, 9 Jul 2014 15:21:40 +0000 (+0200) Subject: Skip 64 bit MWMessagePack tests on 32 bit machines X-Git-Tag: 1.31.0-rc.0~15036^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/Boston?a=commitdiff_plain;h=ceb196fa9f7dbc4da6e2c5c3adb4f7f13dd75d7a;p=lhc%2Fweb%2Fwiklou.git Skip 64 bit MWMessagePack tests on 32 bit machines It's not only Windows. I have an Ubuntu machine with a PHP setup limited to 32 bit (which is totally fine, it allows me to develop and always stay compatible to Windows and other 32 bit environments). I don't see an other way than to skip these tests on a 32 bit machine. The loss (PHP clips values larger than 2147483647 to 2147483647) does not happen in the code that is tested but in the test setup. Change-Id: Ie9a173c0a92ed84eaaea981a25ba130f2eca169e --- diff --git a/tests/phpunit/includes/libs/MWMessagePackTest.php b/tests/phpunit/includes/libs/MWMessagePackTest.php index b99ef86549..334d5b51d0 100644 --- a/tests/phpunit/includes/libs/MWMessagePackTest.php +++ b/tests/phpunit/includes/libs/MWMessagePackTest.php @@ -14,7 +14,7 @@ class MWMessagePackTest extends MediaWikiTestCase { * serialization function. */ public function provider() { - return array( + $tests = array( array( 'nil', null, 'c0' ), array( 'bool', true, 'c3' ), array( 'bool', false, 'c2' ), @@ -25,16 +25,12 @@ class MWMessagePackTest extends MediaWikiTestCase { array( 'uint 8', 128, 'cc80' ), array( 'uint 16', 1000, 'cd03e8' ), array( 'uint 32', 100000, 'ce000186a0' ), - array( 'uint 64', 10000000000, 'cf00000002540be400' ), array( 'negative fixnum', -1, 'ff' ), array( 'negative fixnum', -2, 'fe' ), array( 'int 8', -128, 'd080' ), array( 'int 8', -35, 'd0dd' ), array( 'int 16', -1000, 'd1fc18' ), array( 'int 32', -100000, 'd2fffe7960' ), - array( 'int 64', -10000000000, 'd3fffffffdabf41c00' ), - array( 'int 64', -223372036854775807, 'd3fce66c50e2840001' ), - array( 'int 64', -9223372036854775807, 'd38000000000000001' ), array( 'double', 0.1, 'cb3fb999999999999a' ), array( 'double', 1.1, 'cb3ff199999999999a' ), array( 'double', 123.456, 'cb405edd2f1a9fbe77' ), @@ -56,6 +52,15 @@ class MWMessagePackTest extends MediaWikiTestCase { '82a36f6e6501a374776f02' ), ); + + if ( PHP_INT_SIZE > 4 ) { + $tests[] = array( 'uint 64', 10000000000, 'cf00000002540be400' ); + $tests[] = array( 'int 64', -10000000000, 'd3fffffffdabf41c00' ); + $tests[] = array( 'int 64', -223372036854775807, 'd3fce66c50e2840001' ); + $tests[] = array( 'int 64', -9223372036854775807, 'd38000000000000001' ); + } + + return $tests; } /** @@ -65,6 +70,6 @@ class MWMessagePackTest extends MediaWikiTestCase { */ public function testPack( $type, $value, $expected ) { $actual = bin2hex( MWMessagePack::pack( $value ) ); - $this->assertEquals( $actual, $expected, $type ); + $this->assertEquals( $expected, $actual, $type ); } }