Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 NSData *expectedData = 163 NSData *expectedData =
164 [self getDataFileNamed:fileName dataToWrite:resultData]; 164 [self getDataFileNamed:fileName dataToWrite:resultData];
165 NSString *expected = [[NSString alloc] initWithData:expectedData 165 NSString *expected = [[NSString alloc] initWithData:expectedData
166 encoding:NSUTF8StringEncoding]; 166 encoding:NSUTF8StringEncoding];
167 XCTAssertEqualObjects(expected, result); 167 XCTAssertEqualObjects(expected, result);
168 [expected release]; 168 [expected release];
169 } 169 }
170 170
171 // TODO(thomasvl): add test with extensions once those format with correct names . 171 // TODO(thomasvl): add test with extensions once those format with correct names .
172 172
173 - (void)testSetRepeatedFields {
174 TestAllTypes *message = [TestAllTypes message];
175
176 NSDictionary *repeatedFieldValues = @{
177 @"repeatedStringArray" : [@[@"foo", @"bar"] mutableCopy],
178 @"repeatedBoolArray" : [GPBBoolArray arrayWithValue:YES],
179 @"repeatedInt32Array" : [GPBInt32Array arrayWithValue:14],
180 @"repeatedInt64Array" : [GPBInt64Array arrayWithValue:15],
181 @"repeatedUint32Array" : [GPBUInt32Array arrayWithValue:16],
182 @"repeatedUint64Array" : [GPBUInt64Array arrayWithValue:16],
183 @"repeatedFloatArray" : [GPBFloatArray arrayWithValue:16],
184 @"repeatedDoubleArray" : [GPBDoubleArray arrayWithValue:16],
185 @"repeatedNestedEnumArray" :
186 [GPBEnumArray arrayWithValidationFunction:TestAllTypes_NestedEnum_IsVali dValue
187 rawValue:TestAllTypes_NestedEnum_Foo],
188 };
189 for (NSString *fieldName in repeatedFieldValues) {
190 GPBFieldDescriptor *field =
191 [message.descriptor fieldWithName:fieldName];
192 XCTAssertNotNil(field, @"No field with name: %@", fieldName);
193 id expectedValues = repeatedFieldValues[fieldName];
194 GPBSetMessageRepeatedField(message, field, expectedValues);
195 XCTAssertEqualObjects(expectedValues,
196 [message valueForKeyPath:fieldName]);
197 }
198 }
199
173 @end 200 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698