diff options
Diffstat (limited to 'objectivec/Tests')
33 files changed, 475 insertions, 276 deletions
diff --git a/objectivec/Tests/GPBCodedInputStreamTests.m b/objectivec/Tests/GPBCodedInputStreamTests.m index d8e128f7..11f7ceaf 100644 --- a/objectivec/Tests/GPBCodedInputStreamTests.m +++ b/objectivec/Tests/GPBCodedInputStreamTests.m @@ -261,7 +261,7 @@ GPBCodedInputStream* input32 = [GPBCodedInputStream streamWithData:data]; XCTAssertEqual(value32, [input32 readInt32]); - int64_t value64 = INT64_MIN | (0x01L << 31); + int64_t value64 = INT64_MIN | (0x01LL << 31); GPBCodedInputStream* input64 = [GPBCodedInputStream streamWithData:data]; XCTAssertEqual(value64, [input64 readInt64]); } diff --git a/objectivec/Tests/GPBDictionaryTests+Bool.m b/objectivec/Tests/GPBDictionaryTests+Bool.m index 0dbe07b6..0af0c815 100644 --- a/objectivec/Tests/GPBDictionaryTests+Bool.m +++ b/objectivec/Tests/GPBDictionaryTests+Bool.m @@ -63,7 +63,8 @@ } - (void)testOne { - GPBBoolUInt32Dictionary *dict = [GPBBoolUInt32Dictionary dictionaryWithUInt32:100U forKey:YES]; + GPBBoolUInt32Dictionary *dict = [[GPBBoolUInt32Dictionary alloc] init]; + [dict setUInt32:100U forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint32_t value; @@ -76,6 +77,7 @@ XCTAssertEqual(aValue, 100U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -214,17 +216,18 @@ XCTAssertNotNil(dict); GPBBoolUInt32Dictionary *dict2 = - [GPBBoolUInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBBoolUInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolUInt32Dictionary *dict = [GPBBoolUInt32Dictionary dictionary]; + GPBBoolUInt32Dictionary *dict = [[GPBBoolUInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -249,6 +252,7 @@ XCTAssertTrue([dict getUInt32:&value forKey:NO]); XCTAssertEqual(value, 101U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -364,7 +368,8 @@ } - (void)testOne { - GPBBoolInt32Dictionary *dict = [GPBBoolInt32Dictionary dictionaryWithInt32:200 forKey:YES]; + GPBBoolInt32Dictionary *dict = [[GPBBoolInt32Dictionary alloc] init]; + [dict setInt32:200 forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -377,6 +382,7 @@ XCTAssertEqual(aValue, 200); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -515,17 +521,18 @@ XCTAssertNotNil(dict); GPBBoolInt32Dictionary *dict2 = - [GPBBoolInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBBoolInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolInt32Dictionary *dict = [GPBBoolInt32Dictionary dictionary]; + GPBBoolInt32Dictionary *dict = [[GPBBoolInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -550,6 +557,7 @@ XCTAssertTrue([dict getInt32:&value forKey:NO]); XCTAssertEqual(value, 201); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -665,7 +673,8 @@ } - (void)testOne { - GPBBoolUInt64Dictionary *dict = [GPBBoolUInt64Dictionary dictionaryWithUInt64:300U forKey:YES]; + GPBBoolUInt64Dictionary *dict = [[GPBBoolUInt64Dictionary alloc] init]; + [dict setUInt64:300U forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint64_t value; @@ -678,6 +687,7 @@ XCTAssertEqual(aValue, 300U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -816,17 +826,18 @@ XCTAssertNotNil(dict); GPBBoolUInt64Dictionary *dict2 = - [GPBBoolUInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBBoolUInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolUInt64Dictionary *dict = [GPBBoolUInt64Dictionary dictionary]; + GPBBoolUInt64Dictionary *dict = [[GPBBoolUInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -851,6 +862,7 @@ XCTAssertTrue([dict getUInt64:&value forKey:NO]); XCTAssertEqual(value, 301U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -966,7 +978,8 @@ } - (void)testOne { - GPBBoolInt64Dictionary *dict = [GPBBoolInt64Dictionary dictionaryWithInt64:400 forKey:YES]; + GPBBoolInt64Dictionary *dict = [[GPBBoolInt64Dictionary alloc] init]; + [dict setInt64:400 forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int64_t value; @@ -979,6 +992,7 @@ XCTAssertEqual(aValue, 400); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1117,17 +1131,18 @@ XCTAssertNotNil(dict); GPBBoolInt64Dictionary *dict2 = - [GPBBoolInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBBoolInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolInt64Dictionary *dict = [GPBBoolInt64Dictionary dictionary]; + GPBBoolInt64Dictionary *dict = [[GPBBoolInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1152,6 +1167,7 @@ XCTAssertTrue([dict getInt64:&value forKey:NO]); XCTAssertEqual(value, 401); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1267,7 +1283,8 @@ } - (void)testOne { - GPBBoolBoolDictionary *dict = [GPBBoolBoolDictionary dictionaryWithBool:NO forKey:YES]; + GPBBoolBoolDictionary *dict = [[GPBBoolBoolDictionary alloc] init]; + [dict setBool:NO forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); BOOL value; @@ -1280,6 +1297,7 @@ XCTAssertEqual(aValue, NO); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1418,17 +1436,18 @@ XCTAssertNotNil(dict); GPBBoolBoolDictionary *dict2 = - [GPBBoolBoolDictionary dictionaryWithDictionary:dict]; + [[GPBBoolBoolDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolBoolDictionary *dict = [GPBBoolBoolDictionary dictionary]; + GPBBoolBoolDictionary *dict = [[GPBBoolBoolDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1453,6 +1472,7 @@ XCTAssertTrue([dict getBool:&value forKey:NO]); XCTAssertEqual(value, YES); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1568,7 +1588,8 @@ } - (void)testOne { - GPBBoolFloatDictionary *dict = [GPBBoolFloatDictionary dictionaryWithFloat:500.f forKey:YES]; + GPBBoolFloatDictionary *dict = [[GPBBoolFloatDictionary alloc] init]; + [dict setFloat:500.f forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); float value; @@ -1581,6 +1602,7 @@ XCTAssertEqual(aValue, 500.f); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1719,17 +1741,18 @@ XCTAssertNotNil(dict); GPBBoolFloatDictionary *dict2 = - [GPBBoolFloatDictionary dictionaryWithDictionary:dict]; + [[GPBBoolFloatDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolFloatDictionary *dict = [GPBBoolFloatDictionary dictionary]; + GPBBoolFloatDictionary *dict = [[GPBBoolFloatDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1754,6 +1777,7 @@ XCTAssertTrue([dict getFloat:&value forKey:NO]); XCTAssertEqual(value, 501.f); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1869,7 +1893,8 @@ } - (void)testOne { - GPBBoolDoubleDictionary *dict = [GPBBoolDoubleDictionary dictionaryWithDouble:600. forKey:YES]; + GPBBoolDoubleDictionary *dict = [[GPBBoolDoubleDictionary alloc] init]; + [dict setDouble:600. forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); double value; @@ -1882,6 +1907,7 @@ XCTAssertEqual(aValue, 600.); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2020,17 +2046,18 @@ XCTAssertNotNil(dict); GPBBoolDoubleDictionary *dict2 = - [GPBBoolDoubleDictionary dictionaryWithDictionary:dict]; + [[GPBBoolDoubleDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolDoubleDictionary *dict = [GPBBoolDoubleDictionary dictionary]; + GPBBoolDoubleDictionary *dict = [[GPBBoolDoubleDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2055,6 +2082,7 @@ XCTAssertTrue([dict getDouble:&value forKey:NO]); XCTAssertEqual(value, 601.); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2170,7 +2198,8 @@ } - (void)testOne { - GPBBoolObjectDictionary<NSString*> *dict = [GPBBoolObjectDictionary dictionaryWithObject:@"abc" forKey:YES]; + GPBBoolObjectDictionary<NSString*> *dict = [[GPBBoolObjectDictionary alloc] init]; + [dict setObject:@"abc" forKey:YES]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); XCTAssertEqualObjects([dict objectForKey:YES], @"abc"); @@ -2180,6 +2209,7 @@ XCTAssertEqualObjects(aObject, @"abc"); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2313,17 +2343,18 @@ XCTAssertNotNil(dict); GPBBoolObjectDictionary<NSString*> *dict2 = - [GPBBoolObjectDictionary dictionaryWithDictionary:dict]; + [[GPBBoolObjectDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBBoolObjectDictionary<NSString*> *dict = [GPBBoolObjectDictionary dictionary]; + GPBBoolObjectDictionary<NSString*> *dict = [[GPBBoolObjectDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2343,6 +2374,7 @@ XCTAssertEqualObjects([dict objectForKey:YES], @"abc"); XCTAssertEqualObjects([dict objectForKey:NO], @"def"); [dict2 release]; + [dict release]; } - (void)testRemove { diff --git a/objectivec/Tests/GPBDictionaryTests+Int32.m b/objectivec/Tests/GPBDictionaryTests+Int32.m index c539bdc2..4ba30203 100644 --- a/objectivec/Tests/GPBDictionaryTests+Int32.m +++ b/objectivec/Tests/GPBDictionaryTests+Int32.m @@ -45,7 +45,6 @@ // To let the testing macros work, add some extra methods to simplify things. @interface GPBInt32EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int32_t)key; - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const int32_t [])keys count:(NSUInteger)count; @@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } @implementation GPBInt32EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int32_t)key { - // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the - // type correct. - return [[(GPBInt32EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue - rawValues:&value - forKeys:&key - count:1] autorelease]; -} - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const int32_t [])keys count:(NSUInteger)count { @@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32UInt32Dictionary *dict = [GPBInt32UInt32Dictionary dictionaryWithUInt32:100U forKey:11]; + GPBInt32UInt32Dictionary *dict = [[GPBInt32UInt32Dictionary alloc] init]; + [dict setUInt32:100U forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint32_t value; @@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 100U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32UInt32Dictionary *dict2 = - [GPBInt32UInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBInt32UInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32UInt32Dictionary *dict = [GPBInt32UInt32Dictionary dictionary]; + GPBInt32UInt32Dictionary *dict = [[GPBInt32UInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt32:&value forKey:14]); XCTAssertEqual(value, 103U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32Int32Dictionary *dict = [GPBInt32Int32Dictionary dictionaryWithInt32:200 forKey:11]; + GPBInt32Int32Dictionary *dict = [[GPBInt32Int32Dictionary alloc] init]; + [dict setInt32:200 forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 200); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32Int32Dictionary *dict2 = - [GPBInt32Int32Dictionary dictionaryWithDictionary:dict]; + [[GPBInt32Int32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32Int32Dictionary *dict = [GPBInt32Int32Dictionary dictionary]; + GPBInt32Int32Dictionary *dict = [[GPBInt32Int32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt32:&value forKey:14]); XCTAssertEqual(value, 203); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32UInt64Dictionary *dict = [GPBInt32UInt64Dictionary dictionaryWithUInt64:300U forKey:11]; + GPBInt32UInt64Dictionary *dict = [[GPBInt32UInt64Dictionary alloc] init]; + [dict setUInt64:300U forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint64_t value; @@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 300U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32UInt64Dictionary *dict2 = - [GPBInt32UInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBInt32UInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32UInt64Dictionary *dict = [GPBInt32UInt64Dictionary dictionary]; + GPBInt32UInt64Dictionary *dict = [[GPBInt32UInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt64:&value forKey:14]); XCTAssertEqual(value, 303U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32Int64Dictionary *dict = [GPBInt32Int64Dictionary dictionaryWithInt64:400 forKey:11]; + GPBInt32Int64Dictionary *dict = [[GPBInt32Int64Dictionary alloc] init]; + [dict setInt64:400 forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int64_t value; @@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 400); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32Int64Dictionary *dict2 = - [GPBInt32Int64Dictionary dictionaryWithDictionary:dict]; + [[GPBInt32Int64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32Int64Dictionary *dict = [GPBInt32Int64Dictionary dictionary]; + GPBInt32Int64Dictionary *dict = [[GPBInt32Int64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt64:&value forKey:14]); XCTAssertEqual(value, 403); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32BoolDictionary *dict = [GPBInt32BoolDictionary dictionaryWithBool:YES forKey:11]; + GPBInt32BoolDictionary *dict = [[GPBInt32BoolDictionary alloc] init]; + [dict setBool:YES forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); BOOL value; @@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, YES); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32BoolDictionary *dict2 = - [GPBInt32BoolDictionary dictionaryWithDictionary:dict]; + [[GPBInt32BoolDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32BoolDictionary *dict = [GPBInt32BoolDictionary dictionary]; + GPBInt32BoolDictionary *dict = [[GPBInt32BoolDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getBool:&value forKey:14]); XCTAssertEqual(value, NO); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32FloatDictionary *dict = [GPBInt32FloatDictionary dictionaryWithFloat:500.f forKey:11]; + GPBInt32FloatDictionary *dict = [[GPBInt32FloatDictionary alloc] init]; + [dict setFloat:500.f forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); float value; @@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 500.f); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32FloatDictionary *dict2 = - [GPBInt32FloatDictionary dictionaryWithDictionary:dict]; + [[GPBInt32FloatDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32FloatDictionary *dict = [GPBInt32FloatDictionary dictionary]; + GPBInt32FloatDictionary *dict = [[GPBInt32FloatDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getFloat:&value forKey:14]); XCTAssertEqual(value, 503.f); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32DoubleDictionary *dict = [GPBInt32DoubleDictionary dictionaryWithDouble:600. forKey:11]; + GPBInt32DoubleDictionary *dict = [[GPBInt32DoubleDictionary alloc] init]; + [dict setDouble:600. forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); double value; @@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 600.); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32DoubleDictionary *dict2 = - [GPBInt32DoubleDictionary dictionaryWithDictionary:dict]; + [[GPBInt32DoubleDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32DoubleDictionary *dict = [GPBInt32DoubleDictionary dictionary]; + GPBInt32DoubleDictionary *dict = [[GPBInt32DoubleDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getDouble:&value forKey:14]); XCTAssertEqual(value, 603.); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32EnumDictionary *dict = [GPBInt32EnumDictionary dictionaryWithEnum:700 forKey:11]; + GPBInt32EnumDictionary *dict = [[GPBInt32EnumDictionary alloc] init]; + [dict setEnum:700 forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 700); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32EnumDictionary *dict2 = - [GPBInt32EnumDictionary dictionaryWithDictionary:dict]; + [[GPBInt32EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32EnumDictionary *dict = [GPBInt32EnumDictionary dictionary]; + GPBInt32EnumDictionary *dict = [[GPBInt32EnumDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getEnum:&value forKey:14]); XCTAssertEqual(value, 703); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32EnumDictionary *dict2 = - [GPBInt32EnumDictionary dictionaryWithDictionary:dict]; + [[GPBInt32EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison + [dict2 release]; [dict release]; } - (void)testUnknownAdds { GPBInt32EnumDictionary *dict = - [GPBInt32EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue]; + [[GPBInt32EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getRawValue:&value forKey:14]); XCTAssertEqual(value, 803); [dict2 release]; + [dict release]; } - (void)testUnknownRemove { @@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt32ObjectDictionary<NSString*> *dict = [GPBInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:11]; + GPBInt32ObjectDictionary<NSString*> *dict = [[GPBInt32ObjectDictionary alloc] init]; + [dict setObject:@"abc" forKey:11]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); XCTAssertEqualObjects([dict objectForKey:11], @"abc"); @@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects(aObject, @"abc"); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt32ObjectDictionary<NSString*> *dict2 = - [GPBInt32ObjectDictionary dictionaryWithDictionary:dict]; + [[GPBInt32ObjectDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt32ObjectDictionary<NSString*> *dict = [GPBInt32ObjectDictionary dictionary]; + GPBInt32ObjectDictionary<NSString*> *dict = [[GPBInt32ObjectDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects([dict objectForKey:13], @"ghi"); XCTAssertEqualObjects([dict objectForKey:14], @"jkl"); [dict2 release]; + [dict release]; } - (void)testRemove { diff --git a/objectivec/Tests/GPBDictionaryTests+Int64.m b/objectivec/Tests/GPBDictionaryTests+Int64.m index b90cdf8c..966024b7 100644 --- a/objectivec/Tests/GPBDictionaryTests+Int64.m +++ b/objectivec/Tests/GPBDictionaryTests+Int64.m @@ -45,7 +45,6 @@ // To let the testing macros work, add some extra methods to simplify things. @interface GPBInt64EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int64_t)key; - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const int64_t [])keys count:(NSUInteger)count; @@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } @implementation GPBInt64EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int64_t)key { - // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the - // type correct. - return [[(GPBInt64EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue - rawValues:&value - forKeys:&key - count:1] autorelease]; -} - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const int64_t [])keys count:(NSUInteger)count { @@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64UInt32Dictionary *dict = [GPBInt64UInt32Dictionary dictionaryWithUInt32:100U forKey:21LL]; + GPBInt64UInt32Dictionary *dict = [[GPBInt64UInt32Dictionary alloc] init]; + [dict setUInt32:100U forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint32_t value; @@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 100U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64UInt32Dictionary *dict2 = - [GPBInt64UInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBInt64UInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64UInt32Dictionary *dict = [GPBInt64UInt32Dictionary dictionary]; + GPBInt64UInt32Dictionary *dict = [[GPBInt64UInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt32:&value forKey:24LL]); XCTAssertEqual(value, 103U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64Int32Dictionary *dict = [GPBInt64Int32Dictionary dictionaryWithInt32:200 forKey:21LL]; + GPBInt64Int32Dictionary *dict = [[GPBInt64Int32Dictionary alloc] init]; + [dict setInt32:200 forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 200); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64Int32Dictionary *dict2 = - [GPBInt64Int32Dictionary dictionaryWithDictionary:dict]; + [[GPBInt64Int32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64Int32Dictionary *dict = [GPBInt64Int32Dictionary dictionary]; + GPBInt64Int32Dictionary *dict = [[GPBInt64Int32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt32:&value forKey:24LL]); XCTAssertEqual(value, 203); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64UInt64Dictionary *dict = [GPBInt64UInt64Dictionary dictionaryWithUInt64:300U forKey:21LL]; + GPBInt64UInt64Dictionary *dict = [[GPBInt64UInt64Dictionary alloc] init]; + [dict setUInt64:300U forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint64_t value; @@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 300U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64UInt64Dictionary *dict2 = - [GPBInt64UInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBInt64UInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64UInt64Dictionary *dict = [GPBInt64UInt64Dictionary dictionary]; + GPBInt64UInt64Dictionary *dict = [[GPBInt64UInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt64:&value forKey:24LL]); XCTAssertEqual(value, 303U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64Int64Dictionary *dict = [GPBInt64Int64Dictionary dictionaryWithInt64:400 forKey:21LL]; + GPBInt64Int64Dictionary *dict = [[GPBInt64Int64Dictionary alloc] init]; + [dict setInt64:400 forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int64_t value; @@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 400); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64Int64Dictionary *dict2 = - [GPBInt64Int64Dictionary dictionaryWithDictionary:dict]; + [[GPBInt64Int64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64Int64Dictionary *dict = [GPBInt64Int64Dictionary dictionary]; + GPBInt64Int64Dictionary *dict = [[GPBInt64Int64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt64:&value forKey:24LL]); XCTAssertEqual(value, 403); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64BoolDictionary *dict = [GPBInt64BoolDictionary dictionaryWithBool:YES forKey:21LL]; + GPBInt64BoolDictionary *dict = [[GPBInt64BoolDictionary alloc] init]; + [dict setBool:YES forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); BOOL value; @@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, YES); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64BoolDictionary *dict2 = - [GPBInt64BoolDictionary dictionaryWithDictionary:dict]; + [[GPBInt64BoolDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64BoolDictionary *dict = [GPBInt64BoolDictionary dictionary]; + GPBInt64BoolDictionary *dict = [[GPBInt64BoolDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getBool:&value forKey:24LL]); XCTAssertEqual(value, NO); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64FloatDictionary *dict = [GPBInt64FloatDictionary dictionaryWithFloat:500.f forKey:21LL]; + GPBInt64FloatDictionary *dict = [[GPBInt64FloatDictionary alloc] init]; + [dict setFloat:500.f forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); float value; @@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 500.f); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64FloatDictionary *dict2 = - [GPBInt64FloatDictionary dictionaryWithDictionary:dict]; + [[GPBInt64FloatDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64FloatDictionary *dict = [GPBInt64FloatDictionary dictionary]; + GPBInt64FloatDictionary *dict = [[GPBInt64FloatDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getFloat:&value forKey:24LL]); XCTAssertEqual(value, 503.f); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64DoubleDictionary *dict = [GPBInt64DoubleDictionary dictionaryWithDouble:600. forKey:21LL]; + GPBInt64DoubleDictionary *dict = [[GPBInt64DoubleDictionary alloc] init]; + [dict setDouble:600. forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); double value; @@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 600.); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64DoubleDictionary *dict2 = - [GPBInt64DoubleDictionary dictionaryWithDictionary:dict]; + [[GPBInt64DoubleDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64DoubleDictionary *dict = [GPBInt64DoubleDictionary dictionary]; + GPBInt64DoubleDictionary *dict = [[GPBInt64DoubleDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getDouble:&value forKey:24LL]); XCTAssertEqual(value, 603.); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64EnumDictionary *dict = [GPBInt64EnumDictionary dictionaryWithEnum:700 forKey:21LL]; + GPBInt64EnumDictionary *dict = [[GPBInt64EnumDictionary alloc] init]; + [dict setEnum:700 forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 700); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64EnumDictionary *dict2 = - [GPBInt64EnumDictionary dictionaryWithDictionary:dict]; + [[GPBInt64EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64EnumDictionary *dict = [GPBInt64EnumDictionary dictionary]; + GPBInt64EnumDictionary *dict = [[GPBInt64EnumDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getEnum:&value forKey:24LL]); XCTAssertEqual(value, 703); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64EnumDictionary *dict2 = - [GPBInt64EnumDictionary dictionaryWithDictionary:dict]; + [[GPBInt64EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison + [dict2 release]; [dict release]; } - (void)testUnknownAdds { GPBInt64EnumDictionary *dict = - [GPBInt64EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue]; + [[GPBInt64EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getRawValue:&value forKey:24LL]); XCTAssertEqual(value, 803); [dict2 release]; + [dict release]; } - (void)testUnknownRemove { @@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBInt64ObjectDictionary<NSString*> *dict = [GPBInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:21LL]; + GPBInt64ObjectDictionary<NSString*> *dict = [[GPBInt64ObjectDictionary alloc] init]; + [dict setObject:@"abc" forKey:21LL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); XCTAssertEqualObjects([dict objectForKey:21LL], @"abc"); @@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects(aObject, @"abc"); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBInt64ObjectDictionary<NSString*> *dict2 = - [GPBInt64ObjectDictionary dictionaryWithDictionary:dict]; + [[GPBInt64ObjectDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBInt64ObjectDictionary<NSString*> *dict = [GPBInt64ObjectDictionary dictionary]; + GPBInt64ObjectDictionary<NSString*> *dict = [[GPBInt64ObjectDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi"); XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl"); [dict2 release]; + [dict release]; } - (void)testRemove { diff --git a/objectivec/Tests/GPBDictionaryTests+String.m b/objectivec/Tests/GPBDictionaryTests+String.m index 5df1d51d..82d7952b 100644 --- a/objectivec/Tests/GPBDictionaryTests+String.m +++ b/objectivec/Tests/GPBDictionaryTests+String.m @@ -45,7 +45,6 @@ // To let the testing macros work, add some extra methods to simplify things. @interface GPBStringEnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(NSString *)key; - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const NSString * [])keys count:(NSUInteger)count; @@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } @implementation GPBStringEnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(NSString *)key { - // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the - // type correct. - return [[(GPBStringEnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue - rawValues:&value - forKeys:&key - count:1] autorelease]; -} - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const NSString * [])keys count:(NSUInteger)count { @@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringUInt32Dictionary *dict = [GPBStringUInt32Dictionary dictionaryWithUInt32:100U forKey:@"foo"]; + GPBStringUInt32Dictionary *dict = [[GPBStringUInt32Dictionary alloc] init]; + [dict setUInt32:100U forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint32_t value; @@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 100U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringUInt32Dictionary *dict2 = - [GPBStringUInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBStringUInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringUInt32Dictionary *dict = [GPBStringUInt32Dictionary dictionary]; + GPBStringUInt32Dictionary *dict = [[GPBStringUInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt32:&value forKey:@"mumble"]); XCTAssertEqual(value, 103U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringInt32Dictionary *dict = [GPBStringInt32Dictionary dictionaryWithInt32:200 forKey:@"foo"]; + GPBStringInt32Dictionary *dict = [[GPBStringInt32Dictionary alloc] init]; + [dict setInt32:200 forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 200); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringInt32Dictionary *dict2 = - [GPBStringInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBStringInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringInt32Dictionary *dict = [GPBStringInt32Dictionary dictionary]; + GPBStringInt32Dictionary *dict = [[GPBStringInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt32:&value forKey:@"mumble"]); XCTAssertEqual(value, 203); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringUInt64Dictionary *dict = [GPBStringUInt64Dictionary dictionaryWithUInt64:300U forKey:@"foo"]; + GPBStringUInt64Dictionary *dict = [[GPBStringUInt64Dictionary alloc] init]; + [dict setUInt64:300U forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint64_t value; @@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 300U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringUInt64Dictionary *dict2 = - [GPBStringUInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBStringUInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringUInt64Dictionary *dict = [GPBStringUInt64Dictionary dictionary]; + GPBStringUInt64Dictionary *dict = [[GPBStringUInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt64:&value forKey:@"mumble"]); XCTAssertEqual(value, 303U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringInt64Dictionary *dict = [GPBStringInt64Dictionary dictionaryWithInt64:400 forKey:@"foo"]; + GPBStringInt64Dictionary *dict = [[GPBStringInt64Dictionary alloc] init]; + [dict setInt64:400 forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int64_t value; @@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 400); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringInt64Dictionary *dict2 = - [GPBStringInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBStringInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringInt64Dictionary *dict = [GPBStringInt64Dictionary dictionary]; + GPBStringInt64Dictionary *dict = [[GPBStringInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt64:&value forKey:@"mumble"]); XCTAssertEqual(value, 403); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringBoolDictionary *dict = [GPBStringBoolDictionary dictionaryWithBool:YES forKey:@"foo"]; + GPBStringBoolDictionary *dict = [[GPBStringBoolDictionary alloc] init]; + [dict setBool:YES forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); BOOL value; @@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, YES); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringBoolDictionary *dict2 = - [GPBStringBoolDictionary dictionaryWithDictionary:dict]; + [[GPBStringBoolDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringBoolDictionary *dict = [GPBStringBoolDictionary dictionary]; + GPBStringBoolDictionary *dict = [[GPBStringBoolDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getBool:&value forKey:@"mumble"]); XCTAssertEqual(value, NO); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringFloatDictionary *dict = [GPBStringFloatDictionary dictionaryWithFloat:500.f forKey:@"foo"]; + GPBStringFloatDictionary *dict = [[GPBStringFloatDictionary alloc] init]; + [dict setFloat:500.f forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); float value; @@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 500.f); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringFloatDictionary *dict2 = - [GPBStringFloatDictionary dictionaryWithDictionary:dict]; + [[GPBStringFloatDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringFloatDictionary *dict = [GPBStringFloatDictionary dictionary]; + GPBStringFloatDictionary *dict = [[GPBStringFloatDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getFloat:&value forKey:@"mumble"]); XCTAssertEqual(value, 503.f); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringDoubleDictionary *dict = [GPBStringDoubleDictionary dictionaryWithDouble:600. forKey:@"foo"]; + GPBStringDoubleDictionary *dict = [[GPBStringDoubleDictionary alloc] init]; + [dict setDouble:600. forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); double value; @@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 600.); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringDoubleDictionary *dict2 = - [GPBStringDoubleDictionary dictionaryWithDictionary:dict]; + [[GPBStringDoubleDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringDoubleDictionary *dict = [GPBStringDoubleDictionary dictionary]; + GPBStringDoubleDictionary *dict = [[GPBStringDoubleDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getDouble:&value forKey:@"mumble"]); XCTAssertEqual(value, 603.); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBStringEnumDictionary *dict = [GPBStringEnumDictionary dictionaryWithEnum:700 forKey:@"foo"]; + GPBStringEnumDictionary *dict = [[GPBStringEnumDictionary alloc] init]; + [dict setEnum:700 forKey:@"foo"]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 700); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringEnumDictionary *dict2 = - [GPBStringEnumDictionary dictionaryWithDictionary:dict]; + [[GPBStringEnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBStringEnumDictionary *dict = [GPBStringEnumDictionary dictionary]; + GPBStringEnumDictionary *dict = [[GPBStringEnumDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getEnum:&value forKey:@"mumble"]); XCTAssertEqual(value, 703); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBStringEnumDictionary *dict2 = - [GPBStringEnumDictionary dictionaryWithDictionary:dict]; + [[GPBStringEnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison + [dict2 release]; [dict release]; } - (void)testUnknownAdds { GPBStringEnumDictionary *dict = - [GPBStringEnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue]; + [[GPBStringEnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getRawValue:&value forKey:@"mumble"]); XCTAssertEqual(value, 803); [dict2 release]; + [dict release]; } - (void)testUnknownRemove { diff --git a/objectivec/Tests/GPBDictionaryTests+UInt32.m b/objectivec/Tests/GPBDictionaryTests+UInt32.m index 1d3f6f78..5314c58a 100644 --- a/objectivec/Tests/GPBDictionaryTests+UInt32.m +++ b/objectivec/Tests/GPBDictionaryTests+UInt32.m @@ -45,7 +45,6 @@ // To let the testing macros work, add some extra methods to simplify things. @interface GPBUInt32EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint32_t)key; - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count; @@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } @implementation GPBUInt32EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint32_t)key { - // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the - // type correct. - return [[(GPBUInt32EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue - rawValues:&value - forKeys:&key - count:1] autorelease]; -} - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count { @@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32UInt32Dictionary *dict = [GPBUInt32UInt32Dictionary dictionaryWithUInt32:100U forKey:1U]; + GPBUInt32UInt32Dictionary *dict = [[GPBUInt32UInt32Dictionary alloc] init]; + [dict setUInt32:100U forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint32_t value; @@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 100U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32UInt32Dictionary *dict2 = - [GPBUInt32UInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt32UInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32UInt32Dictionary *dict = [GPBUInt32UInt32Dictionary dictionary]; + GPBUInt32UInt32Dictionary *dict = [[GPBUInt32UInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt32:&value forKey:4U]); XCTAssertEqual(value, 103U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32Int32Dictionary *dict = [GPBUInt32Int32Dictionary dictionaryWithInt32:200 forKey:1U]; + GPBUInt32Int32Dictionary *dict = [[GPBUInt32Int32Dictionary alloc] init]; + [dict setInt32:200 forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 200); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32Int32Dictionary *dict2 = - [GPBUInt32Int32Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt32Int32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32Int32Dictionary *dict = [GPBUInt32Int32Dictionary dictionary]; + GPBUInt32Int32Dictionary *dict = [[GPBUInt32Int32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt32:&value forKey:4U]); XCTAssertEqual(value, 203); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32UInt64Dictionary *dict = [GPBUInt32UInt64Dictionary dictionaryWithUInt64:300U forKey:1U]; + GPBUInt32UInt64Dictionary *dict = [[GPBUInt32UInt64Dictionary alloc] init]; + [dict setUInt64:300U forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint64_t value; @@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 300U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32UInt64Dictionary *dict2 = - [GPBUInt32UInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt32UInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32UInt64Dictionary *dict = [GPBUInt32UInt64Dictionary dictionary]; + GPBUInt32UInt64Dictionary *dict = [[GPBUInt32UInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt64:&value forKey:4U]); XCTAssertEqual(value, 303U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32Int64Dictionary *dict = [GPBUInt32Int64Dictionary dictionaryWithInt64:400 forKey:1U]; + GPBUInt32Int64Dictionary *dict = [[GPBUInt32Int64Dictionary alloc] init]; + [dict setInt64:400 forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int64_t value; @@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 400); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32Int64Dictionary *dict2 = - [GPBUInt32Int64Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt32Int64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32Int64Dictionary *dict = [GPBUInt32Int64Dictionary dictionary]; + GPBUInt32Int64Dictionary *dict = [[GPBUInt32Int64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt64:&value forKey:4U]); XCTAssertEqual(value, 403); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32BoolDictionary *dict = [GPBUInt32BoolDictionary dictionaryWithBool:YES forKey:1U]; + GPBUInt32BoolDictionary *dict = [[GPBUInt32BoolDictionary alloc] init]; + [dict setBool:YES forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); BOOL value; @@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, YES); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32BoolDictionary *dict2 = - [GPBUInt32BoolDictionary dictionaryWithDictionary:dict]; + [[GPBUInt32BoolDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32BoolDictionary *dict = [GPBUInt32BoolDictionary dictionary]; + GPBUInt32BoolDictionary *dict = [[GPBUInt32BoolDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getBool:&value forKey:4U]); XCTAssertEqual(value, NO); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32FloatDictionary *dict = [GPBUInt32FloatDictionary dictionaryWithFloat:500.f forKey:1U]; + GPBUInt32FloatDictionary *dict = [[GPBUInt32FloatDictionary alloc] init]; + [dict setFloat:500.f forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); float value; @@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 500.f); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32FloatDictionary *dict2 = - [GPBUInt32FloatDictionary dictionaryWithDictionary:dict]; + [[GPBUInt32FloatDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32FloatDictionary *dict = [GPBUInt32FloatDictionary dictionary]; + GPBUInt32FloatDictionary *dict = [[GPBUInt32FloatDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getFloat:&value forKey:4U]); XCTAssertEqual(value, 503.f); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32DoubleDictionary *dict = [GPBUInt32DoubleDictionary dictionaryWithDouble:600. forKey:1U]; + GPBUInt32DoubleDictionary *dict = [[GPBUInt32DoubleDictionary alloc] init]; + [dict setDouble:600. forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); double value; @@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 600.); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32DoubleDictionary *dict2 = - [GPBUInt32DoubleDictionary dictionaryWithDictionary:dict]; + [[GPBUInt32DoubleDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32DoubleDictionary *dict = [GPBUInt32DoubleDictionary dictionary]; + GPBUInt32DoubleDictionary *dict = [[GPBUInt32DoubleDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getDouble:&value forKey:4U]); XCTAssertEqual(value, 603.); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32EnumDictionary *dict = [GPBUInt32EnumDictionary dictionaryWithEnum:700 forKey:1U]; + GPBUInt32EnumDictionary *dict = [[GPBUInt32EnumDictionary alloc] init]; + [dict setEnum:700 forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 700); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32EnumDictionary *dict2 = - [GPBUInt32EnumDictionary dictionaryWithDictionary:dict]; + [[GPBUInt32EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32EnumDictionary *dict = [GPBUInt32EnumDictionary dictionary]; + GPBUInt32EnumDictionary *dict = [[GPBUInt32EnumDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getEnum:&value forKey:4U]); XCTAssertEqual(value, 703); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32EnumDictionary *dict2 = - [GPBUInt32EnumDictionary dictionaryWithDictionary:dict]; + [[GPBUInt32EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison + [dict2 release]; [dict release]; } - (void)testUnknownAdds { GPBUInt32EnumDictionary *dict = - [GPBUInt32EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue]; + [[GPBUInt32EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getRawValue:&value forKey:4U]); XCTAssertEqual(value, 803); [dict2 release]; + [dict release]; } - (void)testUnknownRemove { @@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt32ObjectDictionary<NSString*> *dict = [GPBUInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:1U]; + GPBUInt32ObjectDictionary<NSString*> *dict = [[GPBUInt32ObjectDictionary alloc] init]; + [dict setObject:@"abc" forKey:1U]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); XCTAssertEqualObjects([dict objectForKey:1U], @"abc"); @@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects(aObject, @"abc"); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt32ObjectDictionary<NSString*> *dict2 = - [GPBUInt32ObjectDictionary dictionaryWithDictionary:dict]; + [[GPBUInt32ObjectDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt32ObjectDictionary<NSString*> *dict = [GPBUInt32ObjectDictionary dictionary]; + GPBUInt32ObjectDictionary<NSString*> *dict = [[GPBUInt32ObjectDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects([dict objectForKey:3U], @"ghi"); XCTAssertEqualObjects([dict objectForKey:4U], @"jkl"); [dict2 release]; + [dict release]; } - (void)testRemove { diff --git a/objectivec/Tests/GPBDictionaryTests+UInt64.m b/objectivec/Tests/GPBDictionaryTests+UInt64.m index 94c116f6..ccd063f5 100644 --- a/objectivec/Tests/GPBDictionaryTests+UInt64.m +++ b/objectivec/Tests/GPBDictionaryTests+UInt64.m @@ -45,7 +45,6 @@ // To let the testing macros work, add some extra methods to simplify things. @interface GPBUInt64EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint64_t)key; - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count; @@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } @implementation GPBUInt64EnumDictionary (TestingTweak) -+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint64_t)key { - // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the - // type correct. - return [[(GPBUInt64EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue - rawValues:&value - forKeys:&key - count:1] autorelease]; -} - (instancetype)initWithEnums:(const int32_t [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count { @@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64UInt32Dictionary *dict = [GPBUInt64UInt32Dictionary dictionaryWithUInt32:100U forKey:31ULL]; + GPBUInt64UInt32Dictionary *dict = [[GPBUInt64UInt32Dictionary alloc] init]; + [dict setUInt32:100U forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint32_t value; @@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 100U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64UInt32Dictionary *dict2 = - [GPBUInt64UInt32Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt64UInt32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64UInt32Dictionary *dict = [GPBUInt64UInt32Dictionary dictionary]; + GPBUInt64UInt32Dictionary *dict = [[GPBUInt64UInt32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt32:&value forKey:34ULL]); XCTAssertEqual(value, 103U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64Int32Dictionary *dict = [GPBUInt64Int32Dictionary dictionaryWithInt32:200 forKey:31ULL]; + GPBUInt64Int32Dictionary *dict = [[GPBUInt64Int32Dictionary alloc] init]; + [dict setInt32:200 forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 200); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64Int32Dictionary *dict2 = - [GPBUInt64Int32Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt64Int32Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64Int32Dictionary *dict = [GPBUInt64Int32Dictionary dictionary]; + GPBUInt64Int32Dictionary *dict = [[GPBUInt64Int32Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt32:&value forKey:34ULL]); XCTAssertEqual(value, 203); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64UInt64Dictionary *dict = [GPBUInt64UInt64Dictionary dictionaryWithUInt64:300U forKey:31ULL]; + GPBUInt64UInt64Dictionary *dict = [[GPBUInt64UInt64Dictionary alloc] init]; + [dict setUInt64:300U forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); uint64_t value; @@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 300U); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64UInt64Dictionary *dict2 = - [GPBUInt64UInt64Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt64UInt64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64UInt64Dictionary *dict = [GPBUInt64UInt64Dictionary dictionary]; + GPBUInt64UInt64Dictionary *dict = [[GPBUInt64UInt64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getUInt64:&value forKey:34ULL]); XCTAssertEqual(value, 303U); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64Int64Dictionary *dict = [GPBUInt64Int64Dictionary dictionaryWithInt64:400 forKey:31ULL]; + GPBUInt64Int64Dictionary *dict = [[GPBUInt64Int64Dictionary alloc] init]; + [dict setInt64:400 forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int64_t value; @@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 400); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64Int64Dictionary *dict2 = - [GPBUInt64Int64Dictionary dictionaryWithDictionary:dict]; + [[GPBUInt64Int64Dictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64Int64Dictionary *dict = [GPBUInt64Int64Dictionary dictionary]; + GPBUInt64Int64Dictionary *dict = [[GPBUInt64Int64Dictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getInt64:&value forKey:34ULL]); XCTAssertEqual(value, 403); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64BoolDictionary *dict = [GPBUInt64BoolDictionary dictionaryWithBool:YES forKey:31ULL]; + GPBUInt64BoolDictionary *dict = [[GPBUInt64BoolDictionary alloc] init]; + [dict setBool:YES forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); BOOL value; @@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, YES); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64BoolDictionary *dict2 = - [GPBUInt64BoolDictionary dictionaryWithDictionary:dict]; + [[GPBUInt64BoolDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64BoolDictionary *dict = [GPBUInt64BoolDictionary dictionary]; + GPBUInt64BoolDictionary *dict = [[GPBUInt64BoolDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getBool:&value forKey:34ULL]); XCTAssertEqual(value, NO); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64FloatDictionary *dict = [GPBUInt64FloatDictionary dictionaryWithFloat:500.f forKey:31ULL]; + GPBUInt64FloatDictionary *dict = [[GPBUInt64FloatDictionary alloc] init]; + [dict setFloat:500.f forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); float value; @@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 500.f); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64FloatDictionary *dict2 = - [GPBUInt64FloatDictionary dictionaryWithDictionary:dict]; + [[GPBUInt64FloatDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64FloatDictionary *dict = [GPBUInt64FloatDictionary dictionary]; + GPBUInt64FloatDictionary *dict = [[GPBUInt64FloatDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getFloat:&value forKey:34ULL]); XCTAssertEqual(value, 503.f); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64DoubleDictionary *dict = [GPBUInt64DoubleDictionary dictionaryWithDouble:600. forKey:31ULL]; + GPBUInt64DoubleDictionary *dict = [[GPBUInt64DoubleDictionary alloc] init]; + [dict setDouble:600. forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); double value; @@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 600.); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64DoubleDictionary *dict2 = - [GPBUInt64DoubleDictionary dictionaryWithDictionary:dict]; + [[GPBUInt64DoubleDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64DoubleDictionary *dict = [GPBUInt64DoubleDictionary dictionary]; + GPBUInt64DoubleDictionary *dict = [[GPBUInt64DoubleDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getDouble:&value forKey:34ULL]); XCTAssertEqual(value, 603.); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64EnumDictionary *dict = [GPBUInt64EnumDictionary dictionaryWithEnum:700 forKey:31ULL]; + GPBUInt64EnumDictionary *dict = [[GPBUInt64EnumDictionary alloc] init]; + [dict setEnum:700 forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); int32_t value; @@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqual(aValue, 700); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64EnumDictionary *dict2 = - [GPBUInt64EnumDictionary dictionaryWithDictionary:dict]; + [[GPBUInt64EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64EnumDictionary *dict = [GPBUInt64EnumDictionary dictionary]; + GPBUInt64EnumDictionary *dict = [[GPBUInt64EnumDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getEnum:&value forKey:34ULL]); XCTAssertEqual(value, 703); [dict2 release]; + [dict release]; } - (void)testRemove { @@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64EnumDictionary *dict2 = - [GPBUInt64EnumDictionary dictionaryWithDictionary:dict]; + [[GPBUInt64EnumDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison + [dict2 release]; [dict release]; } - (void)testUnknownAdds { GPBUInt64EnumDictionary *dict = - [GPBUInt64EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue]; + [[GPBUInt64EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertTrue([dict getRawValue:&value forKey:34ULL]); XCTAssertEqual(value, 803); [dict2 release]; + [dict release]; } - (void)testUnknownRemove { @@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { } - (void)testOne { - GPBUInt64ObjectDictionary<NSString*> *dict = [GPBUInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:31ULL]; + GPBUInt64ObjectDictionary<NSString*> *dict = [[GPBUInt64ObjectDictionary alloc] init]; + [dict setObject:@"abc" forKey:31ULL]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 1U); XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc"); @@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects(aObject, @"abc"); XCTAssertNotEqual(stop, NULL); }]; + [dict release]; } - (void)testBasics { @@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertNotNil(dict); GPBUInt64ObjectDictionary<NSString*> *dict2 = - [GPBUInt64ObjectDictionary dictionaryWithDictionary:dict]; + [[GPBUInt64ObjectDictionary alloc] initWithDictionary:dict]; XCTAssertNotNil(dict2); // Should be new pointer, but equal objects. XCTAssertNotEqual(dict, dict2); XCTAssertEqualObjects(dict, dict2); + [dict2 release]; [dict release]; } - (void)testAdds { - GPBUInt64ObjectDictionary<NSString*> *dict = [GPBUInt64ObjectDictionary dictionary]; + GPBUInt64ObjectDictionary<NSString*> *dict = [[GPBUInt64ObjectDictionary alloc] init]; XCTAssertNotNil(dict); XCTAssertEqual(dict.count, 0U); @@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) { XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi"); XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl"); [dict2 release]; + [dict release]; } - (void)testRemove { diff --git a/objectivec/Tests/GPBDictionaryTests.pddm b/objectivec/Tests/GPBDictionaryTests.pddm index d6aa7211..17f12c28 100644 --- a/objectivec/Tests/GPBDictionaryTests.pddm +++ b/objectivec/Tests/GPBDictionaryTests.pddm @@ -78,7 +78,8 @@ //%} //% //%- (void)testOne { -//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VALUE_NAME$u##:VAL1 forKey:KEY1]; +//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init]; +//% [dict set##VALUE_NAME$u##:VAL1 forKey:KEY1]; //% XCTAssertNotNil(dict); //% XCTAssertEqual(dict.count, 1U); //%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY1, VAL1) @@ -88,6 +89,7 @@ //% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1); //% XCTAssertNotEqual(stop, NULL); //% }]; +//% [dict release]; //%} //% //%- (void)testBasics { @@ -223,17 +225,18 @@ //% XCTAssertNotNil(dict); //% //% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 = -//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary:dict]; +//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict]; //% XCTAssertNotNil(dict2); //% //% // Should be new pointer, but equal objects. //% XCTAssertNotEqual(dict, dict2); //% XCTAssertEqualObjects(dict, dict2); +//% [dict2 release]; //% [dict release]; //%} //% //%- (void)testAdds { -//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionary]; +//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init]; //% XCTAssertNotNil(dict); //% //% XCTAssertEqual(dict.count, 0U); @@ -255,6 +258,7 @@ //%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY3, VAL3) //%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY4, VAL4) //% [dict2 release]; +//% [dict release]; //%} //% //%- (void)testRemove { @@ -522,19 +526,20 @@ //% XCTAssertNotNil(dict); //% //% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 = -//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary:dict]; +//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict]; //% XCTAssertNotNil(dict2); //% //% // Should be new pointer, but equal objects. //% XCTAssertNotEqual(dict, dict2); //% XCTAssertEqualObjects(dict, dict2); //% XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison +//% [dict2 release]; //% [dict release]; //%} //% //%- (void)testUnknownAdds { //% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = -//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue]; +//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue]; //% XCTAssertNotNil(dict); //% //% XCTAssertEqual(dict.count, 0U); @@ -561,6 +566,7 @@ //%TEST_VALUE##VHELPER(VALUE_NAME, dict, value, KEY4, kGPBUnrecognizedEnumeratorValue) //%TEST_RAW_VALUE##VHELPER(dict, value, KEY4, VAL4) //% [dict2 release]; +//% [dict release]; //%} //% //%- (void)testUnknownRemove { @@ -729,7 +735,6 @@ //%PDDM-DEFINE TEST_HELPERS(KEY_NAME, KEY_TYPE, KisP) //%// To let the testing macros work, add some extra methods to simplify things. //%@interface GPB##KEY_NAME##EnumDictionary (TestingTweak) -//%+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(KEY_TYPE##KisP$S##KisP)key; //%- (instancetype)initWithEnums:(const int32_t [])values //% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys //% count:(NSUInteger)count; @@ -748,14 +753,6 @@ //%} //% //%@implementation GPB##KEY_NAME##EnumDictionary (TestingTweak) -//%+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(KEY_TYPE##KisP$S##KisP)key { -//% // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the -//% // type correct. -//% return [[(GPB##KEY_NAME##EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue -//% KEY_NAME$S rawValues:&value -//% KEY_NAME$S forKeys:&key -//% KEY_NAME$S count:1] autorelease]; -//%} //%- (instancetype)initWithEnums:(const int32_t [])values //% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys //% count:(NSUInteger)count { @@ -801,7 +798,8 @@ //%} //% //%- (void)testOne { -//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VALUE_NAME$u##:VAL1 forKey:KEY1]; +//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init]; +//% [dict set##VALUE_NAME$u##:VAL1 forKey:KEY1]; //% XCTAssertNotNil(dict); //% XCTAssertEqual(dict.count, 1U); //%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY1, VAL1) @@ -811,6 +809,7 @@ //% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1); //% XCTAssertNotEqual(stop, NULL); //% }]; +//% [dict release]; //%} //% //%- (void)testBasics { @@ -944,17 +943,18 @@ //% XCTAssertNotNil(dict); //% //% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 = -//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary:dict]; +//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict]; //% XCTAssertNotNil(dict2); //% //% // Should be new pointer, but equal objects. //% XCTAssertNotEqual(dict, dict2); //% XCTAssertEqualObjects(dict, dict2); +//% [dict2 release]; //% [dict release]; //%} //% //%- (void)testAdds { -//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionary]; +//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init]; //% XCTAssertNotNil(dict); //% //% XCTAssertEqual(dict.count, 0U); @@ -974,6 +974,7 @@ //%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY1, VAL1) //%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY2, VAL2) //% [dict2 release]; +//% [dict release]; //%} //% //%- (void)testRemove { diff --git a/objectivec/Tests/GPBMessageTests+Serialization.m b/objectivec/Tests/GPBMessageTests+Serialization.m index 55d77a1f..921feab7 100644 --- a/objectivec/Tests/GPBMessageTests+Serialization.m +++ b/objectivec/Tests/GPBMessageTests+Serialization.m @@ -1114,10 +1114,10 @@ - (void)testMap_Proto2UnknownEnum { TestEnumMapPlusExtra *orig = [[TestEnumMapPlusExtra alloc] init]; - orig.knownMapField = [GPBInt32EnumDictionary - dictionaryWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue]; - orig.unknownMapField = [GPBInt32EnumDictionary - dictionaryWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue]; + orig.knownMapField = [[[GPBInt32EnumDictionary alloc] + initWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue] autorelease]; + orig.unknownMapField = [[[GPBInt32EnumDictionary alloc] + initWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue] autorelease]; [orig.knownMapField setEnum:Proto2MapEnumPlusExtra_EProto2MapEnumFoo forKey:0]; [orig.unknownMapField setEnum:Proto2MapEnumPlusExtra_EProto2MapEnumExtra diff --git a/objectivec/Tests/GPBMessageTests.m b/objectivec/Tests/GPBMessageTests.m index c15535c5..4d75f1e1 100644 --- a/objectivec/Tests/GPBMessageTests.m +++ b/objectivec/Tests/GPBMessageTests.m @@ -1238,7 +1238,8 @@ // with different objects that are equal). TestRecursiveMessageWithRepeatedField *message3 = [TestRecursiveMessageWithRepeatedField message]; - message3.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:10 forKey:20]; + message3.iToI = [[[GPBInt32Int32Dictionary alloc] init] autorelease]; + [message3.iToI setInt32:10 forKey:20]; message3.strToStr = [NSMutableDictionary dictionaryWithObject:@"abc" forKey:@"123"]; XCTAssertNotNil(message.iToI); @@ -1323,7 +1324,8 @@ XCTAssertFalse([message hasA]); GPBInt32Int32Dictionary *iToI = [message.a.iToI retain]; XCTAssertEqual(iToI->_autocreator, message.a); // Pointer comparision - message.a.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:6 forKey:7]; + message.a.iToI = [[[GPBInt32Int32Dictionary alloc] init] autorelease]; + [message.a.iToI setInt32:6 forKey:7]; XCTAssertTrue([message hasA]); XCTAssertNotEqual(message.a.iToI, iToI); // Pointer comparision XCTAssertNil(iToI->_autocreator); diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json index 0cbf9acc..9f4a9e59 100644 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,72 +1,103 @@ { "images" : [ { + "size" : "20x20", "idiom" : "iphone", + "filename" : "appicon_40.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "appicon_60.png", + "scale" : "3x" + }, + { "size" : "29x29", + "idiom" : "iphone", + "filename" : "appicon_29.png", "scale" : "1x" }, { - "idiom" : "iphone", "size" : "29x29", + "idiom" : "iphone", + "filename" : "appicon_58.png", "scale" : "2x" }, { - "idiom" : "iphone", "size" : "29x29", + "idiom" : "iphone", + "filename" : "appicon_87.png", "scale" : "3x" }, { - "idiom" : "iphone", "size" : "40x40", + "idiom" : "iphone", + "filename" : "appicon_80.png", "scale" : "2x" }, { - "idiom" : "iphone", "size" : "40x40", + "idiom" : "iphone", + "filename" : "appicon_120.png", "scale" : "3x" }, { - "size" : "57x57", "idiom" : "iphone", - "filename" : "iPhone6.png", + "size" : "57x57", "scale" : "1x" }, { - "size" : "57x57", "idiom" : "iphone", - "filename" : "iPhone6_2x.png", + "size" : "57x57", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", - "filename" : "iPhone7_2x.png", + "filename" : "appicon_120.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", - "filename" : "iPhone7_3x.png", + "filename" : "appicon_180.png", "scale" : "3x" }, { + "size" : "20x20", "idiom" : "ipad", - "size" : "29x29", + "filename" : "appicon_20.png", "scale" : "1x" }, { + "size" : "20x20", "idiom" : "ipad", - "size" : "29x29", + "filename" : "appicon_40.png", "scale" : "2x" }, { + "size" : "29x29", "idiom" : "ipad", - "size" : "40x40", + "filename" : "appicon_29.png", "scale" : "1x" }, { + "size" : "29x29", "idiom" : "ipad", + "filename" : "appicon_58.png", + "scale" : "2x" + }, + { "size" : "40x40", + "idiom" : "ipad", + "filename" : "appicon_40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "appicon_80.png", "scale" : "2x" }, { @@ -80,32 +111,37 @@ "scale" : "2x" }, { - "size" : "72x72", "idiom" : "ipad", - "filename" : "iPad6.png", + "size" : "72x72", "scale" : "1x" }, { - "size" : "72x72", "idiom" : "ipad", - "filename" : "iPad6_2x.png", + "size" : "72x72", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", - "filename" : "iPad7.png", + "filename" : "appicon_76.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", - "filename" : "iPad7_2x.png", + "filename" : "appicon_152.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "appicon_167.png", "scale" : "2x" }, { - "idiom" : "car", - "size" : "120x120", + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "appicon_1024.png", "scale" : "1x" } ], @@ -113,4 +149,4 @@ "version" : 1, "author" : "xcode" } -} +}
\ No newline at end of file diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.png Binary files differnew file mode 100644 index 00000000..6b6a102e --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.png Binary files differnew file mode 100644 index 00000000..1bac2e58 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.png Binary files differnew file mode 100644 index 00000000..80f13301 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.png Binary files differnew file mode 100644 index 00000000..99f0745e --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.png Binary files differnew file mode 100644 index 00000000..ae123712 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.png Binary files differnew file mode 100644 index 00000000..8e530c49 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.png Binary files differnew file mode 100644 index 00000000..1826feb9 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.png Binary files differnew file mode 100644 index 00000000..f2e2ded1 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.png Binary files differnew file mode 100644 index 00000000..0ec6d003 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.png Binary files differnew file mode 100644 index 00000000..8664e8b0 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.png Binary files differnew file mode 100644 index 00000000..d4bb05b9 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.png Binary files differnew file mode 100644 index 00000000..8fa6a8e7 --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.png Binary files differnew file mode 100644 index 00000000..b41bc67b --- /dev/null +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.png diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png Binary files differdeleted file mode 100644 index 43da2ee4..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png Binary files differdeleted file mode 100644 index 2ec93704..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png Binary files differdeleted file mode 100644 index aec8bc1b..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png Binary files differdeleted file mode 100644 index e39cc3e7..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png Binary files differdeleted file mode 100644 index 5572d79f..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png Binary files differdeleted file mode 100644 index 2424997f..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png Binary files differdeleted file mode 100644 index 10bfc3cf..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png Binary files differdeleted file mode 100644 index 8d16f14d..00000000 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png +++ /dev/null diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json b/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json index 5a296668..a0ad363c 100644 --- a/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -3,43 +3,30 @@ { "orientation" : "portrait", "idiom" : "ipad", - "minimum-system-version" : "7.0", "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", "minimum-system-version" : "7.0", - "extent" : "full-screen", "scale" : "1x" }, { "orientation" : "landscape", "idiom" : "ipad", - "minimum-system-version" : "7.0", "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", "minimum-system-version" : "7.0", - "scale" : "2x" + "scale" : "1x" }, { "orientation" : "portrait", - "idiom" : "iphone", + "idiom" : "ipad", + "extent" : "full-screen", "minimum-system-version" : "7.0", - "subtype" : "retina4", "scale" : "2x" }, { - "orientation" : "portrait", + "orientation" : "landscape", "idiom" : "ipad", - "minimum-system-version" : "7.0", "extent" : "full-screen", - "scale" : "1x" + "minimum-system-version" : "7.0", + "scale" : "2x" } ], "info" : { |