aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
authorGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-09-10 21:04:47 +0000
committerGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-09-10 21:04:47 +0000
commitbfaf8705cccb15c0c2a7704b17ba011ddba8242f (patch)
treeb48e104487ee5e29522da1bce6accafa007e29cf /Foundation
parent0f0f40db85a2c295a9b6dc1623cd76106a4448a5 (diff)
- Added GTMExceptionalInlines for dealing with cases where you get
warning: variable 'r' might be clobbered by 'longjmp' or 'vfork' when using certain Apple inlined functions in @synchronized/@try blocks. - Updated to Xcode 3.1 so the GTM and iPhone project have the same baseline. The code should work in other version of xcode, but the projects and xcconfig files now use 3.1 features. - Added GTMABAddressBook which is a cocoa wrapper for the 'C' AddressBook APIs on the iPhone. - Added several set environment variable statements to RunIPhoneUnitTest.sh to encourage bugs to come out of the woodwork.
Diffstat (limited to 'Foundation')
-rw-r--r--Foundation/GTMExceptionalInlines.h52
-rw-r--r--Foundation/GTMExceptionalInlines.m52
-rw-r--r--Foundation/GTMExceptionalInlinesTest.m65
-rw-r--r--Foundation/GTMGeometryUtils.h24
-rw-r--r--Foundation/GTMGeometryUtils.m8
-rw-r--r--Foundation/GTMGeometryUtilsTest.m25
-rw-r--r--Foundation/GTMHTTPFetcher.m24
-rw-r--r--Foundation/GTMLoggerTest.m12
-rw-r--r--Foundation/GTMNSData+zlibTest.m382
-rw-r--r--Foundation/GTMNSString+Replace.h5
-rw-r--r--Foundation/GTMNSString+Replace.m5
-rw-r--r--Foundation/GTMNSString+ReplaceTest.m4
-rw-r--r--Foundation/GTMPathTest.m4
-rw-r--r--Foundation/GTMValidatingContainersTest.m3
14 files changed, 461 insertions, 204 deletions
diff --git a/Foundation/GTMExceptionalInlines.h b/Foundation/GTMExceptionalInlines.h
new file mode 100644
index 0000000..25635c1
--- /dev/null
+++ b/Foundation/GTMExceptionalInlines.h
@@ -0,0 +1,52 @@
+//
+// GTMExceptionalInlines.h
+//
+// Copyright 2008 Google Inc.
+//
+// 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
+// License for the specific language governing permissions and limitations under
+// the License.
+//
+
+#import <Foundation/Foundation.h>
+#import "GTMDefines.h"
+
+// This file exists because when you have full warnings on you can run into
+// troubles with functions that Apple has inlined that have structures or
+// local variables defined in them.
+// You only see this warning if you have -Wuninitialized turned on,
+// and you will only see them in release mode. -Wno-unitialized turns them
+// off, but you also lose all the good warnings that come with -Wuninitialized.
+// If you have the inline versions of any of the functions below in a
+// @syncronized, or @try block, you will get
+// warning: variable 'r' might be clobbered by 'longjmp' or 'vfork'
+// By moving this local vars "out of line" you fix the problem.
+// These functions do nothing more than act as "out of line" calls to the
+// functions they are masking to avoid the warning.
+// If you run into others, feel free to add them.
+
+// Please only use these to avoid the warning above. Use the Apple defined
+// functions where possible.
+
+FOUNDATION_EXPORT NSRange GTMNSMakeRange(NSUInteger loc, NSUInteger len);
+
+FOUNDATION_EXPORT CGPoint GTMCGPointMake(CGFloat x, CGFloat y);
+FOUNDATION_EXPORT CGSize GTMCGSizeMake(CGFloat width, CGFloat height);
+FOUNDATION_EXPORT CGRect GTMCGRectMake(CGFloat x, CGFloat y,
+ CGFloat width, CGFloat height);
+
+#if !GTM_IPHONE_SDK
+// iPhone does not have NSTypes defined, only CGTypes. So no NSRect, NSPoint etc.
+FOUNDATION_EXPORT NSPoint GTMNSMakePoint(CGFloat x, CGFloat y);
+FOUNDATION_EXPORT NSSize GTMNSMakeSize(CGFloat w, CGFloat h);
+FOUNDATION_EXPORT NSRect GTMNSMakeRect(CGFloat x, CGFloat y,
+ CGFloat w, CGFloat h);
+#endif
diff --git a/Foundation/GTMExceptionalInlines.m b/Foundation/GTMExceptionalInlines.m
new file mode 100644
index 0000000..120e235
--- /dev/null
+++ b/Foundation/GTMExceptionalInlines.m
@@ -0,0 +1,52 @@
+//
+// GTMExceptionalInlines.m
+//
+// Copyright 2008 Google Inc.
+//
+// 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
+// License for the specific language governing permissions and limitations under
+// the License.
+//
+
+#import "GTMExceptionalInlines.h"
+
+NSRange GTMNSMakeRange(NSUInteger loc, NSUInteger len) {
+ return NSMakeRange(loc, len);
+}
+
+CGPoint GTMCGPointMake(CGFloat x, CGFloat y) {
+ return CGPointMake(x, y);
+}
+
+CGSize GTMCGSizeMake(CGFloat width, CGFloat height) {
+ return CGSizeMake(width, height);
+}
+
+CGRect GTMCGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height) {
+ return CGRectMake(x, y, width, height);
+}
+
+#if !GTM_IPHONE_SDK
+// iPhone does not have NSTypes defined, only CGTypes. So no NSRect, NSPoint etc.
+
+NSPoint GTMNSMakePoint(CGFloat x, CGFloat y) {
+ return NSMakePoint(x, y);
+}
+
+NSSize GTMNSMakeSize(CGFloat w, CGFloat h) {
+ return NSMakeSize(w, h);
+}
+
+NSRect GTMNSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) {
+ return NSMakeRect(x, y, w, h);
+}
+
+#endif
diff --git a/Foundation/GTMExceptionalInlinesTest.m b/Foundation/GTMExceptionalInlinesTest.m
new file mode 100644
index 0000000..f785301
--- /dev/null
+++ b/Foundation/GTMExceptionalInlinesTest.m
@@ -0,0 +1,65 @@
+//
+// GTMExceptionalInlinesTest.m
+//
+// Copyright 2008 Google Inc.
+//
+// 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
+// License for the specific language governing permissions and limitations under
+// the License.
+//
+
+#import "GTMSenTestCase.h"
+#import "GTMExceptionalInlines.h"
+
+@interface GTMExceptionalInlinesTest : GTMTestCase
+@end
+
+@implementation GTMExceptionalInlinesTest
+- (void)testExceptionalInlines {
+ // Numbers chosen basically at random.
+ NSUInteger loc = 5;
+ NSUInteger len = 10;
+ CGFloat x = 22.5;
+ CGFloat y = 40.2;
+ CGFloat h = 21.6;
+ CGFloat w = 54.2;
+
+ NSRange range1 = GTMNSMakeRange(loc, len);
+ NSRange range2 = NSMakeRange(loc, len);
+ STAssertTrue(NSEqualRanges(range1, range2), nil);
+
+ CGPoint cgpoint1 = GTMCGPointMake(x, y);
+ CGPoint cgpoint2 = CGPointMake(x, y);
+ STAssertTrue(CGPointEqualToPoint(cgpoint1, cgpoint2), nil);
+
+ CGSize cgsize1 = GTMCGSizeMake(x, y);
+ CGSize cgsize2 = CGSizeMake(x, y);
+ STAssertTrue(CGSizeEqualToSize(cgsize1, cgsize2), nil);
+
+ CGRect cgrect1 = GTMCGRectMake(x, y, w, h);
+ CGRect cgrect2 = CGRectMake(x, y, w, h);
+ STAssertTrue(CGRectEqualToRect(cgrect1, cgrect2), nil);
+
+#if !GTM_IPHONE_SDK
+ NSPoint point1 = GTMNSMakePoint(x, y);
+ NSPoint point2 = NSMakePoint(x, y);
+ STAssertTrue(NSEqualPoints(point1, point2), nil);
+
+ NSSize size1 = GTMNSMakeSize(w, h);
+ NSSize size2 = NSMakeSize(w, h);
+ STAssertTrue(NSEqualSizes(size1, size2), nil);
+
+ NSRect rect1 = GTMNSMakeRect(x, y, w, h);
+ NSRect rect2 = NSMakeRect(x, y, w, h);
+ STAssertTrue(NSEqualRects(rect1, rect2), nil);
+#endif
+}
+@end
diff --git a/Foundation/GTMGeometryUtils.h b/Foundation/GTMGeometryUtils.h
index 9691ffc..855b97f 100644
--- a/Foundation/GTMGeometryUtils.h
+++ b/Foundation/GTMGeometryUtils.h
@@ -25,7 +25,8 @@
enum {
GTMScaleProportionally = 0, // Fit proportionally
GTMScaleToFit, // Forced fit (distort if necessary)
- GTMScaleNone // Don't scale (clip)
+ GTMScaleNone, // Don't scale (clip)
+ GTMScaleToFillProportionally = 101 // Scale proportionally to fill area
};
typedef NSUInteger GTMScaling;
@@ -398,6 +399,27 @@ CG_INLINE NSRect GTMNSAlignRectangles(NSRect alignee, NSRect aligner,
alignment));
}
+/// Align a rectangle to another
+//
+// Args:
+// scalee - rect to be scaled
+// scaler - rect to scale to
+// scaling - way to scale the rectangle
+// alignment - way to align the scaled rectangle
+CG_INLINE NSRect GTMNSScaleRectToRect(NSRect scalee,
+ NSRect scaler,
+ GTMScaling scaling,
+ GTMRectAlignment alignment) {
+
+ return GTMCGRectToNSRect(
+ GTMCGAlignRectangles(
+ GTMCGScaleRectangleToSize(GTMNSRectToCGRect(scalee),
+ GTMNSSizeToCGSize(scaler.size),
+ scaling),
+ GTMNSRectToCGRect(scaler),
+ alignment));
+}
+
/// Scale rectangle
//
// Args:
diff --git a/Foundation/GTMGeometryUtils.m b/Foundation/GTMGeometryUtils.m
index 9ac2933..07de80c 100644
--- a/Foundation/GTMGeometryUtils.m
+++ b/Foundation/GTMGeometryUtils.m
@@ -78,6 +78,8 @@ CGRect GTMCGAlignRectangles(CGRect alignee, CGRect aligner, GTMRectAlignment ali
CGRect GTMCGScaleRectangleToSize(CGRect scalee, CGSize size, GTMScaling scaling) {
switch (scaling) {
+
+ case GTMScaleToFillProportionally:
case GTMScaleProportionally: {
CGFloat height = CGRectGetHeight(scalee);
CGFloat width = CGRectGetWidth(scalee);
@@ -85,12 +87,14 @@ CGRect GTMCGScaleRectangleToSize(CGRect scalee, CGSize size, GTMScaling scaling)
(height > size.height || width > size.width)) {
CGFloat horiz = size.width / width;
CGFloat vert = size.height / height;
- CGFloat newScale = horiz < vert ? horiz : vert;
+ BOOL expand = (scaling == GTMScaleToFillProportionally);
+ // We use the smaller scale unless expand is true. In that case, larger.
+ CGFloat newScale = ((horiz < vert) ^ expand) ? horiz : vert;
scalee = GTMCGRectScale(scalee, newScale, newScale);
}
break;
}
-
+
case GTMScaleToFit:
scalee.size = size;
break;
diff --git a/Foundation/GTMGeometryUtilsTest.m b/Foundation/GTMGeometryUtilsTest.m
index 5a59c8b..38b86fb 100644
--- a/Foundation/GTMGeometryUtilsTest.m
+++ b/Foundation/GTMGeometryUtilsTest.m
@@ -164,6 +164,31 @@
STAssertEquals(result, rect, nil);
}
+
+- (void)testGTMNSScaleRectToRect {
+ typedef struct {
+ NSRect expectedRect;
+ GTMScaling scaling;
+ GTMRectAlignment alignment;
+ } TestData;
+
+ NSRect rect1 = NSMakeRect(0, 0, 4, 4);
+ NSRect rect2 = NSMakeRect(0, 0, 2, 1);
+
+ TestData data[] = {
+ { NSMakeRect(2, 3, 2, 1), GTMScaleToFillProportionally, GTMRectAlignTopRight },
+ { NSMakeRect(0, 0, 4, 4), GTMScaleToFit, GTMRectAlignCenter },
+ { NSMakeRect(1, 1.5, 2, 1), GTMScaleNone, GTMRectAlignCenter },
+ { NSMakeRect(1, 0, 2, 1), GTMScaleProportionally, GTMRectAlignBottom },
+ };
+
+ for (size_t i = 0; i < sizeof(data) / sizeof(TestData); i++) {
+ NSRect outRect = GTMNSScaleRectToRect(rect2, rect1, data[i].scaling, data[i].alignment);
+ STAssertEquals(outRect, data[i].expectedRect, nil);
+ }
+}
+
+
- (void)testGTMNSDistanceBetweenPoints {
NSPoint pt1 = NSMakePoint(0, 0);
NSPoint pt2 = NSMakePoint(3, 4);
diff --git a/Foundation/GTMHTTPFetcher.m b/Foundation/GTMHTTPFetcher.m
index a73d752..614f3ad 100644
--- a/Foundation/GTMHTTPFetcher.m
+++ b/Foundation/GTMHTTPFetcher.m
@@ -697,6 +697,7 @@ CannotBeginFetch:
{ nil, 0 }
};
+ BOOL isGood = NO;
// NSError's isEqual always returns false for equal but distinct instances
// of NSError, so we have to compare the domain and code values explicitly
@@ -705,10 +706,11 @@ CannotBeginFetch:
if ([[error domain] isEqual:retries[idx].domain]
&& [error code] == retries[idx].code) {
- return YES;
+ isGood = YES;
+ break;
}
}
- return NO;
+ return isGood;
}
@@ -927,11 +929,9 @@ CannotBeginFetch:
cookieStorageMethod_ = method;
- if (method == kGTMHTTPFetcherCookieStorageMethodSystemDefault) {
- [request_ setHTTPShouldHandleCookies:YES];
- } else {
- [request_ setHTTPShouldHandleCookies:NO];
- }
+ BOOL handleCookies
+ = method == kGTMHTTPFetcherCookieStorageMethodSystemDefault ? YES : NO;
+ [request_ setHTTPShouldHandleCookies:handleCookies];
}
- (id)delegate {
@@ -973,12 +973,10 @@ CannotBeginFetch:
- (void)setFetchHistory:(NSMutableDictionary *)fetchHistory {
[fetchHistory_ autorelease];
fetchHistory_ = [fetchHistory retain];
-
- if (fetchHistory_ != nil) {
- [self setCookieStorageMethod:kGTMHTTPFetcherCookieStorageMethodFetchHistory];
- } else {
- [self setCookieStorageMethod:kGTMHTTPFetcherCookieStorageMethodStatic];
- }
+ GTMHTTPFetcherCookieStorageMethod method
+ = fetchHistory_ ? kGTMHTTPFetcherCookieStorageMethodFetchHistory
+ : kGTMHTTPFetcherCookieStorageMethodStatic;
+ [self setCookieStorageMethod:method];
}
- (void)setShouldCacheDatedData:(BOOL)flag {
diff --git a/Foundation/GTMLoggerTest.m b/Foundation/GTMLoggerTest.m
index 9093c7a..043c73d 100644
--- a/Foundation/GTMLoggerTest.m
+++ b/Foundation/GTMLoggerTest.m
@@ -94,12 +94,20 @@
@"GTMLoggerUnitTest.log"] retain];
STAssertNotNil(path_, nil);
// Make sure we're cleaned up from the last run
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
[[NSFileManager defaultManager] removeFileAtPath:path_ handler:nil];
+#else
+ [[NSFileManager defaultManager] removeItemAtPath:path_ error:NULL];
+#endif
}
- (void)tearDown {
STAssertNotNil(path_, nil);
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
[[NSFileManager defaultManager] removeFileAtPath:path_ handler:nil];
+#else
+ [[NSFileManager defaultManager] removeItemAtPath:path_ error:NULL];
+#endif
[path_ release];
path_ = nil;
}
@@ -372,8 +380,8 @@
STAssertNotNil(fmtr, nil);
// E.g. 2008-01-04 09:16:26.906 otest[5567/0xa07d0f60] [lvl=1] (no func) test
- static NSString *const kFormatBasePattern =
- @"[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3} otest\\[[0-9]+/0x[0-9a-f]+\\] \\[lvl=[0-3]\\] \\(no func\\) ";
+ NSString * kFormatBasePattern =
+ @"[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3} ((otest)|(GTMiPhoneTest))\\[[0-9]+/0x[0-9a-f]+\\] \\[lvl=[0-3]\\] \\(no func\\) ";
NSString *msg = nil;
msg = [self stringFromFormatter:fmtr
diff --git a/Foundation/GTMNSData+zlibTest.m b/Foundation/GTMNSData+zlibTest.m
index 1b6264c..0d86886 100644
--- a/Foundation/GTMNSData+zlibTest.m
+++ b/Foundation/GTMNSData+zlibTest.m
@@ -25,13 +25,64 @@
@interface GTMNSData_zlibTest : GTMTestCase
@end
-
-static void FillWithRandom(char *data, unsigned long len) {
- char *max = data + len;
- for ( ; data < max ; ++data) {
- *data = random() & 0xFF;
- }
-}
+// NOTE: we don't need to test the actually compressor/inflation (we're using
+// zlib, it works), we just need to test our wrapper. So we can use canned
+// data, etc. (and yes, when using random data, things once failed because
+// we generated a random block of data that was valid compressed data?!)
+
+static unsigned char randomDataLarge[] = {
+ // openssl rand -rand /dev/random 512 | xxd -i
+ 0xe1, 0xa6, 0xe2, 0xa2, 0x0b, 0xf7, 0x8d, 0x6b, 0x31, 0xfe, 0xaa, 0x64,
+ 0x50, 0xbe, 0x52, 0x7e, 0x83, 0x74, 0x00, 0x8f, 0x62, 0x96, 0xc7, 0xe9,
+ 0x20, 0x59, 0x78, 0xc6, 0xea, 0x10, 0xd5, 0xdb, 0x3f, 0x6b, 0x13, 0xd9,
+ 0x44, 0x18, 0x24, 0x17, 0x63, 0xc8, 0x74, 0xa5, 0x37, 0x6c, 0x9c, 0x00,
+ 0xe5, 0xcf, 0x0a, 0xdf, 0xb9, 0x66, 0xb1, 0xbd, 0x04, 0x8f, 0x55, 0x9e,
+ 0xb0, 0x24, 0x4e, 0xf0, 0xc4, 0x69, 0x2c, 0x1f, 0x63, 0x9f, 0x41, 0xa8,
+ 0x89, 0x9b, 0x98, 0x00, 0xb6, 0x78, 0xf7, 0xe4, 0x4c, 0x72, 0x14, 0x84,
+ 0xaa, 0x3d, 0xc1, 0x42, 0x9f, 0x12, 0x85, 0xdd, 0x16, 0x8b, 0x8f, 0x67,
+ 0xe0, 0x26, 0x5b, 0x5e, 0xaa, 0xe7, 0xd3, 0x67, 0xfe, 0x21, 0x77, 0xa6,
+ 0x52, 0xde, 0x33, 0x8b, 0x96, 0x49, 0x6a, 0xd6, 0x58, 0x58, 0x36, 0x00,
+ 0x23, 0xd2, 0x45, 0x13, 0x9f, 0xd9, 0xc7, 0x2d, 0x55, 0x12, 0xb4, 0xfe,
+ 0x53, 0x27, 0x1f, 0x14, 0x71, 0x9b, 0x7e, 0xcc, 0x5e, 0x8c, 0x59, 0xef,
+ 0x80, 0xac, 0x89, 0xf4, 0x45, 0x8d, 0x98, 0x6d, 0x97, 0xfd, 0x53, 0x5f,
+ 0x19, 0xd6, 0x11, 0xf7, 0xcb, 0x5d, 0xca, 0xab, 0xe1, 0x01, 0xf1, 0xe9,
+ 0x1f, 0x1f, 0xf3, 0x53, 0x76, 0xa2, 0x59, 0x8e, 0xb3, 0x91, 0xff, 0xe8,
+ 0x1b, 0xc0, 0xc0, 0xda, 0xdd, 0x93, 0xb5, 0x9d, 0x62, 0x13, 0xb8, 0x07,
+ 0xf2, 0xf5, 0xb9, 0x4b, 0xe1, 0x09, 0xed, 0xdb, 0xe6, 0xd9, 0x2d, 0xc4,
+ 0x0d, 0xb6, 0xbd, 0xfc, 0xdb, 0x5c, 0xcc, 0xf6, 0x53, 0x4e, 0x01, 0xa4,
+ 0x03, 0x95, 0x4a, 0xa4, 0xaa, 0x4f, 0x45, 0xaf, 0xbf, 0xf1, 0x7e, 0x60,
+ 0x1d, 0x86, 0x93, 0x65, 0x7b, 0x24, 0x0c, 0x09, 0xe0, 0xd1, 0xd8, 0x60,
+ 0xd9, 0xd9, 0x55, 0x2a, 0xec, 0xd5, 0xdc, 0xd0, 0xc6, 0x5e, 0x2c, 0x22,
+ 0xf5, 0x19, 0x0b, 0xc3, 0xa1, 0x38, 0x11, 0x67, 0x6f, 0x6c, 0x0e, 0x34,
+ 0x44, 0x83, 0xee, 0xd3, 0xf2, 0x4b, 0x7b, 0x03, 0x68, 0xfe, 0xc5, 0x76,
+ 0xb2, 0x2e, 0x26, 0xeb, 0x1f, 0x66, 0x02, 0xa4, 0xd9, 0xda, 0x28, 0x3a,
+ 0xc3, 0x94, 0x03, 0xe8, 0x29, 0x7e, 0xfe, 0x3d, 0xc8, 0xc1, 0x0a, 0x74,
+ 0xc7, 0xaf, 0xa6, 0x84, 0x86, 0x85, 0xc3, 0x8c, 0x00, 0x38, 0xd4, 0xb5,
+ 0xb2, 0xe0, 0xf0, 0xc4, 0x8d, 0x10, 0x0d, 0xf1, 0xcd, 0x05, 0xdb, 0xd0,
+ 0xcf, 0x17, 0x4f, 0xa8, 0xe5, 0xf0, 0x53, 0x55, 0x62, 0xc7, 0x55, 0xe5,
+ 0xbe, 0x18, 0x2f, 0xda, 0x48, 0xf1, 0xaa, 0x85, 0x46, 0x80, 0x15, 0x70,
+ 0x82, 0xd2, 0xa6, 0xb0, 0x3d, 0x31, 0xb5, 0xcc, 0x23, 0x95, 0x5e, 0x15,
+ 0x35, 0x32, 0xd0, 0x86, 0xd1, 0x6e, 0x2d, 0xc0, 0xfe, 0x45, 0xae, 0x28,
+ 0x24, 0xa7, 0x14, 0xf4, 0xe9, 0xb5, 0x6f, 0xac, 0x25, 0xf9, 0x88, 0xf6,
+ 0x60, 0x5d, 0x6b, 0x5c, 0xf2, 0x38, 0xe8, 0xdc, 0xbd, 0xa6, 0x13, 0xc0,
+ 0xa4, 0xc8, 0xe9, 0x7a, 0xc6, 0xb6, 0x88, 0x26, 0x98, 0x9f, 0xe3, 0x9a,
+ 0xd9, 0x5b, 0xd4, 0xd0, 0x02, 0x1f, 0x55, 0x30, 0xbe, 0xde, 0x9c, 0xd1,
+ 0x53, 0x93, 0x72, 0xe6, 0x19, 0x79, 0xe9, 0xf1, 0x70, 0x78, 0x92, 0x31,
+ 0xf6, 0x17, 0xc0, 0xdd, 0x99, 0xc8, 0x97, 0x67, 0xdc, 0xf6, 0x67, 0x6b,
+ 0x9b, 0x1c, 0x90, 0xea, 0x1a, 0x9e, 0x26, 0x68, 0xc2, 0x13, 0x94, 0x3a,
+ 0x3e, 0x73, 0x61, 0x4e, 0x37, 0xa8, 0xa1, 0xfa, 0xf8, 0x22, 0xdd, 0x20,
+ 0x40, 0xc6, 0x52, 0x27, 0x47, 0x1a, 0x79, 0xfa, 0x40, 0xa6, 0x62, 0x6b,
+ 0xe6, 0xc7, 0x67, 0xb7, 0xa8, 0x2d, 0xd1, 0x9f, 0x17, 0xb8, 0x77, 0x5e,
+ 0x97, 0x1e, 0x92, 0xd7, 0xd2, 0x25, 0x04, 0x92, 0xf9, 0x41, 0x70, 0x93,
+ 0xe1, 0x13, 0x07, 0x94, 0x8e, 0x0b, 0x82, 0x98
+};
+
+static unsigned char randomDataSmall[] = {
+ // openssl rand -rand /dev/random 24 | xxd -i
+ 0xd1, 0xec, 0x35, 0xc3, 0xa0, 0x4c, 0x73, 0x37, 0x2f, 0x5a, 0x12, 0x44,
+ 0xee, 0xe4, 0x22, 0x07, 0x29, 0xa8, 0x4a, 0xde, 0xc8, 0xbb, 0xe7, 0xdb
+};
+
static BOOL HasGzipHeader(NSData *data) {
// very simple check
@@ -43,20 +94,11 @@ static BOOL HasGzipHeader(NSData *data) {
@implementation GTMNSData_zlibTest
-- (void)setUp {
- // seed random from /dev/random
- srandomdev();
-}
-
- (void)testBoundryValues {
- NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
- STAssertNotNil(localPool, @"failed to alloc local pool");
-
// build some test data
- NSMutableData *data = [NSMutableData data];
+ NSData *data = [NSData dataWithBytes:randomDataLarge
+ length:sizeof(randomDataLarge)];
STAssertNotNil(data, @"failed to alloc data block");
- [data setLength:512];
- FillWithRandom([data mutableBytes], [data length]);
// bogus args to start
STAssertNil([NSData gtm_dataByDeflatingData:nil], nil);
@@ -107,29 +149,28 @@ static BOOL HasGzipHeader(NSData *data) {
STAssertNil([NSData gtm_dataByInflatingData:data], nil);
// test deflated data runs that end before they are done
- [GTMUnitTestDevLog expect:[deflated length] - 1
+ [GTMUnitTestDevLog expect:([deflated length] / 11) + 1
casesOfString:@"Error trying to inflate some of the payload, "
"error -5"];
- for (NSUInteger x = 1 ; x < [deflated length] ; ++x) {
+ for (NSUInteger x = 1 ; x < [deflated length] ; x += 11) {
STAssertNil([NSData gtm_dataByInflatingBytes:[deflated bytes]
length:x], nil);
}
// test gzipped data runs that end before they are done
- [GTMUnitTestDevLog expect:[gzipped length] - 1
+ [GTMUnitTestDevLog expect:([gzipped length] / 11) + 1
casesOfString:@"Error trying to inflate some of the payload, "
"error -5"];
- for (NSUInteger x = 1 ; x < [gzipped length] ; ++x) {
+ for (NSUInteger x = 1 ; x < [gzipped length] ; x += 11) {
STAssertNil([NSData gtm_dataByInflatingBytes:[gzipped bytes]
length:x], nil);
}
// test extra data before the deflated/gzipped data (just to make sure we
// don't seek to the "real" data)
- NSMutableData *prefixedDeflated = [NSMutableData data];
+ NSMutableData *prefixedDeflated =
+ [NSMutableData dataWithBytes:randomDataSmall length:sizeof(randomDataSmall)];
STAssertNotNil(prefixedDeflated, @"failed to alloc data block");
- [prefixedDeflated setLength:20];
- FillWithRandom([prefixedDeflated mutableBytes], [prefixedDeflated length]);
[prefixedDeflated appendData:deflated];
[GTMUnitTestDevLog expectString:@"Error trying to inflate some of the "
"payload, error -3"];
@@ -139,10 +180,9 @@ static BOOL HasGzipHeader(NSData *data) {
STAssertNil([NSData gtm_dataByInflatingBytes:[prefixedDeflated bytes]
length:[prefixedDeflated length]],
nil);
- NSMutableData *prefixedGzipped = [NSMutableData data];
+ NSMutableData *prefixedGzipped =
+ [NSMutableData dataWithBytes:randomDataSmall length:sizeof(randomDataSmall)];
STAssertNotNil(prefixedDeflated, @"failed to alloc data block");
- [prefixedGzipped setLength:20];
- FillWithRandom([prefixedGzipped mutableBytes], [prefixedGzipped length]);
[prefixedGzipped appendData:gzipped];
[GTMUnitTestDevLog expectString:@"Error trying to inflate some of the "
"payload, error -3"];
@@ -179,171 +219,141 @@ static BOOL HasGzipHeader(NSData *data) {
STAssertNil([NSData gtm_dataByInflatingBytes:[suffixedGZipped bytes]
length:[suffixedGZipped length]],
nil);
-
- [localPool release];
}
- (void)testInflateDeflate {
- // generate a range of sizes w/ random content
- for (int n = 0 ; n < 2 ; ++n) {
- for (int x = 1 ; x < 128 ; ++x) {
- NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
- STAssertNotNil(localPool, @"failed to alloc local pool");
-
- NSMutableData *data = [NSMutableData data];
- STAssertNotNil(data, @"failed to alloc data block");
-
- // first pass small blocks, second pass, larger ones, but second pass
- // avoid making them multimples of 128.
- [data setLength:((n*x*128) + x)];
- FillWithRandom([data mutableBytes], [data length]);
-
- // w/ *Bytes apis, default level
- NSData *deflated = [NSData gtm_dataByDeflatingBytes:[data bytes]
- length:[data length]];
- STAssertNotNil(deflated, @"failed to deflate data block");
- STAssertGreaterThan([deflated length],
- (NSUInteger)0, @"failed to deflate data block");
- STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
- NSData *dataPrime = [NSData gtm_dataByInflatingBytes:[deflated bytes]
- length:[deflated length]];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data,
- dataPrime, @"failed to round trip via *Bytes apis");
-
- // w/ *Data apis, default level
- deflated = [NSData gtm_dataByDeflatingData:data];
- STAssertNotNil(deflated, @"failed to deflate data block");
- STAssertGreaterThan([deflated length],
- (NSUInteger)0, @"failed to deflate data block");
- STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
- dataPrime = [NSData gtm_dataByInflatingData:deflated];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data,
- dataPrime, @"failed to round trip via *Data apis");
-
- // loop over the compression levels
- for (int level = 1 ; level < 9 ; ++level) {
- // w/ *Bytes apis, using our level
- deflated = [NSData gtm_dataByDeflatingBytes:[data bytes]
- length:[data length]
- compressionLevel:level];
- STAssertNotNil(deflated, @"failed to deflate data block");
- STAssertGreaterThan([deflated length],
- (NSUInteger)0, @"failed to deflate data block");
- STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
- dataPrime = [NSData gtm_dataByInflatingBytes:[deflated bytes]
- length:[deflated length]];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data,
- dataPrime, @"failed to round trip via *Bytes apis");
-
- // w/ *Data apis, using our level
- deflated = [NSData gtm_dataByDeflatingData:data compressionLevel:level];
- STAssertNotNil(deflated, @"failed to deflate data block");
- STAssertGreaterThan([deflated length],
- (NSUInteger)0, @"failed to deflate data block");
- STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
- dataPrime = [NSData gtm_dataByInflatingData:deflated];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data,
- dataPrime, @"failed to round trip via *Data apis");
- }
-
- [localPool release];
- }
+ NSData *data = [NSData dataWithBytes:randomDataLarge
+ length:sizeof(randomDataLarge)];
+ STAssertNotNil(data, @"failed to alloc data block");
+
+ // w/ *Bytes apis, default level
+ NSData *deflated = [NSData gtm_dataByDeflatingBytes:[data bytes]
+ length:[data length]];
+ STAssertNotNil(deflated, @"failed to deflate data block");
+ STAssertGreaterThan([deflated length],
+ (NSUInteger)0, @"failed to deflate data block");
+ STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
+ NSData *dataPrime = [NSData gtm_dataByInflatingBytes:[deflated bytes]
+ length:[deflated length]];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data,
+ dataPrime, @"failed to round trip via *Bytes apis");
+
+ // w/ *Data apis, default level
+ deflated = [NSData gtm_dataByDeflatingData:data];
+ STAssertNotNil(deflated, @"failed to deflate data block");
+ STAssertGreaterThan([deflated length],
+ (NSUInteger)0, @"failed to deflate data block");
+ STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
+ dataPrime = [NSData gtm_dataByInflatingData:deflated];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data,
+ dataPrime, @"failed to round trip via *Data apis");
+
+ // loop over the compression levels
+ for (int level = 1 ; level < 9 ; ++level) {
+ // w/ *Bytes apis, using our level
+ deflated = [NSData gtm_dataByDeflatingBytes:[data bytes]
+ length:[data length]
+ compressionLevel:level];
+ STAssertNotNil(deflated, @"failed to deflate data block");
+ STAssertGreaterThan([deflated length],
+ (NSUInteger)0, @"failed to deflate data block");
+ STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
+ dataPrime = [NSData gtm_dataByInflatingBytes:[deflated bytes]
+ length:[deflated length]];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data,
+ dataPrime, @"failed to round trip via *Bytes apis");
+
+ // w/ *Data apis, using our level
+ deflated = [NSData gtm_dataByDeflatingData:data compressionLevel:level];
+ STAssertNotNil(deflated, @"failed to deflate data block");
+ STAssertGreaterThan([deflated length],
+ (NSUInteger)0, @"failed to deflate data block");
+ STAssertFalse(HasGzipHeader(deflated), @"has gzip header on zlib data");
+ dataPrime = [NSData gtm_dataByInflatingData:deflated];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data,
+ dataPrime, @"failed to round trip via *Data apis");
}
}
- (void)testInflateGzip {
- // generate a range of sizes w/ random content
- for (int n = 0 ; n < 2 ; ++n) {
- for (int x = 1 ; x < 128 ; ++x) {
- NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
- STAssertNotNil(localPool, @"failed to alloc local pool");
-
- NSMutableData *data = [NSMutableData data];
- STAssertNotNil(data, @"failed to alloc data block");
-
- // first pass small blocks, second pass, larger ones, but second pass
- // avoid making them multimples of 128.
- [data setLength:((n*x*128) + x)];
- FillWithRandom([data mutableBytes], [data length]);
-
- // w/ *Bytes apis, default level
- NSData *gzipped = [NSData gtm_dataByGzippingBytes:[data bytes]
- length:[data length]];
- STAssertNotNil(gzipped, @"failed to gzip data block");
- STAssertGreaterThan([gzipped length],
- (NSUInteger)0, @"failed to gzip data block");
- STAssertTrue(HasGzipHeader(gzipped),
- @"doesn't have gzip header on gzipped data");
- NSData *dataPrime = [NSData gtm_dataByInflatingBytes:[gzipped bytes]
- length:[gzipped length]];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data,
- dataPrime, @"failed to round trip via *Bytes apis");
-
- // w/ *Data apis, default level
- gzipped = [NSData gtm_dataByGzippingData:data];
- STAssertNotNil(gzipped, @"failed to gzip data block");
- STAssertGreaterThan([gzipped length],
- (NSUInteger)0, @"failed to gzip data block");
- STAssertTrue(HasGzipHeader(gzipped),
- @"doesn't have gzip header on gzipped data");
- dataPrime = [NSData gtm_dataByInflatingData:gzipped];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data, dataPrime,
- @"failed to round trip via *Data apis");
-
- // loop over the compression levels
- for (int level = 1 ; level < 9 ; ++level) {
- // w/ *Bytes apis, using our level
- gzipped = [NSData gtm_dataByGzippingBytes:[data bytes]
- length:[data length]
- compressionLevel:level];
- STAssertNotNil(gzipped, @"failed to gzip data block");
- STAssertGreaterThan([gzipped length],
- (NSUInteger)0, @"failed to gzip data block");
- STAssertTrue(HasGzipHeader(gzipped),
- @"doesn't have gzip header on gzipped data");
- dataPrime = [NSData gtm_dataByInflatingBytes:[gzipped bytes]
- length:[gzipped length]];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data, dataPrime,
- @"failed to round trip via *Bytes apis");
-
- // w/ *Data apis, using our level
- gzipped = [NSData gtm_dataByGzippingData:data compressionLevel:level];
- STAssertNotNil(gzipped, @"failed to gzip data block");
- STAssertGreaterThan([gzipped length],
- (NSUInteger)0, @"failed to gzip data block");
- STAssertTrue(HasGzipHeader(gzipped),
- @"doesn't have gzip header on gzipped data");
- dataPrime = [NSData gtm_dataByInflatingData:gzipped];
- STAssertNotNil(dataPrime, @"failed to inflate data block");
- STAssertGreaterThan([dataPrime length],
- (NSUInteger)0, @"failed to inflate data block");
- STAssertEqualObjects(data,
- dataPrime, @"failed to round trip via *Data apis");
- }
-
- [localPool release];
- }
+ NSData *data = [NSData dataWithBytes:randomDataLarge
+ length:sizeof(randomDataLarge)];
+ STAssertNotNil(data, @"failed to alloc data block");
+
+ // w/ *Bytes apis, default level
+ NSData *gzipped = [NSData gtm_dataByGzippingBytes:[data bytes]
+ length:[data length]];
+ STAssertNotNil(gzipped, @"failed to gzip data block");
+ STAssertGreaterThan([gzipped length],
+ (NSUInteger)0, @"failed to gzip data block");
+ STAssertTrue(HasGzipHeader(gzipped),
+ @"doesn't have gzip header on gzipped data");
+ NSData *dataPrime = [NSData gtm_dataByInflatingBytes:[gzipped bytes]
+ length:[gzipped length]];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data,
+ dataPrime, @"failed to round trip via *Bytes apis");
+
+ // w/ *Data apis, default level
+ gzipped = [NSData gtm_dataByGzippingData:data];
+ STAssertNotNil(gzipped, @"failed to gzip data block");
+ STAssertGreaterThan([gzipped length],
+ (NSUInteger)0, @"failed to gzip data block");
+ STAssertTrue(HasGzipHeader(gzipped),
+ @"doesn't have gzip header on gzipped data");
+ dataPrime = [NSData gtm_dataByInflatingData:gzipped];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data, dataPrime,
+ @"failed to round trip via *Data apis");
+
+ // loop over the compression levels
+ for (int level = 1 ; level < 9 ; ++level) {
+ // w/ *Bytes apis, using our level
+ gzipped = [NSData gtm_dataByGzippingBytes:[data bytes]
+ length:[data length]
+ compressionLevel:level];
+ STAssertNotNil(gzipped, @"failed to gzip data block");
+ STAssertGreaterThan([gzipped length],
+ (NSUInteger)0, @"failed to gzip data block");
+ STAssertTrue(HasGzipHeader(gzipped),
+ @"doesn't have gzip header on gzipped data");
+ dataPrime = [NSData gtm_dataByInflatingBytes:[gzipped bytes]
+ length:[gzipped length]];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data, dataPrime,
+ @"failed to round trip via *Bytes apis");
+
+ // w/ *Data apis, using our level
+ gzipped = [NSData gtm_dataByGzippingData:data compressionLevel:level];
+ STAssertNotNil(gzipped, @"failed to gzip data block");
+ STAssertGreaterThan([gzipped length],
+ (NSUInteger)0, @"failed to gzip data block");
+ STAssertTrue(HasGzipHeader(gzipped),
+ @"doesn't have gzip header on gzipped data");
+ dataPrime = [NSData gtm_dataByInflatingData:gzipped];
+ STAssertNotNil(dataPrime, @"failed to inflate data block");
+ STAssertGreaterThan([dataPrime length],
+ (NSUInteger)0, @"failed to inflate data block");
+ STAssertEqualObjects(data,
+ dataPrime, @"failed to round trip via *Data apis");
}
}
diff --git a/Foundation/GTMNSString+Replace.h b/Foundation/GTMNSString+Replace.h
index 3a88c80..edc8478 100644
--- a/Foundation/GTMNSString+Replace.h
+++ b/Foundation/GTMNSString+Replace.h
@@ -21,6 +21,9 @@
/// Give easy search-n-replace functionality to NSString.
@interface NSString (GTMStringReplaceAdditions)
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+// 10.5 has stringByReplacingOccurrencesOfString:withString:, use that directly.
+
/// Returns a new autoreleased string by replacing all occurrences of
// |oldString| with |newString| (case sensitive). If |oldString| is nil or
// @"" nothing is done and |self| is returned. If |newString| is nil, it's
@@ -37,4 +40,6 @@
- (NSString *)gtm_stringByReplacingString:(NSString *)target
withString:(NSString *)replacement;
+#endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+
@end
diff --git a/Foundation/GTMNSString+Replace.m b/Foundation/GTMNSString+Replace.m
index 4e8195c..f617945 100644
--- a/Foundation/GTMNSString+Replace.m
+++ b/Foundation/GTMNSString+Replace.m
@@ -21,6 +21,9 @@
@implementation NSString (GTMStringReplaceAdditions)
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+// 10.5 has stringByReplacingOccurrencesOfString:withString:, use that directly.
+
- (NSString *)gtm_stringByReplacingString:(NSString *)target
withString:(NSString *)replacement {
// If |target| was nil, then do nothing and return |self|
@@ -45,4 +48,6 @@
return result;
}
+#endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+
@end
diff --git a/Foundation/GTMNSString+ReplaceTest.m b/Foundation/GTMNSString+ReplaceTest.m
index e814040..805136c 100644
--- a/Foundation/GTMNSString+ReplaceTest.m
+++ b/Foundation/GTMNSString+ReplaceTest.m
@@ -24,6 +24,8 @@
@implementation GTMNSString_ReplaceTest
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+
- (void)testStringByReplacingStringWithString {
NSString *testString = @"a bc debc gh";
NSString *result;
@@ -52,4 +54,6 @@
@"replacing '' with anything should yield the original string");
}
+#endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+
@end
diff --git a/Foundation/GTMPathTest.m b/Foundation/GTMPathTest.m
index 3130c4f..0570bb3 100644
--- a/Foundation/GTMPathTest.m
+++ b/Foundation/GTMPathTest.m
@@ -46,7 +46,11 @@
// Make sure it's safe to remove this directory before nuking it.
STAssertNotNil(testDirectory_, nil);
STAssertNotEqualObjects(testDirectory_, @"/", nil);
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
[[NSFileManager defaultManager] removeFileAtPath:testDirectory_ handler:nil];
+#else
+ [[NSFileManager defaultManager] removeItemAtPath:testDirectory_ error:NULL];
+#endif
}
- (void)testBasicCreation {
diff --git a/Foundation/GTMValidatingContainersTest.m b/Foundation/GTMValidatingContainersTest.m
index ed17327..f9cc377 100644
--- a/Foundation/GTMValidatingContainersTest.m
+++ b/Foundation/GTMValidatingContainersTest.m
@@ -292,6 +292,9 @@
[dictionary removeObjectForKey:@"Key2"];
[dictionary removeObjectForKey:@"Key1"];
STAssertEquals([dictionary count], (NSUInteger)0, @"should have no objects left");
+
+ // So we get full code coverage
+ [testSubClass_ foo];
#if !(GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT)
// If we're not validating, we don't expect any logs
[GTMUnitTestDevLog resetExpectedLogs];