From 474a667f66d01552a3e1e71139d7f6d5b7a7ceed Mon Sep 17 00:00:00 2001 From: Thomas Hauk Date: Fri, 10 May 2013 00:01:23 -0700 Subject: [PATCH] Add unit test bundle target --- .../project.pbxproj | 184 ++++++++++++++++++ .../Godzippa Test/Godzippa Test-Info.plist | 22 +++ .../Godzippa Test/Godzippa Test-Prefix.pch | 7 + Example/Godzippa Test/Godzippa_Test.h | 5 + Example/Godzippa Test/Godzippa_Test.m | 32 +++ .../Godzippa Test/en.lproj/InfoPlist.strings | 2 + Example/Godzippa Test/test-data/test.txt | 1 + 7 files changed, 253 insertions(+) create mode 100644 Example/Godzippa Test/Godzippa Test-Info.plist create mode 100644 Example/Godzippa Test/Godzippa Test-Prefix.pch create mode 100644 Example/Godzippa Test/Godzippa_Test.h create mode 100644 Example/Godzippa Test/Godzippa_Test.m create mode 100644 Example/Godzippa Test/en.lproj/InfoPlist.strings create mode 100755 Example/Godzippa Test/test-data/test.txt diff --git a/Example/Godzippa Example.xcodeproj/project.pbxproj b/Example/Godzippa Example.xcodeproj/project.pbxproj index 983c7af..1a981e3 100644 --- a/Example/Godzippa Example.xcodeproj/project.pbxproj +++ b/Example/Godzippa Example.xcodeproj/project.pbxproj @@ -7,6 +7,13 @@ objects = { /* Begin PBXBuildFile section */ + E2651A84173CC6370091504C /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2651A83173CC6370091504C /* SenTestingKit.framework */; }; + E2651A86173CC6370091504C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2651A85173CC6370091504C /* Cocoa.framework */; }; + E2651A90173CC6370091504C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E2651A8E173CC6370091504C /* InfoPlist.strings */; }; + E2651A93173CC6370091504C /* Godzippa_Test.m in Sources */ = {isa = PBXBuildFile; fileRef = E2651A92173CC6370091504C /* Godzippa_Test.m */; }; + E2651A9D173CC68B0091504C /* test.txt in Resources */ = {isa = PBXBuildFile; fileRef = E2651A9B173CC68B0091504C /* test.txt */; }; + E2651A9F173CC6FC0091504C /* NSData+Godzippa.m in Sources */ = {isa = PBXBuildFile; fileRef = F86035A516AD0EE10027FDE8 /* NSData+Godzippa.m */; }; + E2651AA0173CC7140091504C /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F86035A716AD0F240027FDE8 /* libz.dylib */; }; F860358D16AD0E4D0027FDE8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F860358C16AD0E4D0027FDE8 /* Foundation.framework */; }; F86035A116AD0EB40027FDE8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F86035A016AD0EB40027FDE8 /* main.m */; }; F86035A616AD0EE10027FDE8 /* NSData+Godzippa.m in Sources */ = {isa = PBXBuildFile; fileRef = F86035A516AD0EE10027FDE8 /* NSData+Godzippa.m */; }; @@ -26,6 +33,19 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + E2651A82173CC6370091504C /* Godzippa Test.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Godzippa Test.octest"; sourceTree = BUILT_PRODUCTS_DIR; }; + E2651A83173CC6370091504C /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; + E2651A85173CC6370091504C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; + E2651A88173CC6370091504C /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + E2651A89173CC6370091504C /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + E2651A8A173CC6370091504C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + E2651A8D173CC6370091504C /* Godzippa Test-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Godzippa Test-Info.plist"; sourceTree = ""; }; + E2651A8F173CC6370091504C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + E2651A91173CC6370091504C /* Godzippa_Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Godzippa_Test.h; sourceTree = ""; }; + E2651A92173CC6370091504C /* Godzippa_Test.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Godzippa_Test.m; sourceTree = ""; }; + E2651A94173CC6370091504C /* Godzippa Test-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Godzippa Test-Prefix.pch"; sourceTree = ""; }; + E2651A9B173CC68B0091504C /* test.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test.txt; sourceTree = ""; }; + E2651A9C173CC68B0091504C /* test.txt.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = test.txt.gz; sourceTree = ""; }; F860358816AD0E4D0027FDE8 /* Godzippa Example */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Godzippa Example"; sourceTree = BUILT_PRODUCTS_DIR; }; F860358C16AD0E4D0027FDE8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; F860359F16AD0E740027FDE8 /* Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = SOURCE_ROOT; }; @@ -36,6 +56,16 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + E2651A7E173CC6370091504C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E2651AA0173CC7140091504C /* libz.dylib in Frameworks */, + E2651A84173CC6370091504C /* SenTestingKit.framework in Frameworks */, + E2651A86173CC6370091504C /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F860358516AD0E4D0027FDE8 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -48,10 +78,51 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + E2651A87173CC6370091504C /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + E2651A88173CC6370091504C /* AppKit.framework */, + E2651A89173CC6370091504C /* CoreData.framework */, + E2651A8A173CC6370091504C /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + E2651A8B173CC6370091504C /* Godzippa Test */ = { + isa = PBXGroup; + children = ( + E2651A91173CC6370091504C /* Godzippa_Test.h */, + E2651A92173CC6370091504C /* Godzippa_Test.m */, + E2651A8C173CC6370091504C /* Supporting Files */, + E2651A9A173CC68B0091504C /* test-data */, + ); + path = "Godzippa Test"; + sourceTree = ""; + }; + E2651A8C173CC6370091504C /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E2651A8D173CC6370091504C /* Godzippa Test-Info.plist */, + E2651A8E173CC6370091504C /* InfoPlist.strings */, + E2651A94173CC6370091504C /* Godzippa Test-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + E2651A9A173CC68B0091504C /* test-data */ = { + isa = PBXGroup; + children = ( + E2651A9B173CC68B0091504C /* test.txt */, + E2651A9C173CC68B0091504C /* test.txt.gz */, + ); + path = "test-data"; + sourceTree = ""; + }; F860357D16AD0E4C0027FDE8 = { isa = PBXGroup; children = ( F860358E16AD0E4D0027FDE8 /* Source */, + E2651A8B173CC6370091504C /* Godzippa Test */, F860358B16AD0E4D0027FDE8 /* Frameworks */, F860358916AD0E4D0027FDE8 /* Products */, F86035A216AD0ED10027FDE8 /* Vendor */, @@ -62,6 +133,7 @@ isa = PBXGroup; children = ( F860358816AD0E4D0027FDE8 /* Godzippa Example */, + E2651A82173CC6370091504C /* Godzippa Test.octest */, ); name = Products; sourceTree = ""; @@ -71,6 +143,9 @@ children = ( F86035A716AD0F240027FDE8 /* libz.dylib */, F860358C16AD0E4D0027FDE8 /* Foundation.framework */, + E2651A83173CC6370091504C /* SenTestingKit.framework */, + E2651A85173CC6370091504C /* Cocoa.framework */, + E2651A87173CC6370091504C /* Other Frameworks */, ); name = Frameworks; sourceTree = ""; @@ -114,6 +189,24 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + E2651A81173CC6370091504C /* Godzippa Test */ = { + isa = PBXNativeTarget; + buildConfigurationList = E2651A95173CC6370091504C /* Build configuration list for PBXNativeTarget "Godzippa Test" */; + buildPhases = ( + E2651A7D173CC6370091504C /* Sources */, + E2651A7E173CC6370091504C /* Frameworks */, + E2651A7F173CC6370091504C /* Resources */, + E2651A80173CC6370091504C /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Godzippa Test"; + productName = "Godzippa Test"; + productReference = E2651A82173CC6370091504C /* Godzippa Test.octest */; + productType = "com.apple.product-type.bundle"; + }; F860358716AD0E4D0027FDE8 /* Godzippa Example */ = { isa = PBXNativeTarget; buildConfigurationList = F860359716AD0E4D0027FDE8 /* Build configuration list for PBXNativeTarget "Godzippa Example" */; @@ -153,11 +246,49 @@ projectRoot = ""; targets = ( F860358716AD0E4D0027FDE8 /* Godzippa Example */, + E2651A81173CC6370091504C /* Godzippa Test */, ); }; /* End PBXProject section */ +/* Begin PBXResourcesBuildPhase section */ + E2651A7F173CC6370091504C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E2651A90173CC6370091504C /* InfoPlist.strings in Resources */, + E2651A9D173CC68B0091504C /* test.txt in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + E2651A80173CC6370091504C /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ + E2651A7D173CC6370091504C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E2651A9F173CC6FC0091504C /* NSData+Godzippa.m in Sources */, + E2651A93173CC6370091504C /* Godzippa_Test.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; F860358416AD0E4D0027FDE8 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -169,7 +300,52 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + E2651A8E173CC6370091504C /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + E2651A8F173CC6370091504C /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ + E2651A96173CC6370091504C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\""; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Godzippa Test/Godzippa Test-Prefix.pch"; + INFOPLIST_FILE = "Godzippa Test/Godzippa Test-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = octest; + }; + name = Debug; + }; + E2651A97173CC6370091504C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\""; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Godzippa Test/Godzippa Test-Prefix.pch"; + INFOPLIST_FILE = "Godzippa Test/Godzippa Test-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = octest; + }; + name = Release; + }; F860359516AD0E4D0027FDE8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -246,6 +422,14 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + E2651A95173CC6370091504C /* Build configuration list for PBXNativeTarget "Godzippa Test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E2651A96173CC6370091504C /* Debug */, + E2651A97173CC6370091504C /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; F860358216AD0E4D0027FDE8 /* Build configuration list for PBXProject "Godzippa Example" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Example/Godzippa Test/Godzippa Test-Info.plist b/Example/Godzippa Test/Godzippa Test-Info.plist new file mode 100644 index 0000000..470f3ee --- /dev/null +++ b/Example/Godzippa Test/Godzippa Test-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.godzippa.zlib.error.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Example/Godzippa Test/Godzippa Test-Prefix.pch b/Example/Godzippa Test/Godzippa Test-Prefix.pch new file mode 100644 index 0000000..85b073b --- /dev/null +++ b/Example/Godzippa Test/Godzippa Test-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Godzippa Test' target in the 'Godzippa Test' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/Example/Godzippa Test/Godzippa_Test.h b/Example/Godzippa Test/Godzippa_Test.h new file mode 100644 index 0000000..c0991fa --- /dev/null +++ b/Example/Godzippa Test/Godzippa_Test.h @@ -0,0 +1,5 @@ +#import + +@interface Godzippa_Test : SenTestCase + +@end diff --git a/Example/Godzippa Test/Godzippa_Test.m b/Example/Godzippa Test/Godzippa_Test.m new file mode 100644 index 0000000..148e23f --- /dev/null +++ b/Example/Godzippa Test/Godzippa_Test.m @@ -0,0 +1,32 @@ +#import "Godzippa_Test.h" + +#import "NSData+Godzippa.h" + +@implementation Godzippa_Test + +- (void)setUp +{ + [super setUp]; +} + +- (void)tearDown +{ + [super tearDown]; +} + +- (void)testExample +{ + NSString* testTxt = [[NSBundle bundleForClass:[self class]] pathForResource:@"test" ofType:@"txt"]; + NSData* testTxtData = [NSData dataWithContentsOfFile:testTxt]; + + NSError* error = nil; + + NSData* compressedData = [testTxtData dataByGZipCompressingWithError:&error]; + STAssertNil(error, @"Error compressing data: %@", [error localizedDescription]); + + NSData* decompressedData = [compressedData dataByGZipDecompressingDataWithError:&error]; + STAssertNil(error, @"Error decompressing data: %@", [error localizedDescription]); + STAssertTrue([testTxtData isEqualToData:decompressedData], @"Decompression test failed"); +} + +@end diff --git a/Example/Godzippa Test/en.lproj/InfoPlist.strings b/Example/Godzippa Test/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/Example/Godzippa Test/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Example/Godzippa Test/test-data/test.txt b/Example/Godzippa Test/test-data/test.txt new file mode 100755 index 0000000..b31372d --- /dev/null +++ b/Example/Godzippa Test/test-data/test.txt @@ -0,0 +1 @@ +Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.