|
|
@ -493,6 +493,8 @@ |
|
|
|
TestAllTypes *message = [TestAllTypes message]; |
|
|
|
TestAllTypes *message = [TestAllTypes message]; |
|
|
|
[self setAllFields:message repeatedCount:kGPBDefaultRepeatCount]; |
|
|
|
[self setAllFields:message repeatedCount:kGPBDefaultRepeatCount]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
GPBUnknownFieldSet *unknownFields = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
GPBUnknownFieldSet *unknownFields = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
GPBUnknownField *field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; |
|
|
|
GPBUnknownField *field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; |
|
|
|
[field addVarint:2]; |
|
|
|
[field addVarint:2]; |
|
|
@ -502,6 +504,7 @@ |
|
|
|
[unknownFields addField:field]; |
|
|
|
[unknownFields addField:field]; |
|
|
|
|
|
|
|
|
|
|
|
[message setUnknownFields:unknownFields]; |
|
|
|
[message setUnknownFields:unknownFields]; |
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
|
|
|
|
|
|
|
|
GPBUnknownFields *ufs = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
GPBUnknownFields *ufs = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
[ufs addFieldNumber:1234 fixed32:1234]; |
|
|
|
[ufs addFieldNumber:1234 fixed32:1234]; |
|
|
@ -976,6 +979,9 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)testAutocreatedUnknownFields { |
|
|
|
- (void)testAutocreatedUnknownFields { |
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
|
|
|
|
|
|
|
|
// Doing anything with (except reading) unknown fields should cause the |
|
|
|
// Doing anything with (except reading) unknown fields should cause the |
|
|
|
// submessage to become visible. |
|
|
|
// submessage to become visible. |
|
|
|
TestAllTypes *message = [TestAllTypes message]; |
|
|
|
TestAllTypes *message = [TestAllTypes message]; |
|
|
@ -1009,6 +1015,8 @@ |
|
|
|
extensionRegistry:nil |
|
|
|
extensionRegistry:nil |
|
|
|
error:NULL]); |
|
|
|
error:NULL]); |
|
|
|
XCTAssertTrue([message hasOptionalNestedMessage]); |
|
|
|
XCTAssertTrue([message hasOptionalNestedMessage]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)testSetAutocreatedSubmessageToSelf { |
|
|
|
- (void)testSetAutocreatedSubmessageToSelf { |
|
|
@ -1518,6 +1526,8 @@ |
|
|
|
varint:&varint]); |
|
|
|
varint:&varint]); |
|
|
|
XCTAssertEqual(varint, 12); |
|
|
|
XCTAssertEqual(varint, 12); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
GPBUnknownFieldSet *unknownFields = msg.unknownFields; |
|
|
|
GPBUnknownFieldSet *unknownFields = msg.unknownFields; |
|
|
|
GPBUnknownField *field = |
|
|
|
GPBUnknownField *field = |
|
|
|
[unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber]; |
|
|
|
[unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber]; |
|
|
@ -1532,6 +1542,7 @@ |
|
|
|
XCTAssertNotNil(field); |
|
|
|
XCTAssertNotNil(field); |
|
|
|
XCTAssertEqual(field.varintList.count, 1); |
|
|
|
XCTAssertEqual(field.varintList.count, 1); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:0], 12); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:0], 12); |
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
|
|
|
|
|
|
|
|
// Unknown and known, the known come though an unknown go to unknown fields. |
|
|
|
// Unknown and known, the known come though an unknown go to unknown fields. |
|
|
|
|
|
|
|
|
|
|
@ -1572,6 +1583,8 @@ |
|
|
|
varint:&varint]); |
|
|
|
varint:&varint]); |
|
|
|
XCTAssertEqual(varint, 12); |
|
|
|
XCTAssertEqual(varint, 12); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
unknownFields = msg.unknownFields; |
|
|
|
unknownFields = msg.unknownFields; |
|
|
|
field = [unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber]; |
|
|
|
field = [unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber]; |
|
|
|
XCTAssertNotNil(field); |
|
|
|
XCTAssertNotNil(field); |
|
|
@ -1585,6 +1598,7 @@ |
|
|
|
XCTAssertNotNil(field); |
|
|
|
XCTAssertNotNil(field); |
|
|
|
XCTAssertEqual(field.varintList.count, 1); |
|
|
|
XCTAssertEqual(field.varintList.count, 1); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:0], 12); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:0], 12); |
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)testDefaultingExtensionMessages { |
|
|
|
- (void)testDefaultingExtensionMessages { |
|
|
@ -1885,10 +1899,13 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)testGenerateAndParseUnknownMessage { |
|
|
|
- (void)testGenerateAndParseUnknownMessage { |
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
GPBUnknownFieldSet *unknowns = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
GPBUnknownFieldSet *unknowns = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
[unknowns mergeVarintField:123 value:456]; |
|
|
|
[unknowns mergeVarintField:123 value:456]; |
|
|
|
GPBMessage *message = [GPBMessage message]; |
|
|
|
GPBMessage *message = [GPBMessage message]; |
|
|
|
[message setUnknownFields:unknowns]; |
|
|
|
[message setUnknownFields:unknowns]; |
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
GPBUnknownFields *ufs = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
GPBUnknownFields *ufs = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
[ufs addFieldNumber:1234 varint:5678]; |
|
|
|
[ufs addFieldNumber:1234 varint:5678]; |
|
|
|
XCTAssertTrue([message mergeUnknownFields:ufs extensionRegistry:nil error:NULL]); |
|
|
|
XCTAssertTrue([message mergeUnknownFields:ufs extensionRegistry:nil error:NULL]); |
|
|
@ -1898,19 +1915,25 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)testDelimitedWriteAndParseMultipleMessages { |
|
|
|
- (void)testDelimitedWriteAndParseMultipleMessages { |
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
GPBUnknownFieldSet *unknowns1 = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
GPBUnknownFieldSet *unknowns1 = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
[unknowns1 mergeVarintField:123 value:456]; |
|
|
|
[unknowns1 mergeVarintField:123 value:456]; |
|
|
|
GPBMessage *message1 = [GPBMessage message]; |
|
|
|
GPBMessage *message1 = [GPBMessage message]; |
|
|
|
[message1 setUnknownFields:unknowns1]; |
|
|
|
[message1 setUnknownFields:unknowns1]; |
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
GPBUnknownFields *ufs1 = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
GPBUnknownFields *ufs1 = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
[ufs1 addFieldNumber:1234 varint:5678]; |
|
|
|
[ufs1 addFieldNumber:1234 varint:5678]; |
|
|
|
XCTAssertTrue([message1 mergeUnknownFields:ufs1 extensionRegistry:nil error:NULL]); |
|
|
|
XCTAssertTrue([message1 mergeUnknownFields:ufs1 extensionRegistry:nil error:NULL]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
GPBUnknownFieldSet *unknowns2 = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
GPBUnknownFieldSet *unknowns2 = [[[GPBUnknownFieldSet alloc] init] autorelease]; |
|
|
|
[unknowns2 mergeVarintField:789 value:987]; |
|
|
|
[unknowns2 mergeVarintField:789 value:987]; |
|
|
|
[unknowns2 mergeVarintField:654 value:321]; |
|
|
|
[unknowns2 mergeVarintField:654 value:321]; |
|
|
|
GPBMessage *message2 = [GPBMessage message]; |
|
|
|
GPBMessage *message2 = [GPBMessage message]; |
|
|
|
[message2 setUnknownFields:unknowns2]; |
|
|
|
[message2 setUnknownFields:unknowns2]; |
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
GPBUnknownFields *ufs2 = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
GPBUnknownFields *ufs2 = [[[GPBUnknownFields alloc] init] autorelease]; |
|
|
|
[ufs2 addFieldNumber:2345 fixed32:6789]; |
|
|
|
[ufs2 addFieldNumber:2345 fixed32:6789]; |
|
|
|
[ufs2 addFieldNumber:3456 fixed32:7890]; |
|
|
|
[ufs2 addFieldNumber:3456 fixed32:7890]; |
|
|
@ -2111,6 +2134,8 @@ |
|
|
|
XCTAssertEqual(fields[0].varint, (uint64_t)EnumTestMsg_MyEnum_Two); |
|
|
|
XCTAssertEqual(fields[0].varint, (uint64_t)EnumTestMsg_MyEnum_Two); |
|
|
|
XCTAssertEqual(fields[1].varint, (uint64_t)EnumTestMsg_MyEnum_NegTwo); |
|
|
|
XCTAssertEqual(fields[1].varint, (uint64_t)EnumTestMsg_MyEnum_NegTwo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma clang diagnostic push |
|
|
|
|
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
|
|
|
GPBUnknownFieldSet *unknownFields = msg2.unknownFields; |
|
|
|
GPBUnknownFieldSet *unknownFields = msg2.unknownFields; |
|
|
|
XCTAssertNotNil(unknownFields); |
|
|
|
XCTAssertNotNil(unknownFields); |
|
|
|
XCTAssertEqual(unknownFields.countOfFields, 3U); |
|
|
|
XCTAssertEqual(unknownFields.countOfFields, 3U); |
|
|
@ -2127,6 +2152,7 @@ |
|
|
|
XCTAssertEqual(field.varintList.count, 2U); |
|
|
|
XCTAssertEqual(field.varintList.count, 2U); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)EnumTestMsg_MyEnum_Two); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)EnumTestMsg_MyEnum_Two); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:1], (uint64_t)EnumTestMsg_MyEnum_NegTwo); |
|
|
|
XCTAssertEqual([field.varintList valueAtIndex:1], (uint64_t)EnumTestMsg_MyEnum_NegTwo); |
|
|
|
|
|
|
|
#pragma clang diagnostic pop |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)testReservedWordNaming { |
|
|
|
- (void)testReservedWordNaming { |
|
|
|