diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2016-10-25 17:27:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-25 17:27:05 -0700 |
commit | 51c5ff889ccd3836c25f40baafb350f92c9ee103 (patch) | |
tree | 39ba93f36167e2ab73c25ac337da0a97a4df4970 /php/tests/test_base.php | |
parent | 58580da37357941d502805be3ae520441be77728 (diff) |
Fix pure php implementation for 32-bit machine. (#2282)
Diffstat (limited to 'php/tests/test_base.php')
-rw-r--r-- | php/tests/test_base.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/php/tests/test_base.php b/php/tests/test_base.php index 25f18f74..49886050 100644 --- a/php/tests/test_base.php +++ b/php/tests/test_base.php @@ -13,22 +13,28 @@ class TestBase extends PHPUnit_Framework_TestCase public function expectFields(TestMessage $m) { - $this->assertSame(-42, $m->getOptionalInt32()); - $this->assertSame(42, $m->getOptionalUint32()); - $this->assertSame(-43, $m->getOptionalInt64()); - $this->assertSame(43, $m->getOptionalUint64()); $this->assertSame(-44, $m->getOptionalSint32()); - $this->assertSame(-45, $m->getOptionalSint64()); $this->assertSame(46, $m->getOptionalFixed32()); - $this->assertSame(47, $m->getOptionalFixed64()); $this->assertSame(-46, $m->getOptionalSfixed32()); - $this->assertSame(-47, $m->getOptionalSfixed64()); $this->assertSame(1.5, $m->getOptionalFloat()); $this->assertSame(1.6, $m->getOptionalDouble()); $this->assertSame(true, $m->getOptionalBool()); $this->assertSame('a', $m->getOptionalString()); $this->assertSame('b', $m->getOptionalBytes()); $this->assertSame(33, $m->getOptionalMessage()->getA()); + if (PHP_INT_SIZE == 4) { + $this->assertSame('-43', $m->getOptionalInt64()); + $this->assertSame('43', $m->getOptionalUint64()); + $this->assertSame('-45', $m->getOptionalSint64()); + $this->assertSame('47', $m->getOptionalFixed64()); + $this->assertSame('-47', $m->getOptionalSfixed64()); + } else { + $this->assertSame(-43, $m->getOptionalInt64()); + $this->assertSame(43, $m->getOptionalUint64()); + $this->assertSame(-45, $m->getOptionalSint64()); + $this->assertSame(47, $m->getOptionalFixed64()); + $this->assertSame(-47, $m->getOptionalSfixed64()); + } $this->assertEquals(-42, $m->getRepeatedInt32()[0]); $this->assertEquals(42, $m->getRepeatedUint32()[0]); |