aboutsummaryrefslogtreecommitdiff
path: root/AddressBook/GTMABAddressBookTest.m
diff options
context:
space:
mode:
Diffstat (limited to 'AddressBook/GTMABAddressBookTest.m')
-rw-r--r--AddressBook/GTMABAddressBookTest.m230
1 files changed, 115 insertions, 115 deletions
diff --git a/AddressBook/GTMABAddressBookTest.m b/AddressBook/GTMABAddressBookTest.m
index bd6e224..4a7b0ce 100644
--- a/AddressBook/GTMABAddressBookTest.m
+++ b/AddressBook/GTMABAddressBookTest.m
@@ -6,9 +6,9 @@
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -46,13 +46,13 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
book_ = [[GTMABAddressBook addressBook] retain];
[pool release];
STAssertNotNil(book_, nil);
- NSArray *people
+ NSArray *people
= [book_ peopleWithCompositeNameWithPrefix:kGTMABTestFirstName];
GTMABPerson *person;
GTM_FOREACH_OBJECT(person, people) {
[book_ removeRecord:person];
}
- NSArray *groups
+ NSArray *groups
= [book_ groupsWithCompositeNameWithPrefix:kGTMABTestGroupName];
GTMABGroup *group;
GTM_FOREACH_OBJECT(group, groups) {
@@ -66,23 +66,23 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
}
- (void)testGenericAddressBook {
- STAssertEqualObjects([GTMABAddressBook localizedLabel:(NSString *)kABHomeLabel],
- @"home",
+ STAssertEqualObjects([GTMABAddressBook localizedLabel:(NSString *)kABHomeLabel],
+ @"home",
nil);
STAssertThrows([GTMABRecord recordWithRecord:nil], nil);
}
- (void)testAddingAndRemovingPerson {
// Create a person
- GTMABPerson *person = [GTMABPerson personWithFirstName:kGTMABTestFirstName
+ GTMABPerson *person = [GTMABPerson personWithFirstName:kGTMABTestFirstName
lastName:kGTMABTestLastName];
STAssertNotNil(person, nil);
-
+
// Add person
NSArray *people = [book_ people];
STAssertFalse([people containsObject:person], nil);
STAssertTrue([book_ addRecord:person], nil);
-#if GTM_IPHONE_SDK
+#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2)
// Normally this next line would be STAssertTrue, however due to
// Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work
// We will check to make sure it stays broken ;-)
@@ -95,14 +95,14 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertNotNil(people, nil);
#if GTM_IPHONE_SDK
// Normally this next line would be STAssertTrue, however due to
- // Radar 6200703: ABAddressBookAddRecord doesn't add an item to the people
+ // Radar 6200703: ABAddressBookAddRecord doesn't add an item to the people
// array until it's saved
// We will check to make sure it stays broken ;-)
STAssertFalse([people containsObject:person], nil);
#else // GTM_IPHONE_SDK
STAssertTrue([people containsObject:person], nil);
#endif // GTM_IPHONE_SDK
-
+
// Save book_
STAssertTrue([book_ save], nil);
people = [book_ people];
@@ -113,16 +113,16 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
GTMABRecordID recordID = [person recordID];
STAssertNotEquals(recordID, kGTMABRecordInvalidID, nil);
-
+
GTMABRecord *record = [book_ personForId:recordID];
STAssertEqualObjects(record, person, nil);
-
+
// Remove person
STAssertTrue([book_ removeRecord:person], nil);
people = [book_ peopleWithCompositeNameWithPrefix:kGTMABTestFirstName];
STAssertEquals([people count], (NSUInteger)0, nil);
-
-#if GTM_IPHONE_SDK
+
+#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2)
// Normally this next line would be STAssertTrue, however due to
// Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work
// We will check to make sure it stays broken ;-)
@@ -132,33 +132,33 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
#endif // GTM_IPHONE_SDK
people = [book_ people];
STAssertFalse([people containsObject:person], nil);
-
+
// Save Book
STAssertTrue([book_ save], nil);
people = [book_ people];
STAssertFalse([book_ hasUnsavedChanges], nil);
- STAssertFalse([people containsObject:person], nil);
+ STAssertFalse([people containsObject:person], nil);
record = [book_ personForId:recordID];
STAssertNil(record, nil);
-
+
// Bogus data
STAssertFalse([book_ addRecord:nil], nil);
STAssertFalse([book_ removeRecord:nil], nil);
-
+
STAssertNotNULL([book_ addressBookRef], nil);
-
+
}
- (void)testAddingAndRemovingGroup {
// Create a group
GTMABGroup *group = [GTMABGroup groupNamed:kGTMABTestGroupName];
STAssertNotNil(group, nil);
-
+
// Add group
NSArray *groups = [book_ groups];
STAssertFalse([groups containsObject:group], nil);
STAssertTrue([book_ addRecord:group], nil);
-#if GTM_IPHONE_SDK
+#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2)
// Normally this next line would be STAssertTrue, however due to
// Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work
// We will check to make sure it stays broken ;-)
@@ -166,19 +166,19 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
#else // GTM_IPHONE_SDK
STAssertTrue([book_ hasUnsavedChanges], nil);
#endif // GTM_IPHONE_SDK
-
+
groups = [book_ groups];
STAssertNotNil(groups, nil);
#if GTM_IPHONE_SDK
// Normally this next line would be STAssertTrue, however due to
- // Radar 6200703: ABAddressBookAddRecord doesn't add an item to the groups
+ // Radar 6200703: ABAddressBookAddRecord doesn't add an item to the groups
// array until it's saved
// We will check to make sure it stays broken ;-)
STAssertFalse([groups containsObject:group], nil);
#else // GTM_IPHONE_SDK
STAssertTrue([groups containsObject:group], nil);
#endif // GTM_IPHONE_SDK
-
+
// Save book_
STAssertTrue([book_ save], nil);
groups = [book_ groups];
@@ -189,14 +189,14 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
GTMABRecordID recordID = [group recordID];
STAssertNotEquals(recordID, kGTMABRecordInvalidID, nil);
-
+
GTMABRecord *record = [book_ groupForId:recordID];
STAssertEqualObjects(record, group, nil);
-
+
// Remove group
STAssertTrue([book_ removeRecord:group], nil);
-
-#if GTM_IPHONE_SDK
+
+#if GTM_IPHONE_SDK && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2)
// Normally this next line would be STAssertTrue, however due to
// Radar 6200638: ABAddressBookHasUnsavedChanges doesn't work
// We will check to make sure it stays broken ;-)
@@ -206,12 +206,12 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
#endif // GTM_IPHONE_SDK
groups = [book_ groups];
STAssertFalse([groups containsObject:group], nil);
-
+
// Save Book
STAssertTrue([book_ save], nil);
groups = [book_ groups];
STAssertFalse([book_ hasUnsavedChanges], nil);
- STAssertFalse([groups containsObject:group], nil);
+ STAssertFalse([groups containsObject:group], nil);
groups = [book_ groupsWithCompositeNameWithPrefix:kGTMABTestGroupName];
STAssertEquals([groups count], (NSUInteger)0, nil);
record = [book_ groupForId:recordID];
@@ -235,17 +235,17 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertFalse([person setValue:nil forProperty:kGTMABPersonFirstNameProperty], nil);
STAssertFalse([person setValue:[NSNumber numberWithInt:1]
forProperty:kGTMABPersonFirstNameProperty], nil);
- STAssertFalse([person setValue:@"Bart"
+ STAssertFalse([person setValue:@"Bart"
forProperty:kGTMABPersonBirthdayProperty], nil);
-
- GTMABPropertyType property
+
+ GTMABPropertyType property
= [GTMABPerson typeOfProperty:kGTMABPersonLastNameProperty];
STAssertEquals(property, (GTMABPropertyType)kGTMABStringPropertyType, nil);
-
- NSString *string
+
+ NSString *string
= [GTMABPerson localizedPropertyName:kGTMABPersonLastNameProperty];
STAssertEqualObjects(string, @"Last", nil);
-
+
string = [GTMABPerson localizedPropertyName:kGTMABRecordInvalidID];
#ifdef GTM_IPHONE_SDK
STAssertEqualObjects(string, kGTMABUnknownPropertyName, nil);
@@ -254,11 +254,11 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
#endif // GTM_IPHONE_SDK
string = [person description];
STAssertNotNil(string, nil);
-
+
GTMABPersonCompositeNameFormat format = [GTMABPerson compositeNameFormat];
STAssertTrue(format == kABPersonCompositeNameFormatFirstNameFirst ||
format == kABPersonCompositeNameFormatLastNameFirst, nil);
-
+
NSData *data = [person imageData];
STAssertNil(data, nil);
STAssertTrue([person setImageData:nil], nil);
@@ -280,8 +280,8 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertEqualObjects(data, data2, nil);
STAssertTrue([person setImageData:nil], nil);
data = [person imageData];
- STAssertNil(data, nil);
-
+ STAssertNil(data, nil);
+
STAssertTrue([person setImage:image], nil);
GTMABImage *image2 = [person image];
STAssertNotNil(image2, nil);
@@ -292,23 +292,23 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertEqualObjects([image TIFFRepresentation],
[image2 TIFFRepresentation], nil);
#endif // GTM_IPHONE_SDK
-
+
person = [GTMABPerson personWithFirstName:kGTMABTestFirstName
lastName:kGTMABTestLastName];
data = [NSData dataWithBytes:"a" length:1];
STAssertFalse([person setImageData:data], nil);
-
- GTMABMutableMultiValue *value
+
+ GTMABMutableMultiValue *value
= [GTMABMutableMultiValue valueWithPropertyType:kGTMABStringPropertyType];
STAssertNotNil(value, nil);
- STAssertNotEquals([value addValue:@"222-222-2222"
- withLabel:(CFStringRef)kABHomeLabel],
+ STAssertNotEquals([value addValue:@"222-222-2222"
+ withLabel:(CFStringRef)kABHomeLabel],
kGTMABMultiValueInvalidIdentifier, nil);
- STAssertNotEquals([value addValue:@"333-333-3333"
- withLabel:(CFStringRef)kABWorkLabel],
+ STAssertNotEquals([value addValue:@"333-333-3333"
+ withLabel:(CFStringRef)kABWorkLabel],
kGTMABMultiValueInvalidIdentifier, nil);
- STAssertTrue([person setValue:value
+ STAssertTrue([person setValue:value
forProperty:kGTMABPersonPhoneProperty], nil);
id value2 = [person valueForProperty:kGTMABPersonPhoneProperty];
STAssertNotNil(value2, nil);
@@ -333,37 +333,37 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertFalse([group setValue:nil forProperty:kABGroupNameProperty], nil);
STAssertFalse([group setValue:[NSNumber numberWithInt:1]
forProperty:kABGroupNameProperty], nil);
- STAssertFalse([group setValue:@"Bart"
- forProperty:kGTMABPersonBirthdayProperty], nil);
-
+ STAssertFalse([group setValue:@"Bart"
+ forProperty:kGTMABPersonBirthdayProperty], nil);
+
ABPropertyType property = [GTMABGroup typeOfProperty:kABGroupNameProperty];
STAssertEquals(property, (ABPropertyType)kGTMABStringPropertyType, nil);
-
+
property = [GTMABGroup typeOfProperty:kGTMABPersonLastNameProperty];
STAssertEquals(property, (ABPropertyType)kGTMABInvalidPropertyType, nil);
-
+
NSString *string = [GTMABGroup localizedPropertyName:kABGroupNameProperty];
STAssertEqualObjects(string, @"Name", nil);
-
+
string = [GTMABGroup localizedPropertyName:kGTMABPersonLastNameProperty];
STAssertEqualObjects(string, kGTMABUnknownPropertyName, nil);
-
+
string = [GTMABGroup localizedPropertyName:kGTMABRecordInvalidID];
STAssertEqualObjects(string, kGTMABUnknownPropertyName, nil);
string = [group description];
STAssertNotNil(string, nil);
-
+
// Adding and removing members
group = [GTMABGroup groupNamed:kGTMABTestGroupName];
NSArray *members = [group members];
STAssertEquals([members count], (NSUInteger)0, @"Members: %@", members);
-
+
STAssertFalse([group addMember:nil], nil);
-
+
members = [group members];
STAssertEquals([members count], (NSUInteger)0, @"Members: %@", members);
-
+
GTMABPerson *person = [GTMABPerson personWithFirstName:kGTMABTestFirstName
lastName:kGTMABTestLastName];
STAssertNotNil(person, nil);
@@ -389,14 +389,14 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertThrows([[GTMABMutableMultiValue alloc] init], nil);
GTMABMultiValue *value = [[GTMABMultiValue alloc] initWithMultiValue:nil];
STAssertNil(value, nil);
- GTMABMutableMultiValue *mutValue
+ GTMABMutableMultiValue *mutValue
= [GTMABMutableMultiValue valueWithPropertyType:kGTMABInvalidPropertyType];
STAssertNil(mutValue, nil);
- mutValue
+ mutValue
= [[[GTMABMutableMultiValue alloc]
initWithMutableMultiValue:nil] autorelease];
STAssertNil(mutValue, nil);
- mutValue
+ mutValue
= [[[GTMABMutableMultiValue alloc]
initWithMultiValue:nil] autorelease];
STAssertNil(mutValue, nil);
@@ -423,11 +423,11 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
// and apparently you get back basically the same thing. However if you
// ask a type that you created with kABMultiFooPropertyType for it's type
// it returns just kABFooPropertyType.
- STAssertEquals([mutValue propertyType],
+ STAssertEquals([mutValue propertyType],
(GTMABPropertyType)(types[i] & ~kABMultiValueMask), nil);
}
#endif // GTM_IPHONE_SDK
- mutValue
+ mutValue
= [GTMABMutableMultiValue valueWithPropertyType:kGTMABStringPropertyType];
STAssertNotNil(mutValue, nil);
value = [[mutValue copy] autorelease];
@@ -438,30 +438,30 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertNil([mutValue valueAtIndex:0], nil);
STAssertNil([mutValue labelAtIndex:0], nil);
#if GTM_IPHONE_SDK
- STAssertEquals([mutValue identifierAtIndex:0],
+ STAssertEquals([mutValue identifierAtIndex:0],
kGTMABMultiValueInvalidIdentifier, nil);
- STAssertEquals([mutValue propertyType],
+ STAssertEquals([mutValue propertyType],
(GTMABPropertyType)kGTMABStringPropertyType, nil);
#else // GTM_IPHONE_SDK
- STAssertEqualObjects([mutValue identifierAtIndex:0],
+ STAssertEqualObjects([mutValue identifierAtIndex:0],
kGTMABMultiValueInvalidIdentifier, nil);
#endif // GTM_IPHONE_SDK
- GTMABMultiValueIdentifier ident
+ GTMABMultiValueIdentifier ident
= [mutValue addValue:nil withLabel:(CFStringRef)kABHomeLabel];
#if GTM_IPHONE_SDK
STAssertEquals(ident, kGTMABMultiValueInvalidIdentifier, nil);
#else // GTM_IPHONE_SDK
STAssertEqualObjects(ident, kGTMABMultiValueInvalidIdentifier, nil);
#endif // GTM_IPHONE_SDK
-
- ident = [mutValue addValue:@"val1"
+
+ ident = [mutValue addValue:@"val1"
withLabel:nil];
#if GTM_IPHONE_SDK
STAssertEquals(ident, kGTMABMultiValueInvalidIdentifier, nil);
#else // GTM_IPHONE_SDK
STAssertEqualObjects(ident, kGTMABMultiValueInvalidIdentifier, nil);
#endif // GTM_IPHONE_SDK
- ident = [mutValue insertValue:@"val1"
+ ident = [mutValue insertValue:@"val1"
withLabel:nil
atIndex:0];
#if GTM_IPHONE_SDK
@@ -477,7 +477,7 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
#else // GTM_IPHONE_SDK
STAssertEqualObjects(ident, kGTMABMultiValueInvalidIdentifier, nil);
#endif // GTM_IPHONE_SDK
- ident = [mutValue addValue:@"val1"
+ ident = [mutValue addValue:@"val1"
withLabel:(CFStringRef)kABHomeLabel];
#if GTM_IPHONE_SDK
STAssertNotEquals(ident, kGTMABMultiValueInvalidIdentifier, nil);
@@ -500,19 +500,19 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
withValue:@"newVal1"], nil);
STAssertFalse([mutValue replaceValueAtIndex:10
withValue:@"newVal1"], nil);
-
+
STAssertEqualObjects([mutValue valueForIdentifier:ident], @"newVal1", nil);
- STAssertEqualObjects([mutValue labelForIdentifier:ident],
+ STAssertEqualObjects([mutValue labelForIdentifier:ident],
(NSString *)kABWorkLabel, nil);
-
- GTMABMultiValueIdentifier ident2
- = [mutValue insertValue:@"val2"
- withLabel:(CFStringRef)kABOtherLabel
+
+ GTMABMultiValueIdentifier ident2
+ = [mutValue insertValue:@"val2"
+ withLabel:(CFStringRef)kABOtherLabel
atIndex:0];
STAssertNotEquals(ident2, kGTMABMultiValueInvalidIdentifier, nil);
STAssertNotEquals(ident2, ident, nil);
- GTMABMultiValueIdentifier ident3
- = [mutValue insertValue:@"val3"
+ GTMABMultiValueIdentifier ident3
+ = [mutValue insertValue:@"val3"
withLabel:(CFStringRef)kGTMABPersonPhoneMainLabel
atIndex:10];
#if GTM_IPHONE_SDK
@@ -524,21 +524,21 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertEquals(idx3, (NSUInteger)NSNotFound, nil);
STAssertTrue([mutValue removeValueAndLabelAtIndex:1], nil);
STAssertFalse([mutValue removeValueAndLabelAtIndex:1], nil);
-
- NSUInteger idx4
+
+ NSUInteger idx4
= [mutValue indexForIdentifier:kGTMABMultiValueInvalidIdentifier];
STAssertEquals(idx4, (NSUInteger)NSNotFound, nil);
-
+
STAssertNotNULL([mutValue multiValueRef], nil);
-
+
// Enumerator test
- mutValue
+ mutValue
= [GTMABMutableMultiValue valueWithPropertyType:kGTMABIntegerPropertyType];
STAssertNotNil(mutValue, nil);
for (int i = 0; i < 100; i++) {
NSString *label = [NSString stringWithFormat:@"label %d", i];
NSNumber *val = [NSNumber numberWithInt:i];
- STAssertNotEquals([mutValue addValue:val
+ STAssertNotEquals([mutValue addValue:val
withLabel:(CFStringRef)label],
kGTMABMultiValueInvalidIdentifier, nil);
}
@@ -554,7 +554,7 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
GTM_FOREACH_ENUMEREE(val, [value valueEnumerator]) {
STAssertEqualObjects(val, [NSNumber numberWithInt:count++], nil);
}
-
+
// Test messing with the values while we're enumerating them
NSEnumerator *labelEnum = [mutValue labelEnumerator];
NSEnumerator *valueEnum = [mutValue valueEnumerator];
@@ -565,7 +565,7 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
STAssertTrue([mutValue removeValueAndLabelAtIndex:0], nil);
STAssertThrows([labelEnum nextObject], nil);
STAssertThrows([valueEnum nextObject], nil);
-
+
// Test messing with the values while we're fast enumerating them
// Should throw an exception on the second access.
BOOL exceptionThrown = NO;
@@ -579,17 +579,17 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
}
} @catch(NSException *e) {
STAssertEqualObjects([e name], NSGenericException, @"Got %@ instead", e);
- STAssertEquals(count, 2,
+ STAssertEquals(count, 2,
@"Should have caught it on the second access");
exceptionThrown = YES;
} // COV_NF_LINE - because we always catch, this brace doesn't get exec'd
STAssertTrue(exceptionThrown, @"We should have thrown an exception"
@" because the values under the enumerator were modified");
-
+
}
#if GTM_IPHONE_SDK
-- (void)testRadar6208390 {
+- (void)testRadar6208390 {
GTMABPropertyType types[] = {
kGTMABStringPropertyType,
kGTMABIntegerPropertyType,
@@ -612,55 +612,55 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
val = [[NSDictionary alloc] initWithObjectsAndKeys:@"1", @"1", nil];
} else if (type == kGTMABStringPropertyType) {
val = [[NSString alloc] initWithFormat:@"value %d"];
- } else if (type == kGTMABIntegerPropertyType
+ } else if (type == kGTMABIntegerPropertyType
|| type == kGTMABRealPropertyType ) {
val = [[NSNumber alloc] initWithInt:143];
} else if (type == kGTMABDateTimePropertyType) {
val = [[NSDate alloc] init];
}
- STAssertNotNil(val,
+ STAssertNotNil(val,
@"Testing type %d, %@", type, val);
NSUInteger firstRetainCount = [val retainCount];
- STAssertNotEquals(firstRetainCount,
- (NSUInteger)0,
+ STAssertNotEquals(firstRetainCount,
+ (NSUInteger)0,
@"Testing type %d, %@", type, val);
-
+
GTMABMultiValueIdentifier identifier;
- STAssertTrue(ABMultiValueAddValueAndLabel(ref,
- val,
- (CFStringRef)label,
- &identifier),
- @"Testing type %d, %@", type, val);
+ STAssertTrue(ABMultiValueAddValueAndLabel(ref,
+ val,
+ (CFStringRef)label,
+ &identifier),
+ @"Testing type %d, %@", type, val);
NSUInteger secondRetainCount = [val retainCount];
- STAssertEquals(firstRetainCount + 1,
+ STAssertEquals(firstRetainCount + 1,
secondRetainCount,
@"Testing type %d, %@", type, val);
[label release];
[val release];
NSUInteger thirdRetainCount = [val retainCount];
- STAssertEquals(firstRetainCount,
- thirdRetainCount,
+ STAssertEquals(firstRetainCount,
+ thirdRetainCount,
@"Testing type %d, %@", type, val);
-
+
id oldVal = val;
val = (id)ABMultiValueCopyValueAtIndex(ref, 0);
NSUInteger fourthRetainCount = [val retainCount];
-
+
// kABDictionaryPropertyTypes appear to do an actual copy, so the retain
// count checking trick won't work. We only check the retain count if
// we didn't get a new version.
if (val == oldVal) {
- if (type == kGTMABIntegerPropertyType
+ if (type == kGTMABIntegerPropertyType
|| type == kGTMABRealPropertyType) {
// We are verifying that yes indeed 6208390 is still broken
- STAssertEquals(fourthRetainCount,
- thirdRetainCount,
+ STAssertEquals(fourthRetainCount,
+ thirdRetainCount,
@"Testing type %d, %@. If you see this error it may "
- @"be time to update the code to change retain behaviors"
+ @"be time to update the code to change retain behaviors"
@"with this os version", type, val);
} else {
- STAssertEquals(fourthRetainCount,
- thirdRetainCount + 1,
+ STAssertEquals(fourthRetainCount,
+ thirdRetainCount + 1,
@"Testing type %d, %@", type, val);
[val release];
}
@@ -682,12 +682,12 @@ void __attribute__((constructor))SetUpIDForTestRadar6240394(void) {
}
- (void)testRadar6240394 {
- // As of iPhone SDK 2.1, the property IDs aren't initialized until
+ // As of iPhone SDK 2.1, the property IDs aren't initialized until
// ABAddressBookCreate is actually called. They will return zero until
// then. Logged as radar 6240394.
STAssertEquals(gGTMTestID, 0, @"If this isn't zero, Apple has fixed 6240394");
(void)ABAddressBookCreate();
- STAssertEquals(*gGTMTestIDPtr, kGTMABPersonLastNameProperty,
+ STAssertEquals(*gGTMTestIDPtr, kGTMABPersonLastNameProperty,
@"If this doesn't work, something else has broken");
}