| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 @implementation UnknownFieldSetTest | 54 @implementation UnknownFieldSetTest |
| 55 | 55 |
| 56 - (void)setUp { | 56 - (void)setUp { |
| 57 allFields_ = [self allSetRepeatedCount:kGPBDefaultRepeatCount]; | 57 allFields_ = [self allSetRepeatedCount:kGPBDefaultRepeatCount]; |
| 58 allFieldsData_ = [allFields_ data]; | 58 allFieldsData_ = [allFields_ data]; |
| 59 emptyMessage_ = [TestEmptyMessage parseFromData:allFieldsData_ error:NULL]; | 59 emptyMessage_ = [TestEmptyMessage parseFromData:allFieldsData_ error:NULL]; |
| 60 unknownFields_ = emptyMessage_.unknownFields; | 60 unknownFields_ = emptyMessage_.unknownFields; |
| 61 } | 61 } |
| 62 | 62 |
| 63 - (GPBUnknownField *)getField:(int32_t)number { | |
| 64 return [unknownFields_ getField:number]; | |
| 65 } | |
| 66 | |
| 67 // Constructs a protocol buffer which contains fields with all the same | 63 // Constructs a protocol buffer which contains fields with all the same |
| 68 // numbers as allFieldsData except that each field is some other wire | 64 // numbers as allFieldsData except that each field is some other wire |
| 69 // type. | 65 // type. |
| 70 - (NSData*)getBizarroData { | 66 - (NSData*)getBizarroData { |
| 71 GPBUnknownFieldSet* bizarroFields = | 67 GPBUnknownFieldSet* bizarroFields = |
| 72 [[[GPBUnknownFieldSet alloc] init] autorelease]; | 68 [[[GPBUnknownFieldSet alloc] init] autorelease]; |
| 73 NSUInteger count = [unknownFields_ countOfFields]; | 69 NSUInteger count = [unknownFields_ countOfFields]; |
| 74 int32_t tags[count]; | 70 int32_t tags[count]; |
| 75 [unknownFields_ getTags:tags]; | 71 [unknownFields_ getTags:tags]; |
| 76 for (NSUInteger i = 0; i < count; ++i) { | 72 for (NSUInteger i = 0; i < count; ++i) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 [field1 addFixed32:2]; | 246 [field1 addFixed32:2]; |
| 251 [field1 addFixed64:3]; | 247 [field1 addFixed64:3]; |
| 252 [field1 addLengthDelimited:[NSData dataWithBytes:"hello" length:5]]; | 248 [field1 addLengthDelimited:[NSData dataWithBytes:"hello" length:5]]; |
| 253 [field1 addGroup:[[unknownFields_ copy] autorelease]]; | 249 [field1 addGroup:[[unknownFields_ copy] autorelease]]; |
| 254 GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:2] autorele
ase]; | 250 GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:2] autorele
ase]; |
| 255 [field2 mergeFromField:field1]; | 251 [field2 mergeFromField:field1]; |
| 256 XCTAssertEqualObjects(field1, field2); | 252 XCTAssertEqualObjects(field1, field2); |
| 257 } | 253 } |
| 258 | 254 |
| 259 @end | 255 @end |
| OLD | NEW |