Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
57170b93
Commit
57170b93
authored
Sep 08, 2016
by
Jisi Liu
Committed by
GitHub
Sep 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2096 from pherl/3.0.x
Cherry pick objc test changes into 3.0.x branch
parents
a15df741
5699b920
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
25 deletions
+33
-25
GPBMessageTests+Runtime.m
objectivec/Tests/GPBMessageTests+Runtime.m
+33
-25
No files found.
objectivec/Tests/GPBMessageTests+Runtime.m
View file @
57170b93
...
@@ -2007,52 +2007,52 @@
...
@@ -2007,52 +2007,52 @@
for
(
size_t
i
=
0
;
i
<
GPBARRAYSIZE
(
values
);
++
i
)
{
for
(
size_t
i
=
0
;
i
<
GPBARRAYSIZE
(
values
);
++
i
)
{
switch
(
values
[
i
])
{
switch
(
values
[
i
])
{
case
Message
3
_O_OneOfCase_OneofInt32
:
case
Message
2
_O_OneOfCase_OneofInt32
:
msg
.
oneofInt32
=
100
;
msg
.
oneofInt32
=
100
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofInt64
:
case
Message
2
_O_OneOfCase_OneofInt64
:
msg
.
oneofInt64
=
101
;
msg
.
oneofInt64
=
101
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofUint32
:
case
Message
2
_O_OneOfCase_OneofUint32
:
msg
.
oneofUint32
=
102
;
msg
.
oneofUint32
=
102
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofUint64
:
case
Message
2
_O_OneOfCase_OneofUint64
:
msg
.
oneofUint64
=
103
;
msg
.
oneofUint64
=
103
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofSint32
:
case
Message
2
_O_OneOfCase_OneofSint32
:
msg
.
oneofSint32
=
104
;
msg
.
oneofSint32
=
104
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofSint64
:
case
Message
2
_O_OneOfCase_OneofSint64
:
msg
.
oneofSint64
=
105
;
msg
.
oneofSint64
=
105
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofFixed32
:
case
Message
2
_O_OneOfCase_OneofFixed32
:
msg
.
oneofFixed32
=
106
;
msg
.
oneofFixed32
=
106
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofFixed64
:
case
Message
2
_O_OneOfCase_OneofFixed64
:
msg
.
oneofFixed64
=
107
;
msg
.
oneofFixed64
=
107
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofSfixed32
:
case
Message
2
_O_OneOfCase_OneofSfixed32
:
msg
.
oneofSfixed32
=
108
;
msg
.
oneofSfixed32
=
108
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofSfixed64
:
case
Message
2
_O_OneOfCase_OneofSfixed64
:
msg
.
oneofSfixed64
=
109
;
msg
.
oneofSfixed64
=
109
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofFloat
:
case
Message
2
_O_OneOfCase_OneofFloat
:
msg
.
oneofFloat
=
110
.
0
f
;
msg
.
oneofFloat
=
110
.
0
f
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofDouble
:
case
Message
2
_O_OneOfCase_OneofDouble
:
msg
.
oneofDouble
=
111
.
0
;
msg
.
oneofDouble
=
111
.
0
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofBool
:
case
Message
2
_O_OneOfCase_OneofBool
:
msg
.
oneofBool
=
YES
;
msg
.
oneofBool
=
YES
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofString
:
case
Message
2
_O_OneOfCase_OneofString
:
msg
.
oneofString
=
oneofStringDefault
;
msg
.
oneofString
=
oneofStringDefault
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofBytes
:
case
Message
2
_O_OneOfCase_OneofBytes
:
msg
.
oneofBytes
=
oneofBytesDefault
;
msg
.
oneofBytes
=
oneofBytesDefault
;
break
;
break
;
case
Message
3
_O_OneOfCase_OneofEnum
:
case
Message
2
_O_OneOfCase_OneofEnum
:
msg
.
oneofEnum
=
Message3_Enum_Baz
;
msg
.
oneofEnum
=
Message3_Enum_Baz
;
break
;
break
;
default
:
default
:
...
@@ -2063,7 +2063,7 @@
...
@@ -2063,7 +2063,7 @@
// Should be set to the correct case.
// Should be set to the correct case.
XCTAssertEqual
(
msg
.
oOneOfCase
,
values
[
i
],
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
values
[
i
],
"Loop: %zd"
,
i
);
// Confirm everything is
back as
the defaults.
// Confirm everything is the defaults.
XCTAssertEqual
(
msg
.
oneofInt32
,
100
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofInt32
,
100
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofInt64
,
101
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofInt64
,
101
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofUint32
,
102U
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofUint32
,
102U
,
"Loop: %zd"
,
i
);
...
@@ -2079,20 +2079,25 @@
...
@@ -2079,20 +2079,25 @@
XCTAssertEqual
(
msg
.
oneofBool
,
YES
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofBool
,
YES
,
"Loop: %zd"
,
i
);
XCTAssertEqualObjects
(
msg
.
oneofString
,
oneofStringDefault
,
"Loop: %zd"
,
i
);
XCTAssertEqualObjects
(
msg
.
oneofString
,
oneofStringDefault
,
"Loop: %zd"
,
i
);
XCTAssertEqualObjects
(
msg
.
oneofBytes
,
oneofBytesDefault
,
"Loop: %zd"
,
i
);
XCTAssertEqualObjects
(
msg
.
oneofBytes
,
oneofBytesDefault
,
"Loop: %zd"
,
i
);
XCTAssertNotNil
(
msg
.
oneofGroup
,
"Loop: %zd"
,
i
);
// Skip group, no default to consider.
// Skip group
// Skip message, no default to consider.
// Skip message
XCTAssertEqual
(
msg
.
oneofEnum
,
Message2_Enum_Baz
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofEnum
,
Message2_Enum_Baz
,
"Loop: %zd"
,
i
);
}
}
// We special case nil on string, data,
message, ensure they work as expected.
// We special case nil on string, data,
group, and message, ensure they work
// i.e. - it clears the case.
//
as expected.
i.e. - it clears the case.
msg
.
oneofString
=
nil
;
msg
.
oneofString
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqualObjects
(
msg
.
oneofString
,
oneofStringDefault
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
msg
.
oneofBytes
=
nil
;
msg
.
oneofBytes
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqualObjects
(
msg
.
oneofBytes
,
oneofBytesDefault
);
msg
.
oneofGroup
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertNotNil
(
msg
.
oneofGroup
);
msg
.
oneofMessage
=
nil
;
msg
.
oneofMessage
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertNotNil
(
msg
.
oneofMessage
);
[
msg
release
];
[
msg
release
];
}
}
...
@@ -2212,10 +2217,13 @@
...
@@ -2212,10 +2217,13 @@
// We special case nil on string, data, message, ensure they work as expected.
// We special case nil on string, data, message, ensure they work as expected.
msg
.
oneofString
=
nil
;
msg
.
oneofString
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqualObjects
(
msg
.
oneofString
,
oneofStringDefault
);
msg
.
oneofBytes
=
nil
;
msg
.
oneofBytes
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqualObjects
(
msg
.
oneofBytes
,
oneofBytesDefault
);
msg
.
oneofMessage
=
nil
;
msg
.
oneofMessage
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertNotNil
(
msg
.
oneofMessage
);
[
msg
release
];
[
msg
release
];
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment