-
Notifications
You must be signed in to change notification settings - Fork 15.9k
fix(php): Correct uint32 type mapping to use UInt32 instead of Int32 #24073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -269,6 +269,43 @@ public function testUint32Field() | |
| $this->assertSame(MIN_INT32, $m->getOptionalUint32()); | ||
| } | ||
|
|
||
| public function testUint32ArrayConstructor() | ||
| { | ||
| $m1 = new TestMessage(['optional_uint32' => 2147483648]); | ||
| $this->assertSame(MIN_INT32, $m1->getOptionalUint32()); | ||
|
|
||
| $m2 = new TestMessage(['optional_uint32' => MAX_UINT32]); | ||
| $this->assertSame(-1, $m2->getOptionalUint32()); | ||
| } | ||
|
|
||
| public function testRepeatedUint32Boundaries() | ||
| { | ||
| $m = new TestMessage(); | ||
| $rf = $m->getRepeatedUint32(); | ||
|
|
||
| $rf[] = 0; | ||
| $rf[] = MAX_INT32; | ||
| $rf[] = 2147483648; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prob ezier to grok if |
||
| $rf[] = MAX_UINT32; | ||
|
|
||
| $this->assertSame(0, $rf[0]); | ||
| $this->assertSame(MAX_INT32, $rf[1]); | ||
| $this->assertSame(MIN_INT32, $rf[2]); | ||
| $this->assertSame(-1, $rf[3]); | ||
| } | ||
|
|
||
| public function testMapUint32Uint32Boundaries() | ||
| { | ||
| $m = new TestMessage(); | ||
| $map = $m->getMapUint32Uint32(); | ||
|
|
||
| $map[1] = 0; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not map[0] ? |
||
| $map[MAX_UINT32] = MAX_UINT32; | ||
|
|
||
| $this->assertSame(0, $map[1]); | ||
| $this->assertSame(-1, $map[MAX_UINT32]); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MAX_UINT32 ? |
||
| } | ||
|
|
||
| ######################################################### | ||
| # Test int64 field. | ||
| ######################################################### | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test pass if you change the lefthand side from
-1toMAX_UINT32?