├── .gitignore
├── GHUnitIOS.framework
├── Versions
│ ├── Current
│ └── A
│ │ ├── GHUnitIOS
│ │ ├── Resources
│ │ └── Info.plist
│ │ └── Headers
│ │ ├── GHUnitIPhoneAppDelegate.h
│ │ ├── GHTestGroup+JUnitXML.h
│ │ ├── GHTest+JUnitXML.h
│ │ ├── GHUnitIOSAppDelegate.h
│ │ ├── GHUnitIOSTestViewController.h
│ │ ├── GHUnitIOSTableViewDataSource.h
│ │ ├── GHTestOperation.h
│ │ ├── GHUnitIOSView.h
│ │ ├── GHUnit.h
│ │ ├── GHUnitIOSViewController.h
│ │ ├── NSValue+GHValueFormatter.h
│ │ ├── GHTestSuite.h
│ │ ├── NSException+GHTestFailureExceptions.h
│ │ ├── GHTestCase.h
│ │ ├── GHTesting.h
│ │ ├── GHAsyncTestCase.h
│ │ ├── GHTestViewModel.h
│ │ ├── GHTestGroup.h
│ │ ├── GHTestRunner.h
│ │ ├── GHTest.h
│ │ └── GHTestMacros.h
├── Headers
├── GHUnitIOS
└── Resources
├── ios-demo
├── en.lproj
│ └── InfoPlist.strings
├── iPad
│ ├── ios_demoAppDelegate_iPad.h
│ ├── ios_demoAppDelegate_iPad.m
│ └── en.lproj
│ │ └── MainWindow_iPad.xib
├── iPhone
│ ├── ios_demoAppDelegate_iPhone.h
│ ├── ios_demoAppDelegate_iPhone.m
│ └── en.lproj
│ │ └── MainWindow_iPhone.xib
├── ios_demoAppDelegate.h
├── ios-demo-Prefix.pch
├── main.m
├── ios-demo-Info.plist
└── ios_demoAppDelegate.m
├── ios-demo-test
├── en.lproj
│ └── InfoPlist.strings
├── Resources
│ └── test.plist
├── main.m
├── MyTest.m
├── NSLogTest.m
├── ios-demo-test-Prefix.pch
├── NSSelectorTest.m
├── NSDictionaryTest.m
├── NSObjectTest.m
├── NSTimerTest.m
├── NSThreadTest.m
├── NSStringTest.m
├── NSExceptionTest.m
├── ExampleTest.m
├── NSUnitTest.m
├── ios-demo-test-Info.plist
├── ExampleAsyncTest.m
├── runtest.sh
├── NSArrayTest.m
└── NSPathTest.m
├── ios-demo.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcuserdata
│ └── dli.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ ├── ios-demo.xcscheme
│ │ └── ios-demo-test.xcscheme
└── project.pbxproj
├── Makefile
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | .idea
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/GHUnitIOS.framework/GHUnitIOS:
--------------------------------------------------------------------------------
1 | Versions/Current/GHUnitIOS
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/ios-demo/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/ios-demo-test/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/GHUnitIOS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/ios-demo/master/GHUnitIOS.framework/Versions/A/GHUnitIOS
--------------------------------------------------------------------------------
/ios-demo-test/Resources/test.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ios-demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios-demo-test/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | int main(int argc, char *argv[])
4 | {
5 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
6 | int retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIOSAppDelegate");
7 | [pool release];
8 | return retVal;
9 | }
10 |
--------------------------------------------------------------------------------
/ios-demo-test/MyTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface MyTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation MyTest
9 |
10 | - (void)testStrings {
11 | NSString *string1 = @"a string";
12 | GHTestLog(@"I can log to the GHUnit test console: %@", string1);
13 | }
14 |
15 | @end
--------------------------------------------------------------------------------
/ios-demo/iPad/ios_demoAppDelegate_iPad.h:
--------------------------------------------------------------------------------
1 | //
2 | // ios_demoAppDelegate_iPad.h
3 | // ios-demo
4 | //
5 | // Created by dli on 9/11/11.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ios_demoAppDelegate.h"
11 |
12 | @interface ios_demoAppDelegate_iPad : ios_demoAppDelegate {
13 |
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ios-demo/iPad/ios_demoAppDelegate_iPad.m:
--------------------------------------------------------------------------------
1 | //
2 | // ios_demoAppDelegate_iPad.m
3 | // ios-demo
4 | //
5 | // Created by dli on 9/11/11.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "ios_demoAppDelegate_iPad.h"
10 |
11 | @implementation ios_demoAppDelegate_iPad
12 |
13 | - (void)dealloc
14 | {
15 | [super dealloc];
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/ios-demo/iPhone/ios_demoAppDelegate_iPhone.h:
--------------------------------------------------------------------------------
1 | //
2 | // ios_demoAppDelegate_iPhone.h
3 | // ios-demo
4 | //
5 | // Created by dli on 9/11/11.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ios_demoAppDelegate.h"
11 |
12 | @interface ios_demoAppDelegate_iPhone : ios_demoAppDelegate {
13 |
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | default:
2 | #Set default make action here
3 | # xcodebuild -target ios-demo -configuration MyMainTarget -sdk iphonesimulator build
4 |
5 | clean:
6 | -rm -rf build/*
7 |
8 | test:
9 | GHUNIT_CLI=1 xcodebuild -target ios-demo-test -configuration Debug -sdk iphonesimulator build
10 |
11 | check:
12 | ~/bin/checker/scan-build xcodebuild -configuration Debug -sdk iphonesimulator
--------------------------------------------------------------------------------
/ios-demo-test/NSLogTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSLogTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSLogTest
9 |
10 | - (void)testNSLog {
11 | NSLog(@"0x%x, %d", 30, 30);
12 | NSLog(@"log: %@ ", "string");
13 | NSLog(@"log: %f ", 10.1);
14 | NSLog(@"log: %i ", 100);
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/ios-demo/iPhone/ios_demoAppDelegate_iPhone.m:
--------------------------------------------------------------------------------
1 | //
2 | // ios_demoAppDelegate_iPhone.m
3 | // ios-demo
4 | //
5 | // Created by dli on 9/11/11.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "ios_demoAppDelegate_iPhone.h"
10 |
11 | @implementation ios_demoAppDelegate_iPhone
12 |
13 | - (void)dealloc
14 | {
15 | [super dealloc];
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/ios-demo/ios_demoAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // ios_demoAppDelegate.h
3 | // ios-demo
4 | //
5 | // Created by dli on 9/11/11.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ios_demoAppDelegate : NSObject {
12 |
13 | }
14 |
15 | @property (nonatomic, retain) IBOutlet UIWindow *window;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/ios-demo/ios-demo-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'ios-demo' target in the 'ios-demo' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/ios-demo-test/ios-demo-test-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'ios-demo-test' target in the 'ios-demo-test' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/ios-demo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ios-demo
4 | //
5 | // Created by dli on 9/11/11.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | int main(int argc, char *argv[])
12 | {
13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
14 | int retVal = UIApplicationMain(argc, argv, nil, nil);
15 | [pool release];
16 | return retVal;
17 | }
18 |
--------------------------------------------------------------------------------
/ios-demo-test/NSSelectorTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSSelectorTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSSelectorTest
9 |
10 | - (void) lotIt:(NSString *) string{
11 | NSLog(@"%@", string);
12 | }
13 |
14 | - (void)testMakeObjectsPerformSelector {
15 | NSString *method = NSStringFromSelector(@selector(logIt:));
16 | NSLog(@"%@", method);
17 | GHTestLog(@"it should be print all objects in array with selector.");
18 | }
19 |
20 | @end
--------------------------------------------------------------------------------
/ios-demo-test/NSDictionaryTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSDictionaryTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSDictionaryTest
9 |
10 | - (void)testNSLog {
11 | NSString *key = @"key";
12 | NSString *value = @"value";
13 | NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
14 | [dict setObject:value forKey:key];
15 | GHAssertEqualStrings(value, [dict objectForKey:key], @"it should return value.");
16 | [dict release];
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/ios-demo-test/NSObjectTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSObjectTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSObjectTest
9 |
10 | - (void)testRespondsToSelector {
11 | NSString *str = @"HELLO everyOne";
12 | SEL sel = @selector(lowercaseString);
13 | NSLog(@"Responds to lowercaseString: %@", (([str respondsToSelector:sel]) ? @"YES" : @"NO"));
14 | if ([str respondsToSelector:sel])
15 | NSLog(@"lowercaseString is: %@", [str lowercaseString]);
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/ios-demo-test/NSTimerTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSTimerTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSTimerTest
9 |
10 | -(void)myMethod:(NSTimer*)timer {
11 | NSLog(@"scheduledTimerWithTimeInterval: %@", [timer userInfo]);
12 |
13 | [timer invalidate];
14 | }
15 |
16 | - (void)testScheduledTimerWithTimeInterval {
17 | NSString *string = [NSString stringWithFormat:@"%d", arc4random()];
18 | [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(myMethod) userInfo:string repeats:NO];
19 | }
20 |
21 | @end
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleIdentifier
8 | me.rel.ghunit
9 | CFBundleInfoDictionaryVersion
10 | 6.0
11 | CFBundlePackageType
12 | FMWK
13 | CFBundleSignature
14 | ????
15 | CFBundleVersion
16 | $(GHUNIT_VERSION)
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ios-demo-test/NSThreadTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSThreadTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSThreadTest
9 |
10 | - (void)myMethod {
11 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
12 |
13 | for (int i = 0; i < 3; i++) {
14 | NSLog(@"thread running...%d", arc4random());
15 | [NSThread sleepForTimeInterval:1];
16 | }
17 |
18 | [pool release];
19 | }
20 |
21 | - (void)test {
22 | [self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:true];
23 | NSLog(@"thread stopped");
24 | }
25 |
26 | @end
--------------------------------------------------------------------------------
/ios-demo.xcodeproj/xcuserdata/dli.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ios-demo.xcodeproj/xcuserdata/dli.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | ios-demo-test.xcscheme
8 |
9 | orderHint
10 | 1
11 |
12 | ios-demo.xcscheme
13 |
14 | orderHint
15 | 0
16 |
17 |
18 | SuppressBuildableAutocreation
19 |
20 | 42BAE6AA141CE07F005F8432
21 |
22 | primary
23 |
24 |
25 | 42BAE6D7141CE0CA005F8432
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ios-demo-test/NSStringTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSStringTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSStringTest
9 |
10 | - (void)testStringWithString {
11 | NSString *result = [NSString stringWithFormat:@"0x%x, %d", 30, 30];
12 | GHAssertEqualStrings(@"", result, @"it should be formated string.");
13 | }
14 |
15 | - (void)testInitWithData {
16 | NSString *input = @"hello";
17 | NSData *d = [input dataUsingEncoding:NSUTF8StringEncoding];
18 | NSString *output = [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];
19 | GHAssertEqualStrings(output, input, @"it should be same string.");
20 | [output release];
21 | }
22 |
23 | - (void)testStringWithFormat {
24 | // int x = 11;
25 | // NSString *string = [NSString stringWithFormat:@"%03i", x];
26 | // NSString *string1 = [NSString stringWithFormat:@"%+5i", x];
27 | // NSString *string2 = [NSString stringWithFormat:@"%+05i", x];
28 | }
29 | @end
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | CheckStyle
2 | ====
3 |
4 | scan-build -k -V xcodebuild
5 |
6 | Test Coverage
7 | ====
8 | Normally to set up code coverage on Xcode, you turn on the "Instrument Program Flow" (-fprofile-arcs) and "Generate Test Coverage Files" (-ftest-coverage) flags, and add libgcov (-lgcov).
9 |
10 | gcovr -r . -x -e “.*Test.*” -e “.*GoogleToolbox.*” -e “.*Source Xternal.*” 1>coverage.xml
11 |
12 | Jenkins
13 | ====
14 |
15 | brew install jenkins
16 |
17 | install git plugins, restart jenkins
18 |
19 | Build Triggers check Poll SCM and add a schedule of * * * * *
20 | make clean && WRITE_JUNIT_XML=YES make test
21 | Post-build Actions, check Publish JUnit test result report and enter the following in Test report XMLs:
22 | build/test-results/*.xml
23 |
24 | Test
25 | ====
26 |
27 | make test
28 |
29 | make test TEST="ExampleTest"
30 | make test TEST="ExampleTest/testFoo"
31 |
32 | http://gabriel.github.com/gh-unit/docs/appledoc_include/guide_command_line.html
33 |
34 | Jenkins
35 | ====
36 |
37 | http://gabriel.github.com/gh-unit/docs/appledoc_include/guide_ci.html
38 |
--------------------------------------------------------------------------------
/ios-demo-test/NSExceptionTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSExceptionTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSExceptionTest
9 |
10 | - (void)testExceptionWithName {
11 | NSString *name = @"DemoException";
12 | NSString *reason = @"A test exception";
13 | @try {
14 | [[NSException exceptionWithName:name reason:reason userInfo:nil] raise];
15 | } @catch (NSException *exception) {
16 | NSLog(@"excetion has been catched.");
17 | GHAssertEqualStrings(name, [exception name], @"exception name is not expected.");
18 | GHAssertEqualStrings(reason, [exception reason], @"exception reason is not expected.");
19 | } @finally {
20 | NSLog(@"finally.");
21 | }
22 | }
23 |
24 | - (void)testRaiseNSException {
25 | NSString *name = @"DemoException";
26 | NSString *format = @"Invalid value %d";
27 | @try {
28 | [NSException raise:name format:format, 404];
29 | } @catch (NSException *exception) {
30 | GHAssertEqualStrings(name, exception.name, @"exception name is not expected.");
31 | GHAssertEqualStrings(@"Invalid value 404", exception.reason, @"exception reason is not expected.");
32 | }
33 | }
34 |
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/ios-demo-test/ExampleTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface ExampleTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation ExampleTest
9 |
10 | - (BOOL)shouldRunOnMainThread {
11 | // By default NO, but if you have a UI test or test dependent on running on the main thread return YES.
12 | // Also an async test that calls back on the main thread, you'll probably want to return YES.
13 | return NO;
14 | }
15 |
16 | - (void)setUpClass {
17 | // Run at start of all tests in the class
18 | }
19 |
20 | - (void)tearDownClass {
21 | // Run at end of all tests in the class
22 | }
23 |
24 | - (void)setUp {
25 | // Run before each test method
26 | }
27 |
28 | - (void)tearDown {
29 | // Run after each test method
30 | }
31 |
32 | - (void)testFoo {
33 | NSString *a = @"foo";
34 | GHTestLog(@"I can log to the GHUnit test console: %@", a);
35 |
36 | // Assert a is not NULL, with no custom error description
37 | GHAssertNotNULL(a, nil);
38 |
39 | // Assert equal objects, add custom error description
40 | NSString *b = @"bar";
41 | GHAssertEqualObjects(a, b, @"A custom error message. a should be equal to: %@.", b);
42 | }
43 |
44 | - (void)testBar {
45 | // Another test
46 | }
47 |
48 | - (void)testReturnTrue {
49 | // Another test
50 | GHAssertTrue(true, @"should pass test");
51 | }
52 |
53 | - (void)testReturnFalse {
54 | // Another test
55 | GHAssertTrue(false, @"should failed test");
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHUnitIPhoneAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHUnitIPhoneAppDelegate.h
3 | // GHUnitIOS
4 | //
5 | // Created by Gabriel Handford on 6/28/11.
6 | //
7 | // Permission is hereby granted, free of charge, to any person
8 | // obtaining a copy of this software and associated documentation
9 | // files (the "Software"), to deal in the Software without
10 | // restriction, including without limitation the rights to use,
11 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the
13 | // Software is furnished to do so, subject to the following
14 | // conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be
17 | // included in all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 | // OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 |
29 | #import "GHUnitIOSAppDelegate.h"
30 |
31 | // For backwards compatibility (see GHUnitIOSAppDelegate)
32 | @interface GHUnitIPhoneAppDelegate : GHUnitIOSAppDelegate {
33 |
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/ios-demo-test/NSUnitTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSUnitTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSUnitTest
9 |
10 | //- (void)failWithException:(NSException *)exception {
11 | // NSLog(@"fail with exception. %@", [exception reason]);
12 | //}
13 |
14 | - (void)testGHAssertTrue {
15 | GHAssertTrue(true, @"test assertTrue will failed." );
16 | }
17 |
18 | - (void)testGHAssertFalse {
19 | GHAssertFalse(false, @"test assertFalse");
20 | }
21 |
22 | - (void)testGHTestLog {
23 | GHTestLog(@"Log with a test with the GHTestLog(...) for test specific logging.");
24 | }
25 |
26 | - (void)testGHAssertNotNull {
27 | NSString *notNull = [NSString stringWithString:@"not null"];
28 | GHAssertNotNULL(notNull, @"it should be not null.");
29 | }
30 |
31 | - (void)testGHAssertEqualObjects {
32 | NSNumber *object = [NSNumber numberWithLong:100];
33 | NSNumber *equal = [NSNumber numberWithDouble:100.0];
34 | GHAssertEqualObjects(equal, object, @"A custom error message. obj should be equal to: %@.", object);
35 | }
36 |
37 | - (void)testGHAssertNotEqualObjects {
38 | NSString *object = [NSString stringWithString:@"object"];
39 | NSString *notEqual = [NSString stringWithString:@"not equal"];
40 | GHAssertNotEqualObjects(notEqual, object, @"A custom error message. obj should be not equal to: %@.", object);
41 | }
42 |
43 | - (void)testGHAssertGreaterThan {
44 | NSNumber *count= [NSNumber numberWithLong:1];
45 | GHAssertGreaterThan((int)count, 0, @"it should not an empty array.");
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/ios-demo-test/ios-demo-test-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIdentifier
14 | fssle.${PRODUCT_NAME:rfc1034identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestGroup+JUnitXML.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTestGroup+JUnitXML.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 6/4/10.
6 | // Copyright 2010. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | //! @cond DEV
31 |
32 | #import "GHTestGroup.h"
33 |
34 | @interface GHTestGroup(JUnitXML)
35 |
36 | - (NSString *)JUnitXML;
37 |
38 | - (BOOL)writeJUnitXMLAtPath:(NSString *)documentsPath error:(NSError **)error;
39 |
40 | @end
41 |
42 | //! @endcond
43 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTest+JUnitXML.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTest+JUnitXML.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 6/4/10.
6 | // Copyright 2010. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | //! @cond DEV
31 |
32 | #import "GHTest.h"
33 |
34 | @interface GHTest(JUnitXML)
35 |
36 | /*!
37 | Return test results in JUnit XML format for external parsing use
38 | (such as a Continuous Integration system like Jenkins).
39 | */
40 | - (NSString *)JUnitXML;
41 |
42 | @end
43 |
44 | //! @endcond
45 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHUnitIOSAppDelegate.h
3 | // GHUnitIOS
4 | //
5 | // Created by Gabriel Handford on 1/25/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import
31 |
32 | /*!
33 | Application delegate for the iOS test application.
34 | */
35 | @interface GHUnitIOSAppDelegate : NSObject {
36 | UIWindow *window_;
37 |
38 | UINavigationController *navigationController_;
39 | }
40 |
41 | @end
42 |
43 |
--------------------------------------------------------------------------------
/ios-demo-test/ExampleAsyncTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface ExampleAsyncTest : GHAsyncTestCase {
5 | }
6 | @end
7 |
8 | @implementation ExampleAsyncTest
9 |
10 | - (void)testURLConnection {
11 |
12 | // Call prepare to setup the asynchronous action.
13 | // This helps in cases where the action is synchronous and the
14 | // action occurs before the wait is actually called.
15 | [self prepare];
16 |
17 | NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]];
18 | NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
19 |
20 | // Wait until notify called for timeout (seconds); If notify is not called with kGHUnitWaitStatusSuccess then
21 | // we will throw an error.
22 | [self waitForStatus:kGHUnitWaitStatusSuccess timeout:10.0];
23 |
24 | [connection release];
25 | }
26 |
27 | - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
28 | // Notify of success, specifying the method where wait is called.
29 | // This prevents stray notifies from affecting other tests.
30 | [self notify:kGHUnitWaitStatusSuccess forSelector:@selector(testURLConnection)];
31 | }
32 |
33 | - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
34 | // Notify of connection failure
35 | [self notify:kGHUnitWaitStatusFailure forSelector:@selector(testURLConnection)];
36 | }
37 |
38 | - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
39 | GHTestLog(@"%@", [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]);
40 | }
41 |
42 | @end
--------------------------------------------------------------------------------
/ios-demo/ios-demo-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIdentifier
14 | fssle.${PRODUCT_NAME:rfc1034identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow_iPhone
31 | NSMainNibFile~ipad
32 | MainWindow_iPad
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSTestViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHUnitIOSTestViewController.h
3 | // GHUnitIOS
4 | //
5 | // Created by Gabriel Handford on 2/20/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import
31 | #import "GHTestViewModel.h"
32 |
33 | /*
34 | View controller for a test.
35 | */
36 | @interface GHUnitIOSTestViewController : UIViewController {
37 | UITextView *textView_;
38 |
39 | GHTestNode *testNode_;
40 |
41 | GHTestRunner *runner_;
42 | }
43 |
44 | - (void)setTest:(id)test;
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSTableViewDataSource.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHUnitIOSTableViewDataSource.h
3 | // GHUnitIOS
4 | //
5 | // Created by Gabriel Handford on 5/5/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import
31 | #import "GHTestViewModel.h"
32 |
33 | /*
34 | Table view data source for iOS test application.
35 | */
36 | @interface GHUnitIOSTableViewDataSource : GHTestViewModel {
37 |
38 | }
39 |
40 | - (GHTestNode *)nodeForIndexPath:(NSIndexPath *)indexPath;
41 |
42 | - (void)setSelectedForAllNodes:(BOOL)selected;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestOperation.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTestOperation.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 6/4/10.
6 | // Copyright 2010. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import "GHTest.h"
31 |
32 | /*!
33 | Test for running in the context of an NSOperationQueue.
34 | */
35 | @interface GHTestOperation : NSOperation {
36 | id test_;
37 | GHTestOptions options_;
38 | }
39 |
40 | /*!
41 | Create operation that wraps a GHTest instance.
42 | @param test Test
43 | @param options Options
44 | */
45 | - (id)initWithTest:(id)test options:(GHTestOptions)options;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/ios-demo-test/runtest.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # https://github.com/gabriel/gh-unit/blob/master/Scripts/RunTests.sh
4 |
5 | # If we aren't running from the command line, then exit
6 | if [ "$GHUNIT_CLI" = "" ] && [ "$GHUNIT_AUTORUN" = "" ]; then
7 | exit 0
8 | fi
9 |
10 | echo "export ENV"
11 |
12 | export DYLD_ROOT_PATH="$SDKROOT"
13 | export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR"
14 | export IPHONE_SIMULATOR_ROOT="$SDKROOT"
15 |
16 | export NSDebugEnabled=YES
17 | export NSZombieEnabled=YES
18 | export NSDeallocateZombies=NO
19 | export NSHangOnUncaughtException=YES
20 | export NSAutoreleaseFreedObjectCheckEnabled=YES
21 |
22 | export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR"
23 | export CFFIXED_USER_HOME="$USER_LIBRARY_DIR/Application Support/iPhone Simulator/User"
24 |
25 | TEST_TARGET_EXECUTABLE_PATH="$TARGET_BUILD_DIR/$EXECUTABLE_PATH"
26 |
27 | if [ ! -e "$TEST_TARGET_EXECUTABLE_PATH" ]; then
28 | echo ""
29 | echo " ------------------------------------------------------------------------"
30 | echo " Missing executable path: "
31 | echo " $TEST_TARGET_EXECUTABLE_PATH."
32 | echo " The product may have failed to build or could have an old xcodebuild in your path (from 3.x instead of 4.x)."
33 | echo " ------------------------------------------------------------------------"
34 | echo ""
35 | exit 1
36 | fi
37 |
38 | RUN_CMD="\"$TEST_TARGET_EXECUTABLE_PATH\" -RegisterForSystemEvents"
39 |
40 | echo "Running: $RUN_CMD"
41 | set +o errexit # Disable exiting on error so script continues if tests fail
42 | eval $RUN_CMD
43 | RETVAL=$?
44 | set -o errexit
45 |
46 | unset DYLD_ROOT_PATH
47 | unset DYLD_FRAMEWORK_PATH
48 | unset IPHONE_SIMULATOR_ROOT
49 |
50 | if [ -n "$WRITE_JUNIT_XML" ]; then
51 | MY_TMPDIR=`/usr/bin/getconf DARWIN_USER_TEMP_DIR`
52 | RESULTS_DIR="${MY_TMPDIR}test-results"
53 |
54 | if [ -d "$RESULTS_DIR" ]; then
55 | `$CP -r "$RESULTS_DIR" "$BUILD_DIR" && rm -r "$RESULTS_DIR"`
56 | fi
57 | fi
58 |
59 | exit $RETVAL
60 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSView.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHUnitIOSView.h
3 | // GHUnitIOS
4 | //
5 | // Created by Gabriel Handford on 4/12/10.
6 | // Copyright 2010. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import
31 | #import
32 |
33 | /*
34 | Main view for iOS test application.
35 | */
36 | @interface GHUnitIOSView : UIView {
37 | UISearchBar *searchBar_;
38 |
39 | UITableView *tableView_;
40 |
41 | //! Status label at bottom of the view
42 | UILabel *statusLabel_;
43 |
44 | UISegmentedControl *filterControl_;
45 |
46 | UIToolbar *runToolbar_;
47 |
48 | UIView *footerView_;
49 | }
50 |
51 | @property (readonly, nonatomic) UILabel *statusLabel;
52 | @property (readonly, nonatomic) UISegmentedControl *filterControl;
53 | @property (readonly, nonatomic) UISearchBar *searchBar;
54 | @property (readonly, nonatomic) UITableView *tableView;
55 |
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHUnit.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHUnit.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 1/19/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import "GHTestCase.h"
31 | #import "GHAsyncTestCase.h"
32 | #import "GHTestSuite.h"
33 | #import "GHTestMacros.h"
34 | #import "GHTestRunner.h"
35 |
36 | #import "GHTest.h"
37 | #import "GHTesting.h"
38 | #import "GHTestOperation.h"
39 | #import "GHTestGroup.h"
40 | #import "GHTest+JUnitXML.h"
41 | #import "GHTestGroup+JUnitXML.h"
42 | #import "NSException+GHTestFailureExceptions.h"
43 | #import "NSValue+GHValueFormatter.h"
44 |
45 | #if TARGET_OS_IPHONE
46 | #import "GHUnitIOSAppDelegate.h"
47 | #endif
48 |
49 | #ifdef DEBUG
50 | #define GHUDebug(fmt, ...) do { \
51 | fputs([[[NSString stringWithFormat:fmt, ##__VA_ARGS__] stringByAppendingString:@"\n"] UTF8String], stdout); \
52 | } while(0)
53 | #else
54 | #define GHUDebug(fmt, ...) do {} while(0)
55 | #endif
56 |
--------------------------------------------------------------------------------
/ios-demo-test/NSArrayTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSArrayTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSArrayTest
9 |
10 | - (void)testArrayWithObject {
11 | NSArray *array = [NSArray arrayWithObject:@"foo"];
12 | GHAssertGreaterThan((int) array.count, 0, @"it should not an empty array.");
13 | }
14 |
15 | - (void)testArrayWithObjects {
16 | NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar", nil];
17 | GHAssertEquals((int) array.count, 2, @"it should be array with some objects.");
18 | }
19 |
20 | - (void)testArrayWithArray {
21 | NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar", nil];
22 | NSArray *anotherArray = [NSArray arrayWithArray:array];
23 |
24 | GHAssertEquals(anotherArray.count, array.count, @"it should be same arrays.");
25 | }
26 |
27 | - (void)testObjectAtIndex {
28 | NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar", nil];
29 | NSUInteger object_id = [array indexOfObject:@"bar"];
30 | id object = [array objectAtIndex:object_id];
31 | id lastObject = [array lastObject];
32 | GHAssertEquals(object, lastObject, @"it should be same object.");
33 | }
34 |
35 | - (void)testArrayIterator {
36 | NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar", nil];
37 | for (NSString *string in array) {
38 | NSLog(@"%@", string);
39 | }
40 | GHTestLog(@"it should be print all objects in array.");
41 | }
42 |
43 | - (void)testSortedArrayUsingSelector {
44 | NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar", nil];
45 | NSArray *sortedArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
46 | for (NSString *string in sortedArray) {
47 | NSLog(@"%@", string);
48 | }
49 | GHTestLog(@"it should be print all objects in array by sorted.");
50 | }
51 |
52 | - (void)testMakeObjectsPerformSelector {
53 | NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar", nil];
54 | [array makeObjectsPerformSelector:@selector(uppercaseString)];
55 | GHTestLog(@"it should be print all objects in array with uppercase.");
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHUnitIOSViewController.h
3 | // GHUnitIOS
4 | //
5 | // Created by Gabriel Handford on 1/25/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import "GHUnitIOSView.h"
31 |
32 | #import "GHUnitIOSTableViewDataSource.h"
33 | #import "GHUnitIOSTestViewController.h"
34 |
35 | /*
36 | Main view controller for the iOS test application.
37 | */
38 | @interface GHUnitIOSViewController : UIViewController {
39 |
40 | GHUnitIOSView *view_;
41 |
42 | GHUnitIOSTableViewDataSource *dataSource_;
43 | GHTestSuite *suite_;
44 |
45 | UIBarButtonItem *runButton_;
46 |
47 | // If set then we will no longer auto scroll as tests are run
48 | BOOL userDidDrag_;
49 |
50 | }
51 |
52 | @property (retain, nonatomic) GHTestSuite *suite;
53 |
54 | - (void)reloadTest:(id)test;
55 |
56 | - (void)scrollToTest:(id)test;
57 | - (void)scrollToBottom;
58 |
59 | - (void)setStatusText:(NSString *)message;
60 |
61 | - (void)runTests;
62 |
63 | - (void)cancel;
64 |
65 | - (void)reload;
66 |
67 | - (void)loadDefaults;
68 | - (void)saveDefaults;
69 |
70 | - (GHUnitIOSTableViewDataSource *)dataSource;
71 |
72 | @end
73 |
74 |
--------------------------------------------------------------------------------
/ios-demo/ios_demoAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // ios_demoAppDelegate.m
3 | // ios-demo
4 | //
5 | // Created by dli on 9/11/11.
6 | // Copyright 2011 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "ios_demoAppDelegate.h"
10 |
11 | @implementation ios_demoAppDelegate
12 |
13 |
14 | @synthesize window=_window;
15 |
16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17 | {
18 | // Override point for customization after application launch.
19 | [self.window makeKeyAndVisible];
20 | return YES;
21 | }
22 |
23 | - (void)applicationWillResignActive:(UIApplication *)application
24 | {
25 | /*
26 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
27 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
28 | */
29 | }
30 |
31 | - (void)applicationDidEnterBackground:(UIApplication *)application
32 | {
33 | /*
34 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
35 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
36 | */
37 | }
38 |
39 | - (void)applicationWillEnterForeground:(UIApplication *)application
40 | {
41 | /*
42 | Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
43 | */
44 | }
45 |
46 | - (void)applicationDidBecomeActive:(UIApplication *)application
47 | {
48 | /*
49 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
50 | */
51 | }
52 |
53 | - (void)applicationWillTerminate:(UIApplication *)application
54 | {
55 | /*
56 | Called when the application is about to terminate.
57 | Save data if appropriate.
58 | See also applicationDidEnterBackground:.
59 | */
60 | }
61 |
62 | - (void)dealloc
63 | {
64 | [_window release];
65 | [super dealloc];
66 | }
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/ios-demo-test/NSPathTest.m:
--------------------------------------------------------------------------------
1 | #import // ios
2 | //#import // osx
3 |
4 | @interface NSPathTest : GHTestCase {
5 | }
6 | @end
7 |
8 | @implementation NSPathTest
9 |
10 | - (void)testNSSearchPathForDirectoriesInDomains {
11 | NSArray *paths = NSSearchPathForDirectoriesInDomains(
12 | NSDocumentDirectory, NSUserDomainMask, YES);
13 | NSString *documentsDirectory = [paths objectAtIndex:0];
14 | NSString *fullName = [documentsDirectory stringByAppendingPathComponent:
15 | [NSString stringWithFormat:@"%@.plist", @"test"]];
16 |
17 | GHTestLog(fullName);
18 | }
19 |
20 | - (void)testCurrentDirectoryPath {
21 | NSFileManager *fileManger = [NSFileManager defaultManager];
22 | GHTestLog([fileManger currentDirectoryPath]);
23 | }
24 |
25 | - (void)testFileExistsAtPath {
26 | // NSFileManager *fileManger = [NSFileManager defaultManager];
27 | // if (fileManger) {
28 | // GHTestLog([fileManger fileExistsAtPath:@"ios-demo-test-Info"] ? "YES" : "NO");
29 | // }
30 | }
31 |
32 | - (void)testPathForResource {
33 | NSBundle *bundle = [NSBundle mainBundle];
34 | GHTestLog(@"[bundle bundleIdentifier]: %@", [bundle bundleIdentifier]);
35 | GHTestLog(@"[bundle bundlePath]: %@", [bundle bundlePath]);
36 | NSString *fullName = [bundle pathForResource:@"test" ofType:@"plist"];
37 | GHTestLog(fullName);
38 | GHTestLog([NSHomeDirectory() stringByAppendingString:@"/Documents/"]);
39 | }
40 |
41 | - (void)testDictionaryWithContentsOfFile {
42 | NSArray *paths = NSSearchPathForDirectoriesInDomains(
43 | NSDocumentDirectory, NSUserDomainMask, YES);
44 | NSString *documentsDirectoryPath = [paths objectAtIndex:0];
45 | NSString *path = [documentsDirectoryPath
46 | stringByAppendingPathComponent:@"myApp.plist"];
47 | NSMutableDictionary *plist = [NSDictionary dictionaryWithContentsOfFile:path];
48 | if (plist) {
49 | GHTestLog(@"%d", [[plist valueForKey:@"int"] intValue]);
50 | GHTestLog([plist valueForKey:@"bool"]);
51 |
52 | [plist setValue:@"value" forKey:@"key"];
53 | [plist writeToFile:path atomically:YES];
54 | }
55 | }
56 |
57 | - (void)testEnumeratorAtPath {
58 | id importFile;
59 | NSFileManager *fileManager = [NSFileManager defaultManager];
60 | NSDirectoryEnumerator *dirEnum = [fileManager enumeratorAtPath:@"*.*"];
61 | while ((importFile =[dirEnum nextObject])) {
62 | NSLog(@"%@", [importFile pathExtension]);
63 | NSLog(@"%@", [importFile path]);
64 | }
65 | }
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/ios-demo.xcodeproj/xcuserdata/dli.xcuserdatad/xcschemes/ios-demo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
40 |
41 |
47 |
48 |
49 |
50 |
51 |
52 |
59 |
60 |
66 |
67 |
68 |
69 |
71 |
72 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/ios-demo.xcodeproj/xcuserdata/dli.xcuserdatad/xcschemes/ios-demo-test.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
40 |
41 |
47 |
48 |
49 |
50 |
51 |
52 |
59 |
60 |
66 |
67 |
68 |
69 |
71 |
72 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/NSValue+GHValueFormatter.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSValue+GHValueFormatter.h
3 | //
4 | // Created by Johannes Rudolph on 23.9.2009.
5 | // Copyright 2009. All rights reserved.
6 | //
7 | // Permission is hereby granted, free of charge, to any person
8 | // obtaining a copy of this software and associated documentation
9 | // files (the "Software"), to deal in the Software without
10 | // restriction, including without limitation the rights to use,
11 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the
13 | // Software is furnished to do so, subject to the following
14 | // conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be
17 | // included in all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 | // OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 |
29 | //! @cond DEV
30 |
31 | //
32 | // Portions of this file fall under the following license, marked with
33 | // SENTE_BEGIN - SENTE_END
34 | //
35 | // Copyright (c) 1997-2005, Sen:te (Sente SA). All rights reserved.
36 | //
37 | // Use of this source code is governed by the following license:
38 | //
39 | // Redistribution and use in source and binary forms, with or without modification,
40 | // are permitted provided that the following conditions are met:
41 | //
42 | // (1) Redistributions of source code must retain the above copyright notice,
43 | // this list of conditions and the following disclaimer.
44 | //
45 | // (2) Redistributions in binary form must reproduce the above copyright notice,
46 | // this list of conditions and the following disclaimer in the documentation
47 | // and/or other materials provided with the distribution.
48 | //
49 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
50 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
51 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 | // IN NO EVENT SHALL Sente SA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
53 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
54 | // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
57 | // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 | //
59 | // Note: this license is equivalent to the FreeBSD license.
60 | //
61 | // This notice may not be removed from this file.
62 |
63 | #import
64 |
65 | // SENTE_BEGIN
66 | @interface NSValue(GHValueFormatter)
67 | - (NSString *)ghu_contentDescription;
68 | @end
69 | // SENTE_END
70 |
71 | //! @endcond
72 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestSuite.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTestSuite.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 1/25/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | //! @cond DEV
31 |
32 | #import "GHTestGroup.h"
33 |
34 | /*!
35 | If set, will run it as a "test filter" like the env variable TEST.
36 | */
37 | extern NSString *GHUnitTest;
38 |
39 |
40 | /*!
41 | Test suite is an alias for test group.
42 |
43 | A test case is an instance of a test case class with test methods.
44 | A test is a id which represents a target and a selector.
45 | A test group is a collection of tests; A collection of id (GHTest or GHTestGroup).
46 |
47 | For example, if you have 2 test cases, GHTestCase1 (with some test methods) and GHTestCase2 (with some test methods),
48 | your test suite might look like:
49 |
50 | "Tests" (GHTestSuite)
51 | GHTestGroup (collection of tests from GHTestCase1)
52 | - (void)testA1 (GHTest with target GHTestCase1 + testA1)
53 | - (void)testA2 (GHTest with target GHTestCase1 + testA2)
54 | GHTestGroup (collection of tests from GHTestCase2)
55 | - (void)testB1; (GHTest with target GHTestCase2 + testB1)
56 | - (void)testB2; (GHTest with target GHTestCase2 + testB2)
57 |
58 | */
59 | @interface GHTestSuite : GHTestGroup { }
60 |
61 | /*!
62 | Create test suite with test cases.
63 | @param name Label to give the suite
64 | @param testCases Array of init'ed test case classes
65 | @param delegate Delegate
66 | */
67 | - (id)initWithName:(NSString *)name testCases:(NSArray *)testCases delegate:(id)delegate;
68 |
69 | /*!
70 | Creates a suite of all tests.
71 | Will load all classes that subclass from GHTestCase, SenTestCase or GTMTestCase (or register test case class).
72 | @result Suite
73 | */
74 | + (GHTestSuite *)allTests;
75 |
76 | /*!
77 | Create suite of tests with filter.
78 | This is useful for running a single test or all tests in a single test case.
79 |
80 | For example,
81 | 'GHSlowTest' -- Runs all test method in GHSlowTest
82 | 'GHSlowTest/testSlowA -- Only runs the test method testSlowA in GHSlowTest
83 |
84 | @param testFilter Test filter
85 | @result Suite
86 | */
87 | + (GHTestSuite *)suiteWithTestFilter:(NSString *)testFilter;
88 |
89 | /*!
90 | Create suite of tests that start with prefix.
91 | @param prefix If test case class starts with the prefix; If nil or empty string, returns all tests
92 | @param options Compare options
93 | */
94 | + (GHTestSuite *)suiteWithPrefix:(NSString *)prefix options:(NSStringCompareOptions)options;
95 |
96 | /*!
97 | Suite for a single test/method.
98 | @param testCaseClass Test case class
99 | @param method Method
100 | @result Suite
101 | */
102 | + (GHTestSuite *)suiteWithTestCaseClass:(Class)testCaseClass method:(SEL)method;
103 |
104 | /*!
105 | Return test suite based on environment (TEST=TestFoo/foo)
106 | @result Suite
107 | */
108 | + (GHTestSuite *)suiteFromEnv;
109 |
110 | @end
111 |
112 | @interface GHTestSuite (JUnitXML)
113 |
114 | - (BOOL)writeJUnitXML:(NSError **)error;
115 |
116 | @end
117 |
118 | //! @endcond
119 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/NSException+GHTestFailureExceptions.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSException+GHTestFailureExceptions.h
3 | //
4 | // Created by Johannes Rudolph on 23.09.09.
5 | // Copyright 2009. All rights reserved.
6 | //
7 | // Permission is hereby granted, free of charge, to any person
8 | // obtaining a copy of this software and associated documentation
9 | // files (the "Software"), to deal in the Software without
10 | // restriction, including without limitation the rights to use,
11 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the
13 | // Software is furnished to do so, subject to the following
14 | // conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be
17 | // included in all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 | // OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 |
29 | //! @cond DEV
30 |
31 | //
32 | // Portions of this file fall under the following license, marked with:
33 | // GTM_BEGIN : GTM_END
34 | //
35 | // Copyright 2008 Google Inc.
36 | //
37 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not
38 | // use this file except in compliance with the License. You may obtain a copy
39 | // of the License at
40 | //
41 | // http://www.apache.org/licenses/LICENSE-2.0
42 | //
43 | // Unless required by applicable law or agreed to in writing, software
44 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
45 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
46 | // License for the specific language governing permissions and limitations under
47 | // the License.
48 | //
49 |
50 | extern NSString *const GHTestFilenameKey;
51 | extern NSString *const GHTestLineNumberKey;
52 | extern NSString *const GHTestFailureException;
53 |
54 |
55 | // GTM_BEGIN
56 |
57 | #import
58 |
59 | @interface NSException(GHUTestFailureExceptions)
60 | + (NSException *)ghu_failureInFile:(NSString *)filename
61 | atLine:(int)lineNumber
62 | withDescription:(NSString *)formatString, ...;
63 | + (NSException *)ghu_failureInCondition:(NSString *)condition
64 | isTrue:(BOOL)isTrue
65 | inFile:(NSString *)filename
66 | atLine:(int)lineNumber
67 | withDescription:(NSString *)formatString, ...;
68 | + (NSException *)ghu_failureInEqualityBetweenObject:(id)left
69 | andObject:(id)right
70 | inFile:(NSString *)filename
71 | atLine:(int)lineNumber
72 | withDescription:(NSString *)formatString, ...;
73 | + (NSException *)ghu_failureInInequalityBetweenObject:(id)left
74 | andObject:(id)right
75 | inFile:(NSString *)filename
76 | atLine:(int)lineNumber
77 | withDescription:(NSString *)formatString, ...;
78 | + (NSException *)ghu_failureInEqualityBetweenValue:(NSValue *)left
79 | andValue:(NSValue *)right
80 | withAccuracy:(NSValue *)accuracy
81 | inFile:(NSString *)filename
82 | atLine:(int) ineNumber
83 | withDescription:(NSString *)formatString, ...;
84 | + (NSException *)ghu_failureInRaise:(NSString *)expression
85 | inFile:(NSString *)filename
86 | atLine:(int)lineNumber
87 | withDescription:(NSString *)formatString, ...;
88 | + (NSException *)ghu_failureInRaise:(NSString *)expression
89 | exception:(NSException *)exception
90 | inFile:(NSString *)filename
91 | atLine:(int)lineNumber
92 | withDescription:(NSString *)formatString, ...;
93 | @end
94 |
95 | // GTM_END
96 |
97 | //! @endcond
98 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestCase.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTestCase.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 1/21/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | //
31 | // Portions of this file fall under the following license, marked with:
32 | // GTM_BEGIN : GTM_END
33 | //
34 | // Copyright 2008 Google Inc.
35 | //
36 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not
37 | // use this file except in compliance with the License. You may obtain a copy
38 | // of the License at
39 | //
40 | // http://www.apache.org/licenses/LICENSE-2.0
41 | //
42 | // Unless required by applicable law or agreed to in writing, software
43 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
44 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
45 | // License for the specific language governing permissions and limitations under
46 | // the License.
47 | //
48 |
49 | #import "GHTestMacros.h"
50 | #import "GHTest.h"
51 |
52 | /*!
53 | Log to your test case logger. For example,
54 |
55 | GHTestLog(@"Some debug info, %@", obj);
56 |
57 | */
58 | #define GHTestLog(...) [self log:[NSString stringWithFormat:__VA_ARGS__, nil]]
59 |
60 | /*!
61 | The base class for a test case.
62 |
63 | @interface MyTest : GHTestCase {}
64 | @end
65 |
66 | @implementation MyTest
67 |
68 | // Run before each test method
69 | - (void)setUp { }
70 |
71 | // Run after each test method
72 | - (void)tearDown { }
73 |
74 | // Run before the tests are run for this class
75 | - (void)setUpClass { }
76 |
77 | // Run before the tests are run for this class
78 | - (void)tearDownClass { }
79 |
80 | // Tests are prefixed by 'test' and contain no arguments and no return value
81 | - (void)testA {
82 | GHTestLog(@"Log with a test with the GHTestLog(...) for test specific logging.");
83 | }
84 |
85 | // Another test; Tests are run in lexical order
86 | - (void)testB { }
87 |
88 | // Override any exceptions; By default exceptions are raised, causing a test failure
89 | - (void)failWithException:(NSException *)exception { }
90 |
91 | @end
92 |
93 | */
94 | @interface GHTestCase : NSObject {
95 | id logWriter_; // weak
96 |
97 | SEL currentSelector_;
98 | }
99 |
100 | //! The current test selector
101 | @property (assign, nonatomic) SEL currentSelector;
102 | @property (assign, nonatomic) id logWriter;
103 |
104 | // GTM_BEGIN
105 | //! Run before each test method
106 | - (void)setUp;
107 |
108 | //! Run after each test method
109 | - (void)tearDown;
110 |
111 | /*!
112 | By default exceptions are raised, causing a test failure
113 |
114 | @param exception Exception that was raised by test
115 | */
116 | - (void)failWithException:(NSException*)exception;
117 | // GTM_END
118 |
119 | /*!
120 | Run before the tests (once per test case).
121 | */
122 | - (void)setUpClass;
123 |
124 | /*!
125 | Run after the tests (once per test case).
126 | */
127 | - (void)tearDownClass;
128 |
129 | /*!
130 | Whether to run the tests on a separate thread. Override this method in your
131 | test case to override the default.
132 | Default is NO, tests are run on a separate thread by default.
133 |
134 | @result If YES, the test will run on the main thread
135 | */
136 | - (BOOL)shouldRunOnMainThread;
137 |
138 | /*!
139 | Any special handling of exceptions after they are thrown; By default logs stack trace to standard out.
140 | @param exception Exception
141 | */
142 | - (void)handleException:(NSException *)exception;
143 |
144 | /*!
145 | Log a message, which notifies the log delegate.
146 | This is not meant to be used directly, see GHTestLog(...) macro.
147 |
148 | @param message Message to log
149 | */
150 | - (void)log:(NSString *)message;
151 |
152 | @end
153 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTesting.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTesting.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 1/30/09.
6 | // Copyright 2008 Gabriel Handford
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | //! @cond DEV
31 |
32 | //
33 | // Portions of this file fall under the following license, marked with:
34 | // GTM_BEGIN : GTM_END
35 | //
36 | // Copyright 2008 Google Inc.
37 | //
38 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not
39 | // use this file except in compliance with the License. You may obtain a copy
40 | // of the License at
41 | //
42 | // http://www.apache.org/licenses/LICENSE-2.0
43 | //
44 | // Unless required by applicable law or agreed to in writing, software
45 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
46 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
47 | // License for the specific language governing permissions and limitations under
48 | // the License.
49 | //
50 |
51 | #import
52 | #import "GHUnit.h"
53 |
54 | #ifdef __cplusplus
55 | extern "C" NSString *GHUStackTraceFromException(NSException *e);
56 | #else
57 | extern NSString *GHUStackTraceFromException(NSException *e);
58 | #endif
59 |
60 | // GTM_BEGIN
61 | BOOL isTestFixtureOfClass(Class aClass, Class testCaseClass);
62 | // GTM_END
63 |
64 | /*!
65 | Utility test for loading and running tests.
66 |
67 | Much of this is borrowed from GTM/UnitTesting.
68 | */
69 | @interface GHTesting : NSObject {
70 |
71 | NSMutableArray/* of NSString*/ *testCaseClassNames_;
72 |
73 | }
74 |
75 | /*!
76 | The shared testing instance.
77 | */
78 | + (GHTesting *)sharedInstance;
79 |
80 | /*!
81 | Load all test classes that we can "see".
82 | @result Array of initialized (and autoreleased) test case classes in an autoreleased array.
83 | */
84 | - (NSArray *)loadAllTestCases;
85 |
86 | /*!
87 | Load tests from target.
88 | @param target Target
89 | @result Array of id
90 | */
91 | - (NSArray *)loadTestsFromTarget:(id)target;
92 |
93 | /*!
94 | See if class is of a registered test case class.
95 | @param aClass Class
96 | */
97 | - (BOOL)isTestCaseClass:(Class)aClass;
98 |
99 | /*!
100 | Register test case class.
101 | @param aClass Class
102 | */
103 | - (void)registerClass:(Class)aClass;
104 |
105 | /*!
106 | Register test case class by name.
107 | @param className Class name (via NSStringFromClass(aClass)
108 | */
109 | - (void)registerClassName:(NSString *)className;
110 |
111 | /*!
112 | Format test exception.
113 | @param exception Exception
114 | @result Description
115 | */
116 | + (NSString *)descriptionForException:(NSException *)exception;
117 |
118 | /*!
119 | Filename for cause of test exception.
120 | @param test Test
121 | @result Filename
122 | */
123 | + (NSString *)exceptionFilenameForTest:(id)test;
124 |
125 | /*!
126 | Line number for cause of test exception.
127 | @param test Test
128 | @result Line number
129 | */
130 | + (NSInteger)exceptionLineNumberForTest:(id)test;
131 |
132 | /*!
133 | Run test.
134 | @param target Target
135 | @param selector Selector
136 | @param exception Exception, if set, is retained and should be released by the caller.
137 | @param interval Time to run the test
138 | @param reraiseExceptions If YES, will re-raise exceptions
139 | */
140 | + (BOOL)runTestWithTarget:(id)target selector:(SEL)selector exception:(NSException **)exception
141 | interval:(NSTimeInterval *)interval reraiseExceptions:(BOOL)reraiseExceptions;
142 |
143 | /*!
144 | Same as normal runTest without catching exceptions.
145 | @param target Target
146 | @param selector Selector
147 | @param exception Exception, if set, is retained and should be released by the caller.
148 | @param interval Time to run the test
149 | */
150 | + (BOOL)runTestOrRaiseWithTarget:(id)target selector:(SEL)selector exception:(NSException **)exception interval:(NSTimeInterval *)interval;
151 |
152 | @end
153 |
154 | @protocol GHSenTestCase
155 | - (void)raiseAfterFailure;
156 | @end
157 |
158 | //! @endcond
159 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHAsyncTestCase.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHAsyncTestCase.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 4/8/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import "GHTestCase.h"
31 |
32 | /*!
33 | Common wait statuses to use with waitForStatus:timeout:.
34 | */
35 | enum {
36 | kGHUnitWaitStatusUnknown = 0, // Unknown wait status
37 | kGHUnitWaitStatusSuccess, // Wait status success
38 | kGHUnitWaitStatusFailure, // Wait status failure
39 | kGHUnitWaitStatusCancelled // Wait status cancelled
40 | };
41 |
42 | /*!
43 | Asynchronous test case with wait and notify.
44 |
45 | If notify occurs before wait has started (if it was a synchronous call), this test
46 | case will still work.
47 |
48 | Be sure to call prepare before the asynchronous method (otherwise an exception will raise).
49 |
50 | @interface MyAsyncTest : GHAsyncTestCase { }
51 | @end
52 |
53 | @implementation MyAsyncTest
54 |
55 | - (void)testSuccess {
56 | // Prepare for asynchronous call
57 | [self prepare];
58 |
59 | // Do asynchronous task here
60 | [self performSelector:@selector(_succeed) withObject:nil afterDelay:0.1];
61 |
62 | // Wait for notify
63 | [self waitForStatus:kGHUnitWaitStatusSuccess timeout:1.0];
64 | }
65 |
66 | - (void)_succeed {
67 | // Notify the wait. Notice the forSelector points to the test above.
68 | // This is so that stray notifies don't error or falsely succeed other tests.
69 | // To ignore the check, forSelector can be NULL.
70 | [self notify:kGHUnitWaitStatusSuccess forSelector:@selector(testSuccess)];
71 | }
72 |
73 | @end
74 |
75 | */
76 | @interface GHAsyncTestCase : GHTestCase {
77 |
78 | NSInteger waitForStatus_;
79 | NSInteger notifiedStatus_;
80 |
81 | BOOL prepared_; // Whether prepared was called before waitForStatus:timeout:
82 | NSRecursiveLock *lock_; // Lock to synchronize on
83 | SEL waitSelector_; // The selector we are waiting on
84 |
85 | NSArray *_runLoopModes;
86 | }
87 |
88 | /*!
89 | Run loop modes to run while waiting;
90 | Defaults to NSDefaultRunLoopMode, NSRunLoopCommonModes, NSConnectionReplyMode
91 | */
92 | @property (retain, nonatomic) NSArray *runLoopModes;
93 |
94 | /*!
95 | Prepare before calling the asynchronous method.
96 | */
97 | - (void)prepare;
98 |
99 | /*!
100 | Prepare and specify the selector we will use in notify.
101 |
102 | @param selector Selector
103 | */
104 | - (void)prepare:(SEL)selector;
105 |
106 | /*!
107 | Wait for notification of status or timeout.
108 |
109 | Be sure to prepare before calling your asynchronous method.
110 | For example,
111 |
112 | - (void)testFoo {
113 | [self prepare];
114 |
115 | // Do asynchronous task here
116 |
117 | [self waitForStatus:kGHUnitWaitStatusSuccess timeout:1.0];
118 | }
119 |
120 | @param status kGHUnitWaitStatusSuccess, kGHUnitWaitStatusFailure or custom status
121 | @param timeout Timeout in seconds
122 | */
123 | - (void)waitForStatus:(NSInteger)status timeout:(NSTimeInterval)timeout;
124 |
125 | /*!
126 | @param status kGHUnitWaitStatusSuccess, kGHUnitWaitStatusFailure or custom status
127 | @param timeout Timeout in seconds
128 | @deprecated Use waitForTimeout:
129 | */
130 | - (void)waitFor:(NSInteger)status timeout:(NSTimeInterval)timeout;
131 |
132 | /*!
133 | Wait for timeout to occur.
134 | Fails if we did _NOT_ timeout.
135 |
136 | @param timeout Timeout
137 | */
138 | - (void)waitForTimeout:(NSTimeInterval)timeout;
139 |
140 | /*!
141 | Notify waiting of status for test selector.
142 |
143 | @param status Status, for example, kGHUnitWaitStatusSuccess
144 | @param selector If not NULL, then will verify this selector is where we are waiting. This prevents stray asynchronous callbacks to fail a later test.
145 | */
146 | - (void)notify:(NSInteger)status forSelector:(SEL)selector;
147 |
148 | /*!
149 | Notify waiting of status for any selector.
150 |
151 | @param status Status, for example, kGHUnitWaitStatusSuccess
152 | */
153 | - (void)notify:(NSInteger)status;
154 |
155 | /*!
156 | Run the run loops for the specified interval.
157 |
158 | @param interval Interval
159 | @author Adapted from Robert Palmer, pauseForTimeout
160 | */
161 | - (void)runForInterval:(NSTimeInterval)interval;
162 |
163 | @end
164 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestViewModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTest.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 1/17/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | //! @cond DEV
31 |
32 | #import "GHTestGroup.h"
33 | #import "GHTestSuite.h"
34 | #import "GHTestRunner.h"
35 |
36 | @class GHTestNode;
37 |
38 | @protocol GHTestNodeDelegate
39 | - (void)testNodeDidChange:(GHTestNode *)node;
40 | @end
41 |
42 | typedef enum {
43 | GHTestNodeFilterNone = 0,
44 | GHTestNodeFilterFailed = 1
45 | } GHTestNodeFilter;
46 |
47 | /*!
48 | Test view model for use in a tree view.
49 | */
50 | @interface GHTestViewModel : NSObject {
51 |
52 | NSString *identifier_;
53 | GHTestSuite *suite_;
54 | GHTestNode *root_;
55 |
56 | GHTestRunner *runner_;
57 |
58 | NSMutableDictionary *map_; // id#identifier -> GHTestNode
59 |
60 | BOOL editing_;
61 |
62 | NSMutableDictionary *defaults_;
63 | }
64 |
65 | @property (readonly, nonatomic) GHTestNode *root;
66 | @property (assign, nonatomic, getter=isEditing) BOOL editing;
67 |
68 | /*!
69 | Create view model with root test group node.
70 |
71 | @param identifier Unique identifier for test model (used to load defaults)
72 | @param suite Suite
73 | */
74 | - (id)initWithIdentifier:(NSString *)identifier suite:(GHTestSuite *)suite;
75 |
76 | /*!
77 | @result Name of test suite.
78 | */
79 | - (NSString *)name;
80 |
81 | /*!
82 | Status description.
83 |
84 | @param prefix Prefix to append
85 | @result Current status string
86 | */
87 | - (NSString *)statusString:(NSString *)prefix;
88 |
89 | /*!
90 | Find the test node from the test.
91 |
92 | @param test Find test
93 | */
94 | - (GHTestNode *)findTestNodeForTest:(id)test;
95 |
96 | /*!
97 | Find the first failure.
98 |
99 | @result The first failure
100 | */
101 | - (GHTestNode *)findFailure;
102 |
103 | /*!
104 | Find the next failure starting from node.
105 |
106 | @param node Node to start from
107 | */
108 | - (GHTestNode *)findFailureFromNode:(GHTestNode *)node;
109 |
110 | /*!
111 | Register node, so that we can do a lookup later. See findTestNodeForTest:.
112 |
113 | @param node Node to register
114 | */
115 | - (void)registerNode:(GHTestNode *)node;
116 |
117 | /*!
118 | @result Returns the number of test groups.
119 | */
120 | - (NSInteger)numberOfGroups;
121 |
122 | /*!
123 | Returns the number of tests in group.
124 | @param group Group number
125 | @result The number of tests in group.
126 | */
127 | - (NSInteger)numberOfTestsInGroup:(NSInteger)group;
128 |
129 | /*!
130 | Search for path to test.
131 | @param test Test
132 | @result Index path
133 | */
134 | - (NSIndexPath *)indexPathToTest:(id)test;
135 |
136 | /*!
137 | Load defaults (user settings saved with saveDefaults).
138 | */
139 | - (void)loadDefaults;
140 |
141 | /*!
142 | Save defaults (user settings to be loaded with loadDefaults).
143 | */
144 | - (void)saveDefaults;
145 |
146 | /*!
147 | Run with current test suite.
148 |
149 | @param delegate Callback
150 | @param inParallel If YES, will run tests in operation queue
151 | @param options Options
152 | */
153 | - (void)run:(id)delegate inParallel:(BOOL)inParallel options:(GHTestOptions)options;
154 |
155 | /*!
156 | Cancel test run.
157 | */
158 | - (void)cancel;
159 |
160 | /*!
161 | Check if running.
162 |
163 | @result YES if running.
164 | */
165 | - (BOOL)isRunning;
166 |
167 | @end
168 |
169 |
170 | @interface GHTestNode : NSObject {
171 |
172 | id test_;
173 | NSMutableArray */*of GHTestNode*/children_;
174 | NSMutableArray */* of GHTestNode*/filteredChildren_;
175 |
176 | id delegate_;
177 | GHTestNodeFilter filter_;
178 | NSString *textFilter_;
179 | }
180 |
181 | @property (readonly, nonatomic) NSArray */* of GHTestNode*/children;
182 | @property (readonly, nonatomic) id test;
183 | @property (assign, nonatomic) id delegate;
184 | @property (assign, nonatomic) GHTestNodeFilter filter;
185 | @property (retain, nonatomic) NSString *textFilter;
186 |
187 | - (id)initWithTest:(id)test children:(NSArray */*of id*/)children source:(GHTestViewModel *)source;
188 | + (GHTestNode *)nodeWithTest:(id)test children:(NSArray */*of id*/)children source:(GHTestViewModel *)source;
189 |
190 | - (NSString *)identifier;
191 | - (NSString *)name;
192 | - (NSString *)nameWithStatus;
193 |
194 | - (GHTestStatus)status;
195 | - (NSString *)statusString;
196 | - (NSString *)stackTrace;
197 | - (NSString *)exceptionFilename;
198 | - (NSInteger)exceptionLineNumber;
199 | - (NSString *)log;
200 | - (BOOL)isRunning;
201 | - (BOOL)isDisabled;
202 | - (BOOL)isHidden;
203 | - (BOOL)isEnded;
204 | - (BOOL)isGroupTest; // YES if test has "sub tests"
205 |
206 | - (BOOL)isSelected;
207 | - (void)setSelected:(BOOL)selected;
208 |
209 | - (BOOL)hasChildren;
210 | - (BOOL)failed;
211 |
212 | - (void)notifyChanged;
213 |
214 | - (void)setFilter:(GHTestNodeFilter)filter textFilter:(NSString *)textFilter;
215 |
216 | @end
217 |
218 | //! @endcond
219 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestGroup.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTestGroup.h
3 | //
4 | // Created by Gabriel Handford on 1/16/09.
5 | // Copyright 2009. All rights reserved.
6 | //
7 | // Permission is hereby granted, free of charge, to any person
8 | // obtaining a copy of this software and associated documentation
9 | // files (the "Software"), to deal in the Software without
10 | // restriction, including without limitation the rights to use,
11 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the
13 | // Software is furnished to do so, subject to the following
14 | // conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be
17 | // included in all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 | // OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 |
29 | //! @cond DEV
30 |
31 | #import "GHTest.h"
32 | #import "GHTestCase.h"
33 |
34 | /*!
35 | Interface for a group of tests.
36 |
37 | This group conforms to the GHTest protocol as well (see Composite pattern).
38 | */
39 | @protocol GHTestGroup
40 |
41 | /*!
42 | Name.
43 | */
44 | - (NSString *)name;
45 |
46 | /*!
47 | Parent for test group.
48 | */
49 | - (id)parent;
50 |
51 | /*!
52 | Children for test group.
53 | */
54 | - (NSArray *)children;
55 |
56 | @end
57 |
58 | /*!
59 | A collection of tests (or test groups).
60 |
61 | A test group is a collection of `id`, that may represent a set of test case methods.
62 |
63 | For example, if you had the following GHTestCase.
64 |
65 | @interface FooTest : GHTestCase {}
66 | - (void)testFoo;
67 | - (void)testBar;
68 | @end
69 |
70 | The GHTestGroup would consist of and array of GHTest: FooTest#testFoo, FooTest#testBar,
71 | each test being a target and selector pair.
72 |
73 | A test group may also consist of a group of groups (since GHTestGroup conforms to GHTest),
74 | and this might represent a GHTestSuite.
75 | */
76 | @interface GHTestGroup : NSObject {
77 |
78 | NSObject *delegate_; // weak
79 | id parent_; // weak
80 |
81 | NSMutableArray */*of id*/children_;
82 |
83 | NSString *name_; // The name of the test group (usually the class name of the test case
84 | NSTimeInterval interval_; // Total time of child tests
85 | GHTestStatus status_; // Current status of the group (current status of running or completed child tests)
86 | GHTestStats stats_; // Current stats for the group (aggregate of child test stats)
87 |
88 | BOOL didSetUpClass_;
89 |
90 | GHTestOptions options_;
91 |
92 | // Set if test is created from initWithTestCase:delegate:
93 | // Allows use to perform setUpClass and tearDownClass (once per test case run)
94 | id testCase_;
95 |
96 | NSException *exception_; // If exception happens in group setUpClass/tearDownClass
97 | }
98 |
99 | @property (readonly, nonatomic) NSArray */*of id*/children;
100 | @property (assign, nonatomic) id parent;
101 | @property (readonly, nonatomic) id testCase;
102 | @property (assign, nonatomic) GHTestOptions options;
103 |
104 | /*!
105 | Create an empty test group.
106 | @param name The name of the test group
107 | @param delegate Delegate, notifies of test start and end
108 | @result New test group
109 | */
110 | - (id)initWithName:(NSString *)name delegate:(id)delegate;
111 |
112 | /*!
113 | Create test group from a test case.
114 | @param testCase Test case, could be a subclass of SenTestCase or GHTestCase
115 | @param delegate Delegate, notifies of test start and end
116 | @result New test group
117 | */
118 | - (id)initWithTestCase:(id)testCase delegate:(id)delegate;
119 |
120 | /*!
121 | Create test group from a single test.
122 | @param testCase Test case, could be a subclass of SenTestCase or GHTestCase
123 | @param selector Test to run
124 | @param delegate Delegate, notifies of test start and end
125 | */
126 | - (id)initWithTestCase:(id)testCase selector:(SEL)selector delegate:(id)delegate;
127 |
128 | /*!
129 | Create test group from a test case.
130 | @param testCase Test case, could be a subclass of SenTestCase or GHTestCase
131 | @param delegate Delegate, notifies of test start and end
132 | @result New test group
133 | */
134 | + (GHTestGroup *)testGroupFromTestCase:(id)testCase delegate:(id)delegate;
135 |
136 | /*!
137 | Add a test case (or test group) to this test group.
138 | @param testCase Test case, could be a subclass of SenTestCase or GHTestCase
139 | */
140 | - (void)addTestCase:(id)testCase;
141 |
142 | /*!
143 | Add a test group to this test group.
144 | @param testGroup Test group to add
145 | */
146 | - (void)addTestGroup:(GHTestGroup *)testGroup;
147 |
148 | /*!
149 | Add tests to this group.
150 | @param tests Tests to add
151 | */
152 | - (void)addTests:(NSArray */*of id*/)tests;
153 |
154 | /*!
155 | Add test to this group.
156 | @param test Test to add
157 | */
158 | - (void)addTest:(id)test;
159 |
160 | /*!
161 | Whether the test group should run on the main thread.
162 | Call passes to test case instance if enabled.
163 | */
164 | - (BOOL)shouldRunOnMainThread;
165 |
166 | /*!
167 | @result YES if we have any enabled chilren, NO if all children have been disabled.
168 | */
169 | - (BOOL)hasEnabledChildren;
170 |
171 | /*!
172 | Get list of failed tests.
173 | @result Failed tests
174 | */
175 | - (NSArray */*of id*/)failedTests;
176 |
177 | /*!
178 | Run in operation queue.
179 | Tests from the group are added and will block until they have completed.
180 | @param operationQueue If nil, then runs as is
181 | @param options Options
182 | */
183 | - (void)runInOperationQueue:(NSOperationQueue *)operationQueue options:(GHTestOptions)options;
184 |
185 | @end
186 |
187 | //! @endcond
188 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestRunner.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTestRunner.h
3 | //
4 | // Created by Gabriel Handford on 1/16/09.
5 | // Copyright 2008 Gabriel Handford
6 | //
7 | // Permission is hereby granted, free of charge, to any person
8 | // obtaining a copy of this software and associated documentation
9 | // files (the "Software"), to deal in the Software without
10 | // restriction, including without limitation the rights to use,
11 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the
13 | // Software is furnished to do so, subject to the following
14 | // conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be
17 | // included in all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 | // OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 |
29 | //! @cond DEV
30 |
31 | //
32 | // Portions of this file fall under the following license, marked with:
33 | // GTM_BEGIN : GTM_END
34 | //
35 | // Copyright 2008 Google Inc.
36 | //
37 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not
38 | // use this file except in compliance with the License. You may obtain a copy
39 | // of the License at
40 | //
41 | // http://www.apache.org/licenses/LICENSE-2.0
42 | //
43 | // Unless required by applicable law or agreed to in writing, software
44 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
45 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
46 | // License for the specific language governing permissions and limitations under
47 | // the License.
48 | //
49 |
50 | #import "GHTestGroup.h"
51 | #import "GHTestSuite.h"
52 |
53 | @class GHTestRunner;
54 |
55 | /*!
56 | Notifies about the test run.
57 | Delegates can be guaranteed to be notified on the main thread.
58 | */
59 | @protocol GHTestRunnerDelegate
60 | @optional
61 |
62 | /*!
63 | Test run started.
64 | @param runner Runner
65 | */
66 | - (void)testRunnerDidStart:(GHTestRunner *)runner;
67 |
68 | /*!
69 | Test run did start test.
70 | @param runner Runner
71 | @param test Test
72 | */
73 | - (void)testRunner:(GHTestRunner *)runner didStartTest:(id)test;
74 |
75 | /*!
76 | Test run did update test.
77 | @param runner Runner
78 | @param test Test
79 | */
80 | - (void)testRunner:(GHTestRunner *)runner didUpdateTest:(id)test;
81 |
82 | /*!
83 | Test run did end test.
84 | @param runner Runner
85 | @param test Test
86 | */
87 | - (void)testRunner:(GHTestRunner *)runner didEndTest:(id)test;
88 |
89 | /*!
90 | Test run did cancel.
91 | @param runner Runner
92 | */
93 | - (void)testRunnerDidCancel:(GHTestRunner *)runner;
94 |
95 | /*!
96 | Test run did end.
97 | @param runner Runner
98 | */
99 | - (void)testRunnerDidEnd:(GHTestRunner *)runner;
100 |
101 | /*!
102 | Test run did log message.
103 | @param runner Runner
104 | @param didLog Message
105 | */
106 | - (void)testRunner:(GHTestRunner *)runner didLog:(NSString *)didLog;
107 |
108 | /*!
109 | Test run test did log message.
110 | @param runner Runner
111 | @param test Test
112 | @param didLog Message
113 | */
114 | - (void)testRunner:(GHTestRunner *)runner test:(id)test didLog:(NSString *)didLog;
115 |
116 | @end
117 |
118 | /*!
119 | Runs the tests.
120 | Tests are run a separate thread though delegates are called on the main thread by default.
121 |
122 | For example,
123 |
124 | GHTestRunner *runner = [[GHTestRunner alloc] initWithTest:suite];
125 | runner.delegate = self;
126 | [runner runTests];
127 |
128 | */
129 | @interface GHTestRunner : NSObject {
130 |
131 | id test_; // The test to run; Could be a GHTestGroup (suite), GHTestGroup (test case), or GHTest (target/selector)
132 |
133 | NSObject *delegate_; // weak
134 |
135 | GHTestOptions options_;
136 |
137 | BOOL running_;
138 | BOOL cancelling_;
139 |
140 | NSTimeInterval startInterval_;
141 |
142 | NSOperationQueue *operationQueue_; //! If running a suite in operation queue
143 | }
144 |
145 | @property (retain) id test;
146 | @property (assign) NSObject *delegate;
147 | @property (assign) GHTestOptions options;
148 | @property (readonly) GHTestStats stats;
149 | @property (readonly, getter=isRunning) BOOL running;
150 | @property (readonly, getter=isCancelling) BOOL cancelling;
151 | @property (readonly) NSTimeInterval interval;
152 | @property (retain, nonatomic) NSOperationQueue *operationQueue;
153 | @property (assign, nonatomic, getter=isInParallel) BOOL inParallel;
154 |
155 | /*!
156 | Create runner for test.
157 | @param test Test
158 | */
159 | - (id)initWithTest:(id)test;
160 |
161 | /*!
162 | Create runner for all tests.
163 | @see [GHTesting loadAllTestCases].
164 | @result Runner
165 | */
166 | + (GHTestRunner *)runnerForAllTests;
167 |
168 | /*!
169 | Create runner for test suite.
170 | @param suite Suite
171 | @result Runner
172 | */
173 | + (GHTestRunner *)runnerForSuite:(GHTestSuite *)suite;
174 |
175 | /*!
176 | Create runner for class and method.
177 | @param testClassName Test class name
178 | @param methodName Test method
179 | @result Runner
180 | */
181 | + (GHTestRunner *)runnerForTestClassName:(NSString *)testClassName methodName:(NSString *)methodName;
182 |
183 | /*!
184 | Get the runner from the environment.
185 | If the TEST env is set, then we will only run that test case or test method.
186 | */
187 | + (GHTestRunner *)runnerFromEnv;
188 |
189 | /*!
190 | Run the test runner. Usually called from the test main.
191 | Reads the TEST environment variable and filters on that; or all tests are run.
192 | @result 0 is success, otherwise the failure count
193 | */
194 | + (int)run;
195 |
196 | /*!
197 | Run in the background.
198 | */
199 | - (void)runInBackground;
200 |
201 | /*!
202 | Start the test runner.
203 | @result 0 is success, otherwise the failure count
204 | */
205 | - (int)runTests;
206 |
207 | /*!
208 | Cancel test run.
209 | */
210 | - (void)cancel;
211 |
212 | /*!
213 | Write message to console.
214 | @param message Message to log
215 | */
216 | - (void)log:(NSString *)message;
217 |
218 | @end
219 |
220 | //! @endcond
221 |
222 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTest.h
3 | // GHUnit
4 | //
5 | // Created by Gabriel Handford on 1/18/09.
6 | // Copyright 2009. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import
31 |
32 |
33 | /*!
34 | Test status.
35 | */
36 | typedef enum {
37 | GHTestStatusNone = 0,
38 | GHTestStatusRunning, //! Test is running
39 | GHTestStatusCancelling, //! Test is being cancelled
40 | GHTestStatusCancelled, //! Test was cancelled
41 | GHTestStatusSucceeded, //! Test finished and succeeded
42 | GHTestStatusErrored, //! Test finished and errored
43 | } GHTestStatus;
44 |
45 | enum {
46 | GHTestOptionReraiseExceptions = 1 << 0, // Allows exceptions to be raised (so you can trigger the debugger)
47 | GHTestOptionForceSetUpTearDownClass = 1 << 1, // Runs setUpClass/tearDownClass for this (each) test; Used when re-running a single test in a group
48 | };
49 | typedef NSInteger GHTestOptions;
50 |
51 | /*!
52 | Generate string from GHTestStatus
53 | @param status
54 | */
55 | extern NSString* NSStringFromGHTestStatus(GHTestStatus status);
56 |
57 | /*!
58 | Check if test is running (or trying to cancel).
59 | */
60 | extern BOOL GHTestStatusIsRunning(GHTestStatus status);
61 |
62 | /*!
63 | Check if test has succeeded, errored or cancelled.
64 | */
65 | extern BOOL GHTestStatusEnded(GHTestStatus status);
66 |
67 | /*!
68 | Test stats.
69 | */
70 | typedef struct {
71 | NSInteger succeedCount; // Number of succeeded tests
72 | NSInteger failureCount; // Number of failed tests
73 | NSInteger cancelCount; // Number of aborted tests
74 | NSInteger testCount; // Total number of tests
75 | } GHTestStats;
76 |
77 | /*!
78 | Create GHTestStats.
79 | */
80 | extern GHTestStats GHTestStatsMake(NSInteger succeedCount, NSInteger failureCount, NSInteger cancelCount, NSInteger testCount);
81 |
82 | extern const GHTestStats GHTestStatsEmpty;
83 |
84 | /*!
85 | Description from test stats.
86 | */
87 | extern NSString *NSStringFromGHTestStats(GHTestStats stats);
88 |
89 | @protocol GHTestDelegate;
90 |
91 | /*!
92 | The base interface for a runnable test.
93 |
94 | A runnable with a unique identifier, display name, stats, timer, delegate, log and error handling.
95 | */
96 | @protocol GHTest
97 |
98 | /*!
99 | Unique identifier for test.
100 | */
101 | @property (readonly, nonatomic) NSString *identifier;
102 |
103 | /*!
104 | Name (readable) for test.
105 | */
106 | @property (readonly, nonatomic) NSString *name;
107 |
108 | /*!
109 | How long the test took to run. Defaults to -1, if not run.
110 | */
111 | @property (assign, nonatomic) NSTimeInterval interval;
112 |
113 | /*!
114 | Test status.
115 | */
116 | @property (assign, nonatomic) GHTestStatus status;
117 |
118 | /*!
119 | Test stats.
120 | */
121 | @property (readonly, nonatomic) GHTestStats stats;
122 |
123 | /*!
124 | Exception that occurred.
125 | */
126 | @property (retain, nonatomic) NSException *exception;
127 |
128 | /*!
129 | Whether test is disabled.
130 | */
131 | @property (assign, nonatomic, getter=isDisabled) BOOL disabled;
132 |
133 | /*!
134 | Whether test is hidden.
135 | */
136 | @property (assign, nonatomic, getter=isHidden) BOOL hidden;
137 |
138 | /*!
139 | Delegate for test.
140 | */
141 | @property (assign, nonatomic) id delegate; // weak
142 |
143 | /*!
144 | Run the test.
145 | @param options Options
146 | */
147 | - (void)run:(GHTestOptions)options;
148 |
149 | /*!
150 | @result Messages logged during this test run
151 | */
152 | - (NSArray *)log;
153 |
154 | /*!
155 | Reset the test.
156 | */
157 | - (void)reset;
158 |
159 | /*!
160 | Cancel the test.
161 | */
162 | - (void)cancel;
163 |
164 | /*!
165 | @result The number of disabled tests
166 | */
167 | - (NSInteger)disabledCount;
168 |
169 | @end
170 |
171 | /*!
172 | Test delegate for notification when a test starts and ends.
173 | */
174 | @protocol GHTestDelegate
175 |
176 | /*!
177 | Test started.
178 | @param test Test
179 | @param source If tests are nested, than source corresponds to the originator of the delegate call
180 | */
181 | - (void)testDidStart:(id)test source:(id)source;
182 |
183 | /*!
184 | Test updated.
185 | @param test Test
186 | @param source If tests are nested, than source corresponds to the originator of the delegate call
187 | */
188 | - (void)testDidUpdate:(id)test source:(id)source;
189 |
190 | /*!
191 | Test ended.
192 | @param test Test
193 | @param source If tests are nested, than source corresponds to the originator of the delegate call
194 | */
195 | - (void)testDidEnd:(id)test source:(id)source;
196 |
197 | /*!
198 | Test logged a message.
199 | @param test Test
200 | @param didLog Message
201 | @param source If tests are nested, than source corresponds to the originator of the delegate call
202 | */
203 | - (void)test:(id)test didLog:(NSString *)didLog source:(id)source;
204 |
205 | @end
206 |
207 | /*!
208 | Delegate which is notified of log messages from inside a test case.
209 | */
210 | @protocol GHTestCaseLogWriter
211 |
212 | /*!
213 | Log message.
214 | @param message Message
215 | @param testCase Test case
216 | */
217 | - (void)log:(NSString *)message testCase:(id)testCase;
218 |
219 | @end
220 |
221 | /*!
222 | Default test implementation with a target/selector pair.
223 |
224 | - Tests a target and selector
225 | - Notifies a test delegate
226 | - Keeps track of status, running time and failures
227 | - Stores any test specific logging
228 |
229 | */
230 | @interface GHTest : NSObject {
231 |
232 | NSObject *delegate_; // weak
233 |
234 | id target_;
235 | SEL selector_;
236 |
237 | NSString *identifier_;
238 | NSString *name_;
239 | GHTestStatus status_;
240 | NSTimeInterval interval_;
241 | BOOL disabled_;
242 | BOOL hidden_;
243 | NSException *exception_; // If failed
244 |
245 | NSMutableArray *log_;
246 |
247 | }
248 |
249 | @property (readonly, nonatomic) id target;
250 | @property (readonly, nonatomic) SEL selector;
251 | @property (readonly, nonatomic) NSArray *log;
252 |
253 | /*!
254 | Create test with identifier, name.
255 | @param identifier Unique identifier
256 | @param name Name
257 | */
258 | - (id)initWithIdentifier:(NSString *)identifier name:(NSString *)name;
259 |
260 | /*!
261 | Create test with target/selector.
262 | @param target Target (usually a test case)
263 | @param selector Selector (usually a test method)
264 | */
265 | - (id)initWithTarget:(id)target selector:(SEL)selector;
266 |
267 | /*!
268 | Create autoreleased test with target/selector.
269 | @param target Target (usually a test case)
270 | @param selector Selector (usually a test method)
271 | */
272 | + (id)testWithTarget:(id)target selector:(SEL)selector;
273 |
274 | @end
275 |
--------------------------------------------------------------------------------
/ios-demo/iPad/en.lproj/MainWindow_iPad.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1024
5 | 10D573
6 | 786
7 | 1038.29
8 | 460.00
9 |
13 |
17 |
21 |
30 |
31 | YES
32 |
33 | IBFilesOwner
34 | IBIPadFramework
35 |
36 |
37 | IBFirstResponder
38 | IBIPadFramework
39 |
40 |
41 |
42 | 292
43 |
44 | YES
45 |
46 |
47 | 301
48 | {{284, 501}, {200, 22}}
49 |
50 | NO
51 | YES
52 | 7
53 | NO
54 | IBIPadFramework
55 | My Universal App on iPad
56 |
57 | 1
58 | MCAwIDAAA
59 |
60 |
61 | 1
62 | 10
63 |
64 |
65 | {768, 1024}
66 |
67 |
68 | 1
69 | MSAxIDEAA
70 |
71 | NO
72 | NO
73 |
74 | 2
75 |
76 | IBIPadFramework
77 | YES
78 |
79 |
80 | IBIPadFramework
81 |
82 |
83 |
84 |
85 | YES
86 |
87 |
88 | window
89 |
90 |
91 |
92 | 7
93 |
94 |
95 |
96 | delegate
97 |
98 |
99 |
100 | 8
101 |
102 |
103 |
104 |
105 | YES
106 |
107 | 0
108 |
109 |
110 |
111 |
112 |
113 | -1
114 |
115 |
116 | File's Owner
117 |
118 |
119 | -2
120 |
121 |
122 |
123 |
124 | 2
125 |
126 |
127 | YES
128 |
129 |
130 |
131 |
132 |
133 | 6
134 |
135 |
136 |
137 |
138 | 11
139 |
140 |
141 |
142 |
143 |
144 |
145 | YES
146 |
147 | YES
148 | -1.CustomClassName
149 | -2.CustomClassName
150 | 11.IBPluginDependency
151 | 2.IBEditorWindowLastContentRect
152 | 2.IBPluginDependency
153 | 6.CustomClassName
154 | 6.IBPluginDependency
155 |
156 |
157 | YES
158 | UIApplication
159 | UIResponder
160 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
161 | {{202, 84}, {783, 772}}
162 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
163 | ios_demoAppDelegate_iPad
164 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
165 |
166 |
167 |
168 | YES
169 |
170 |
171 | YES
172 |
173 |
174 |
175 |
176 | YES
177 |
178 |
179 | YES
180 |
181 |
182 |
183 | 11
184 |
185 |
186 |
187 | YES
188 |
189 | ios_demoAppDelegate
190 | NSObject
191 |
192 | window
193 | UIWindow
194 |
195 |
196 | window
197 |
198 | window
199 | UIWindow
200 |
201 |
202 |
203 | IBProjectSource
204 | Shared/ios_demoAppDelegate.h
205 |
206 |
207 |
208 | ios_demoAppDelegate_iPad
209 | ios_demoAppDelegate
210 |
211 | IBProjectSource
212 | iPad/ios_demoAppDelegate_iPad.h
213 |
214 |
215 |
216 |
217 | YES
218 |
219 | NSObject
220 |
221 | IBFrameworkSource
222 | Foundation.framework/Headers/NSError.h
223 |
224 |
225 |
226 | NSObject
227 |
228 | IBFrameworkSource
229 | Foundation.framework/Headers/NSFileManager.h
230 |
231 |
232 |
233 | NSObject
234 |
235 | IBFrameworkSource
236 | Foundation.framework/Headers/NSKeyValueCoding.h
237 |
238 |
239 |
240 | NSObject
241 |
242 | IBFrameworkSource
243 | Foundation.framework/Headers/NSKeyValueObserving.h
244 |
245 |
246 |
247 | NSObject
248 |
249 | IBFrameworkSource
250 | Foundation.framework/Headers/NSKeyedArchiver.h
251 |
252 |
253 |
254 | NSObject
255 |
256 | IBFrameworkSource
257 | Foundation.framework/Headers/NSObject.h
258 |
259 |
260 |
261 | NSObject
262 |
263 | IBFrameworkSource
264 | Foundation.framework/Headers/NSRunLoop.h
265 |
266 |
267 |
268 | NSObject
269 |
270 | IBFrameworkSource
271 | Foundation.framework/Headers/NSThread.h
272 |
273 |
274 |
275 | NSObject
276 |
277 | IBFrameworkSource
278 | Foundation.framework/Headers/NSURL.h
279 |
280 |
281 |
282 | NSObject
283 |
284 | IBFrameworkSource
285 | Foundation.framework/Headers/NSURLConnection.h
286 |
287 |
288 |
289 | NSObject
290 |
291 | IBFrameworkSource
292 | UIKit.framework/Headers/UIAccessibility.h
293 |
294 |
295 |
296 | NSObject
297 |
298 | IBFrameworkSource
299 | UIKit.framework/Headers/UINibLoading.h
300 |
301 |
302 |
303 | NSObject
304 |
305 | IBFrameworkSource
306 | UIKit.framework/Headers/UIResponder.h
307 |
308 |
309 |
310 | UIApplication
311 | UIResponder
312 |
313 | IBFrameworkSource
314 | UIKit.framework/Headers/UIApplication.h
315 |
316 |
317 |
318 | UIResponder
319 | NSObject
320 |
321 |
322 |
323 | UIView
324 |
325 | IBFrameworkSource
326 | UIKit.framework/Headers/UITextField.h
327 |
328 |
329 |
330 | UIView
331 | UIResponder
332 |
333 | IBFrameworkSource
334 | UIKit.framework/Headers/UIView.h
335 |
336 |
337 |
338 | UIWindow
339 | UIView
340 |
341 | IBFrameworkSource
342 | UIKit.framework/Headers/UIWindow.h
343 |
344 |
345 |
346 |
347 | 0
348 | IBIPadFramework
349 |
350 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
351 |
352 |
353 |
354 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
355 |
356 |
357 | YES
358 | ../ios-demo.xcodeproj
359 | 3
360 | 112
361 |
362 |
363 |
--------------------------------------------------------------------------------
/ios-demo/iPhone/en.lproj/MainWindow_iPhone.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1024
5 | 10D573
6 | 786
7 | 1038.29
8 | 460.00
9 |
10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
11 | 112
12 |
13 |
14 | YES
15 |
16 |
17 |
18 | YES
19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
20 |
21 |
22 | YES
23 |
24 | YES
25 |
26 |
27 | YES
28 |
29 |
30 |
31 | YES
32 |
33 | IBFilesOwner
34 | IBCocoaTouchFramework
35 |
36 |
37 | IBFirstResponder
38 | IBCocoaTouchFramework
39 |
40 |
41 | IBCocoaTouchFramework
42 |
43 |
44 |
45 | 1316
46 |
47 | YES
48 |
49 |
50 | 1325
51 | {{51, 229}, {218, 22}}
52 |
53 | NO
54 | YES
55 | 7
56 | NO
57 | IBCocoaTouchFramework
58 | My Universal App on iPhone
59 |
60 | 1
61 | MCAwIDAAA
62 |
63 |
64 | 1
65 | 10
66 |
67 |
68 |
69 | {320, 480}
70 |
71 |
72 | 1
73 | MSAxIDEAA
74 |
75 | NO
76 | NO
77 |
78 | IBCocoaTouchFramework
79 | YES
80 |
81 |
82 |
83 |
84 | YES
85 |
86 |
87 | delegate
88 |
89 |
90 |
91 | 5
92 |
93 |
94 |
95 | window
96 |
97 |
98 |
99 | 6
100 |
101 |
102 |
103 |
104 | YES
105 |
106 | 0
107 |
108 |
109 |
110 |
111 |
112 | 2
113 |
114 |
115 | YES
116 |
117 |
118 |
119 |
120 |
121 | -1
122 |
123 |
124 | File's Owner
125 |
126 |
127 | 4
128 |
129 |
130 | App Delegate
131 |
132 |
133 | -2
134 |
135 |
136 |
137 |
138 | 8
139 |
140 |
141 |
142 |
143 |
144 |
145 | YES
146 |
147 | YES
148 | -1.CustomClassName
149 | -2.CustomClassName
150 | 2.IBAttributePlaceholdersKey
151 | 2.IBEditorWindowLastContentRect
152 | 2.IBPluginDependency
153 | 2.UIWindow.visibleAtLaunch
154 | 4.CustomClassName
155 | 4.IBPluginDependency
156 | 8.IBPluginDependency
157 |
158 |
159 | YES
160 | UIApplication
161 | UIResponder
162 |
163 | YES
164 |
165 |
166 | YES
167 |
168 |
169 | {{520, 376}, {320, 480}}
170 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
171 |
172 | ios_demoAppDelegate_iPhone
173 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
174 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
175 |
176 |
177 |
178 | YES
179 |
180 |
181 | YES
182 |
183 |
184 |
185 |
186 | YES
187 |
188 |
189 | YES
190 |
191 |
192 |
193 | 8
194 |
195 |
196 |
197 | YES
198 |
199 | ios_demoAppDelegate
200 | NSObject
201 |
202 | window
203 | UIWindow
204 |
205 |
206 | window
207 |
208 | window
209 | UIWindow
210 |
211 |
212 |
213 | IBProjectSource
214 | Shared/ios_demoAppDelegate.h
215 |
216 |
217 |
218 | ios_demoAppDelegate_iPhone
219 | ios_demoAppDelegate
220 |
221 | IBProjectSource
222 | iPhone/ios_demoAppDelegate_iPhone.h
223 |
224 |
225 |
226 |
227 | YES
228 |
229 | NSObject
230 |
231 | IBFrameworkSource
232 | Foundation.framework/Headers/NSError.h
233 |
234 |
235 |
236 | NSObject
237 |
238 | IBFrameworkSource
239 | Foundation.framework/Headers/NSFileManager.h
240 |
241 |
242 |
243 | NSObject
244 |
245 | IBFrameworkSource
246 | Foundation.framework/Headers/NSKeyValueCoding.h
247 |
248 |
249 |
250 | NSObject
251 |
252 | IBFrameworkSource
253 | Foundation.framework/Headers/NSKeyValueObserving.h
254 |
255 |
256 |
257 | NSObject
258 |
259 | IBFrameworkSource
260 | Foundation.framework/Headers/NSKeyedArchiver.h
261 |
262 |
263 |
264 | NSObject
265 |
266 | IBFrameworkSource
267 | Foundation.framework/Headers/NSObject.h
268 |
269 |
270 |
271 | NSObject
272 |
273 | IBFrameworkSource
274 | Foundation.framework/Headers/NSRunLoop.h
275 |
276 |
277 |
278 | NSObject
279 |
280 | IBFrameworkSource
281 | Foundation.framework/Headers/NSThread.h
282 |
283 |
284 |
285 | NSObject
286 |
287 | IBFrameworkSource
288 | Foundation.framework/Headers/NSURL.h
289 |
290 |
291 |
292 | NSObject
293 |
294 | IBFrameworkSource
295 | Foundation.framework/Headers/NSURLConnection.h
296 |
297 |
298 |
299 | NSObject
300 |
301 | IBFrameworkSource
302 | UIKit.framework/Headers/UIAccessibility.h
303 |
304 |
305 |
306 | NSObject
307 |
308 | IBFrameworkSource
309 | UIKit.framework/Headers/UINibLoading.h
310 |
311 |
312 |
313 | NSObject
314 |
315 | IBFrameworkSource
316 | UIKit.framework/Headers/UIResponder.h
317 |
318 |
319 |
320 | UIApplication
321 | UIResponder
322 |
323 | IBFrameworkSource
324 | UIKit.framework/Headers/UIApplication.h
325 |
326 |
327 |
328 | UIResponder
329 | NSObject
330 |
331 |
332 |
333 | UIView
334 |
335 | IBFrameworkSource
336 | UIKit.framework/Headers/UITextField.h
337 |
338 |
339 |
340 | UIView
341 | UIResponder
342 |
343 | IBFrameworkSource
344 | UIKit.framework/Headers/UIView.h
345 |
346 |
347 |
348 | UIWindow
349 | UIView
350 |
351 | IBFrameworkSource
352 | UIKit.framework/Headers/UIWindow.h
353 |
354 |
355 |
356 |
357 | 0
358 | IBCocoaTouchFramework
359 |
360 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
361 |
362 |
363 |
364 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
365 |
366 |
367 | YES
368 | ../ios-demo.xcodeproj
369 | 3
370 | 112
371 |
372 |
373 |
--------------------------------------------------------------------------------
/ios-demo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 42BAE6B0141CE07F005F8432 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BAE6AF141CE07F005F8432 /* UIKit.framework */; };
11 | 42BAE6B2141CE07F005F8432 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BAE6B1141CE07F005F8432 /* Foundation.framework */; };
12 | 42BAE6B4141CE07F005F8432 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BAE6B3141CE07F005F8432 /* CoreGraphics.framework */; };
13 | 42BAE6BA141CE07F005F8432 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 42BAE6B8141CE07F005F8432 /* InfoPlist.strings */; };
14 | 42BAE6BD141CE07F005F8432 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE6BC141CE07F005F8432 /* main.m */; };
15 | 42BAE6C0141CE07F005F8432 /* ios_demoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE6BF141CE07F005F8432 /* ios_demoAppDelegate.m */; };
16 | 42BAE6C4141CE07F005F8432 /* ios_demoAppDelegate_iPhone.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE6C3141CE07F005F8432 /* ios_demoAppDelegate_iPhone.m */; };
17 | 42BAE6C7141CE07F005F8432 /* MainWindow_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42BAE6C5141CE07F005F8432 /* MainWindow_iPhone.xib */; };
18 | 42BAE6CB141CE07F005F8432 /* ios_demoAppDelegate_iPad.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE6CA141CE07F005F8432 /* ios_demoAppDelegate_iPad.m */; };
19 | 42BAE6CE141CE07F005F8432 /* MainWindow_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42BAE6CC141CE07F005F8432 /* MainWindow_iPad.xib */; };
20 | 42BAE6DA141CE0CA005F8432 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BAE6AF141CE07F005F8432 /* UIKit.framework */; };
21 | 42BAE6DB141CE0CA005F8432 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BAE6B1141CE07F005F8432 /* Foundation.framework */; };
22 | 42BAE6DC141CE0CA005F8432 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BAE6B3141CE07F005F8432 /* CoreGraphics.framework */; };
23 | 42BAE6E2141CE0CA005F8432 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 42BAE6E0141CE0CA005F8432 /* InfoPlist.strings */; };
24 | 42BAE6E5141CE0CA005F8432 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE6E4141CE0CA005F8432 /* main.m */; };
25 | 42BAE6FE141CF1F4005F8432 /* MyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE6FD141CF1F4005F8432 /* MyTest.m */; };
26 | 42BAE701141CF299005F8432 /* ExampleTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE700141CF299005F8432 /* ExampleTest.m */; };
27 | 42BAE704141CF39D005F8432 /* ExampleAsyncTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BAE703141CF39D005F8432 /* ExampleAsyncTest.m */; };
28 | 42BAE707141D00AC005F8432 /* runtest.sh in Resources */ = {isa = PBXBuildFile; fileRef = 42BAE706141D00AC005F8432 /* runtest.sh */; };
29 | 42BED0D6141D163500ABA7ED /* GHUnitIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42BED0D5141D163500ABA7ED /* GHUnitIOS.framework */; };
30 | 42BED0D6141D163500ABA7EF /* NSArrayTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7EE /* NSArrayTest.m */; };
31 | 42BED0D6141D163500ABA7F1 /* NSDictionaryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7F0 /* NSDictionaryTest.m */; };
32 | 42BED0D6141D163500ABA7F3 /* NSExceptionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7F2 /* NSExceptionTest.m */; };
33 | 42BED0D6141D163500ABA7F5 /* NSLogTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7F4 /* NSLogTest.m */; };
34 | 42BED0D6141D163500ABA7F7 /* NSStringTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7F6 /* NSStringTest.m */; };
35 | 42BED0D6141D163500ABA7F9 /* NSUnitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7F8 /* NSUnitTest.m */; };
36 | 42BED0D6141D163500ABA7FB /* NSSelectorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7FA /* NSSelectorTest.m */; };
37 | 42BED0D6141D163500ABA7FD /* NSObjectTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7FC /* NSObjectTest.m */; };
38 | 42BED0D6141D163500ABA7FF /* NSThreadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA7FE /* NSThreadTest.m */; };
39 | 42BED0D6141D163500ABA801 /* NSTimerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA800 /* NSTimerTest.m */; };
40 | 42BED0D6141D163500ABA803 /* NSPathTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BED0D6141D163500ABA802 /* NSPathTest.m */; };
41 | 42FFCFF51426530F00B98B68 /* test.plist in Resources */ = {isa = PBXBuildFile; fileRef = 42FFCFF41426530F00B98B68 /* test.plist */; };
42 | /* End PBXBuildFile section */
43 |
44 | /* Begin PBXFileReference section */
45 | 42BAE6AB141CE07F005F8432 /* ios-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ios-demo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
46 | 42BAE6AF141CE07F005F8432 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
47 | 42BAE6B1141CE07F005F8432 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
48 | 42BAE6B3141CE07F005F8432 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
49 | 42BAE6B7141CE07F005F8432 /* ios-demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ios-demo-Info.plist"; sourceTree = ""; };
50 | 42BAE6B9141CE07F005F8432 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
51 | 42BAE6BB141CE07F005F8432 /* ios-demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ios-demo-Prefix.pch"; sourceTree = ""; };
52 | 42BAE6BC141CE07F005F8432 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
53 | 42BAE6BE141CE07F005F8432 /* ios_demoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ios_demoAppDelegate.h; sourceTree = ""; };
54 | 42BAE6BF141CE07F005F8432 /* ios_demoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ios_demoAppDelegate.m; sourceTree = ""; };
55 | 42BAE6C2141CE07F005F8432 /* ios_demoAppDelegate_iPhone.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ios_demoAppDelegate_iPhone.h; path = iPhone/ios_demoAppDelegate_iPhone.h; sourceTree = ""; };
56 | 42BAE6C3141CE07F005F8432 /* ios_demoAppDelegate_iPhone.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ios_demoAppDelegate_iPhone.m; path = iPhone/ios_demoAppDelegate_iPhone.m; sourceTree = ""; };
57 | 42BAE6C6141CE07F005F8432 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = iPhone/en.lproj/MainWindow_iPhone.xib; sourceTree = ""; };
58 | 42BAE6C9141CE07F005F8432 /* ios_demoAppDelegate_iPad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ios_demoAppDelegate_iPad.h; path = iPad/ios_demoAppDelegate_iPad.h; sourceTree = ""; };
59 | 42BAE6CA141CE07F005F8432 /* ios_demoAppDelegate_iPad.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ios_demoAppDelegate_iPad.m; path = iPad/ios_demoAppDelegate_iPad.m; sourceTree = ""; };
60 | 42BAE6CD141CE07F005F8432 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = iPad/en.lproj/MainWindow_iPad.xib; sourceTree = ""; };
61 | 42BAE6D8141CE0CA005F8432 /* ios-demo-test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ios-demo-test.app"; sourceTree = BUILT_PRODUCTS_DIR; };
62 | 42BAE6DF141CE0CA005F8432 /* ios-demo-test-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ios-demo-test-Info.plist"; sourceTree = ""; };
63 | 42BAE6E1141CE0CA005F8432 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
64 | 42BAE6E3141CE0CA005F8432 /* ios-demo-test-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ios-demo-test-Prefix.pch"; sourceTree = ""; };
65 | 42BAE6E4141CE0CA005F8432 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
66 | 42BAE6FD141CF1F4005F8432 /* MyTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyTest.m; sourceTree = ""; };
67 | 42BAE700141CF299005F8432 /* ExampleTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExampleTest.m; sourceTree = ""; };
68 | 42BAE703141CF39D005F8432 /* ExampleAsyncTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExampleAsyncTest.m; sourceTree = ""; };
69 | 42BAE706141D00AC005F8432 /* runtest.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtest.sh; sourceTree = ""; };
70 | 42BAE708141D00CD005F8432 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; };
71 | 42BED0D5141D163500ABA7ED /* GHUnitIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GHUnitIOS.framework; sourceTree = ""; };
72 | 42BED0D6141D163500ABA7EE /* NSArrayTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSArrayTest.m; sourceTree = ""; };
73 | 42BED0D6141D163500ABA7F0 /* NSDictionaryTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSDictionaryTest.m; sourceTree = ""; };
74 | 42BED0D6141D163500ABA7F2 /* NSExceptionTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSExceptionTest.m; sourceTree = ""; };
75 | 42BED0D6141D163500ABA7F4 /* NSLogTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSLogTest.m; sourceTree = ""; };
76 | 42BED0D6141D163500ABA7F6 /* NSStringTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSStringTest.m; sourceTree = ""; };
77 | 42BED0D6141D163500ABA7F8 /* NSUnitTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSUnitTest.m; sourceTree = ""; };
78 | 42BED0D6141D163500ABA7FA /* NSSelectorTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSSelectorTest.m; sourceTree = ""; };
79 | 42BED0D6141D163500ABA7FC /* NSObjectTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSObjectTest.m; sourceTree = ""; };
80 | 42BED0D6141D163500ABA7FE /* NSThreadTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSThreadTest.m; sourceTree = ""; };
81 | 42BED0D6141D163500ABA800 /* NSTimerTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSTimerTest.m; sourceTree = ""; };
82 | 42BED0D6141D163500ABA802 /* NSPathTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSPathTest.m; sourceTree = ""; };
83 | 42FFCFF41426530F00B98B68 /* test.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = test.plist; path = Resources/test.plist; sourceTree = ""; };
84 | /* End PBXFileReference section */
85 |
86 | /* Begin PBXFrameworksBuildPhase section */
87 | 42BAE6A8141CE07F005F8432 /* Frameworks */ = {
88 | isa = PBXFrameworksBuildPhase;
89 | buildActionMask = 2147483647;
90 | files = (
91 | 42BAE6B0141CE07F005F8432 /* UIKit.framework in Frameworks */,
92 | 42BAE6B2141CE07F005F8432 /* Foundation.framework in Frameworks */,
93 | 42BAE6B4141CE07F005F8432 /* CoreGraphics.framework in Frameworks */,
94 | );
95 | runOnlyForDeploymentPostprocessing = 0;
96 | };
97 | 42BAE6D5141CE0CA005F8432 /* Frameworks */ = {
98 | isa = PBXFrameworksBuildPhase;
99 | buildActionMask = 2147483647;
100 | files = (
101 | 42BAE6DA141CE0CA005F8432 /* UIKit.framework in Frameworks */,
102 | 42BAE6DB141CE0CA005F8432 /* Foundation.framework in Frameworks */,
103 | 42BAE6DC141CE0CA005F8432 /* CoreGraphics.framework in Frameworks */,
104 | 42BED0D6141D163500ABA7ED /* GHUnitIOS.framework in Frameworks */,
105 | );
106 | runOnlyForDeploymentPostprocessing = 0;
107 | };
108 | /* End PBXFrameworksBuildPhase section */
109 |
110 | /* Begin PBXGroup section */
111 | 42BAE6A0141CE07F005F8432 = {
112 | isa = PBXGroup;
113 | children = (
114 | 42BAE708141D00CD005F8432 /* Makefile */,
115 | 42BAE6B5141CE07F005F8432 /* ios-demo */,
116 | 42BAE6DD141CE0CA005F8432 /* ios-demo-test */,
117 | 42BAE6AE141CE07F005F8432 /* Frameworks */,
118 | 42BAE6AC141CE07F005F8432 /* Products */,
119 | );
120 | sourceTree = "";
121 | };
122 | 42BAE6AC141CE07F005F8432 /* Products */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 42BAE6AB141CE07F005F8432 /* ios-demo.app */,
126 | 42BAE6D8141CE0CA005F8432 /* ios-demo-test.app */,
127 | );
128 | name = Products;
129 | sourceTree = "";
130 | };
131 | 42BAE6AE141CE07F005F8432 /* Frameworks */ = {
132 | isa = PBXGroup;
133 | children = (
134 | 42BED0D5141D163500ABA7ED /* GHUnitIOS.framework */,
135 | 42BAE6AF141CE07F005F8432 /* UIKit.framework */,
136 | 42BAE6B1141CE07F005F8432 /* Foundation.framework */,
137 | 42BAE6B3141CE07F005F8432 /* CoreGraphics.framework */,
138 | );
139 | name = Frameworks;
140 | sourceTree = "";
141 | };
142 | 42BAE6B5141CE07F005F8432 /* ios-demo */ = {
143 | isa = PBXGroup;
144 | children = (
145 | 42BAE6BE141CE07F005F8432 /* ios_demoAppDelegate.h */,
146 | 42BAE6BF141CE07F005F8432 /* ios_demoAppDelegate.m */,
147 | 42BAE6C1141CE07F005F8432 /* iPhone */,
148 | 42BAE6C8141CE07F005F8432 /* iPad */,
149 | 42BAE6B6141CE07F005F8432 /* Supporting Files */,
150 | );
151 | path = "ios-demo";
152 | sourceTree = "";
153 | };
154 | 42BAE6B6141CE07F005F8432 /* Supporting Files */ = {
155 | isa = PBXGroup;
156 | children = (
157 | 42BAE6B7141CE07F005F8432 /* ios-demo-Info.plist */,
158 | 42BAE6B8141CE07F005F8432 /* InfoPlist.strings */,
159 | 42BAE6BB141CE07F005F8432 /* ios-demo-Prefix.pch */,
160 | 42BAE6BC141CE07F005F8432 /* main.m */,
161 | );
162 | name = "Supporting Files";
163 | sourceTree = "";
164 | };
165 | 42BAE6C1141CE07F005F8432 /* iPhone */ = {
166 | isa = PBXGroup;
167 | children = (
168 | 42BAE6C2141CE07F005F8432 /* ios_demoAppDelegate_iPhone.h */,
169 | 42BAE6C3141CE07F005F8432 /* ios_demoAppDelegate_iPhone.m */,
170 | 42BAE6C5141CE07F005F8432 /* MainWindow_iPhone.xib */,
171 | );
172 | name = iPhone;
173 | sourceTree = "";
174 | };
175 | 42BAE6C8141CE07F005F8432 /* iPad */ = {
176 | isa = PBXGroup;
177 | children = (
178 | 42BAE6C9141CE07F005F8432 /* ios_demoAppDelegate_iPad.h */,
179 | 42BAE6CA141CE07F005F8432 /* ios_demoAppDelegate_iPad.m */,
180 | 42BAE6CC141CE07F005F8432 /* MainWindow_iPad.xib */,
181 | );
182 | name = iPad;
183 | sourceTree = "";
184 | };
185 | 42BAE6DD141CE0CA005F8432 /* ios-demo-test */ = {
186 | isa = PBXGroup;
187 | children = (
188 | 42FFCFF2142652EE00B98B68 /* Resources */,
189 | 42BED0D6141D163500ABA802 /* NSPathTest.m */,
190 | 42BED0D6141D163500ABA800 /* NSTimerTest.m */,
191 | 42BED0D6141D163500ABA7FE /* NSThreadTest.m */,
192 | 42BED0D6141D163500ABA7FC /* NSObjectTest.m */,
193 | 42BED0D6141D163500ABA7FA /* NSSelectorTest.m */,
194 | 42BED0D6141D163500ABA7F8 /* NSUnitTest.m */,
195 | 42BED0D6141D163500ABA7F6 /* NSStringTest.m */,
196 | 42BED0D6141D163500ABA7F4 /* NSLogTest.m */,
197 | 42BED0D6141D163500ABA7F2 /* NSExceptionTest.m */,
198 | 42BED0D6141D163500ABA7F0 /* NSDictionaryTest.m */,
199 | 42BED0D6141D163500ABA7EE /* NSArrayTest.m */,
200 | 42BAE706141D00AC005F8432 /* runtest.sh */,
201 | 42BAE6DE141CE0CA005F8432 /* Supporting Files */,
202 | 42BAE6FD141CF1F4005F8432 /* MyTest.m */,
203 | 42BAE700141CF299005F8432 /* ExampleTest.m */,
204 | 42BAE703141CF39D005F8432 /* ExampleAsyncTest.m */,
205 | );
206 | path = "ios-demo-test";
207 | sourceTree = "";
208 | };
209 | 42BAE6DE141CE0CA005F8432 /* Supporting Files */ = {
210 | isa = PBXGroup;
211 | children = (
212 | 42BAE6DF141CE0CA005F8432 /* ios-demo-test-Info.plist */,
213 | 42BAE6E0141CE0CA005F8432 /* InfoPlist.strings */,
214 | 42BAE6E3141CE0CA005F8432 /* ios-demo-test-Prefix.pch */,
215 | 42BAE6E4141CE0CA005F8432 /* main.m */,
216 | );
217 | name = "Supporting Files";
218 | sourceTree = "";
219 | };
220 | 42FFCFF2142652EE00B98B68 /* Resources */ = {
221 | isa = PBXGroup;
222 | children = (
223 | 42FFCFF41426530F00B98B68 /* test.plist */,
224 | );
225 | name = Resources;
226 | sourceTree = "";
227 | };
228 | /* End PBXGroup section */
229 |
230 | /* Begin PBXNativeTarget section */
231 | 42BAE6AA141CE07F005F8432 /* ios-demo */ = {
232 | isa = PBXNativeTarget;
233 | buildConfigurationList = 42BAE6D1141CE07F005F8432 /* Build configuration list for PBXNativeTarget "ios-demo" */;
234 | buildPhases = (
235 | 42BAE6A7141CE07F005F8432 /* Sources */,
236 | 42BAE6A8141CE07F005F8432 /* Frameworks */,
237 | 42BAE6A9141CE07F005F8432 /* Resources */,
238 | );
239 | buildRules = (
240 | );
241 | dependencies = (
242 | );
243 | name = "ios-demo";
244 | productName = "ios-demo";
245 | productReference = 42BAE6AB141CE07F005F8432 /* ios-demo.app */;
246 | productType = "com.apple.product-type.application";
247 | };
248 | 42BAE6D7141CE0CA005F8432 /* ios-demo-test */ = {
249 | isa = PBXNativeTarget;
250 | buildConfigurationList = 42BAE6F7141CE0CA005F8432 /* Build configuration list for PBXNativeTarget "ios-demo-test" */;
251 | buildPhases = (
252 | 42BAE6D4141CE0CA005F8432 /* Sources */,
253 | 42BAE6D5141CE0CA005F8432 /* Frameworks */,
254 | 42BAE6D6141CE0CA005F8432 /* Resources */,
255 | 42BAE705141CFFCE005F8432 /* ShellScript */,
256 | );
257 | buildRules = (
258 | );
259 | dependencies = (
260 | );
261 | name = "ios-demo-test";
262 | productName = "ios-demo-test";
263 | productReference = 42BAE6D8141CE0CA005F8432 /* ios-demo-test.app */;
264 | productType = "com.apple.product-type.application";
265 | };
266 | /* End PBXNativeTarget section */
267 |
268 | /* Begin PBXProject section */
269 | 42BAE6A2141CE07F005F8432 /* Project object */ = {
270 | isa = PBXProject;
271 | buildConfigurationList = 42BAE6A5141CE07F005F8432 /* Build configuration list for PBXProject "ios-demo" */;
272 | compatibilityVersion = "Xcode 3.2";
273 | developmentRegion = English;
274 | hasScannedForEncodings = 0;
275 | knownRegions = (
276 | en,
277 | );
278 | mainGroup = 42BAE6A0141CE07F005F8432;
279 | productRefGroup = 42BAE6AC141CE07F005F8432 /* Products */;
280 | projectDirPath = "";
281 | projectRoot = "";
282 | targets = (
283 | 42BAE6AA141CE07F005F8432 /* ios-demo */,
284 | 42BAE6D7141CE0CA005F8432 /* ios-demo-test */,
285 | );
286 | };
287 | /* End PBXProject section */
288 |
289 | /* Begin PBXResourcesBuildPhase section */
290 | 42BAE6A9141CE07F005F8432 /* Resources */ = {
291 | isa = PBXResourcesBuildPhase;
292 | buildActionMask = 2147483647;
293 | files = (
294 | 42BAE6BA141CE07F005F8432 /* InfoPlist.strings in Resources */,
295 | 42BAE6C7141CE07F005F8432 /* MainWindow_iPhone.xib in Resources */,
296 | 42BAE6CE141CE07F005F8432 /* MainWindow_iPad.xib in Resources */,
297 | );
298 | runOnlyForDeploymentPostprocessing = 0;
299 | };
300 | 42BAE6D6141CE0CA005F8432 /* Resources */ = {
301 | isa = PBXResourcesBuildPhase;
302 | buildActionMask = 2147483647;
303 | files = (
304 | 42BAE6E2141CE0CA005F8432 /* InfoPlist.strings in Resources */,
305 | 42BAE707141D00AC005F8432 /* runtest.sh in Resources */,
306 | 42FFCFF51426530F00B98B68 /* test.plist in Resources */,
307 | );
308 | runOnlyForDeploymentPostprocessing = 0;
309 | };
310 | /* End PBXResourcesBuildPhase section */
311 |
312 | /* Begin PBXShellScriptBuildPhase section */
313 | 42BAE705141CFFCE005F8432 /* ShellScript */ = {
314 | isa = PBXShellScriptBuildPhase;
315 | buildActionMask = 2147483647;
316 | files = (
317 | );
318 | inputPaths = (
319 | );
320 | outputPaths = (
321 | );
322 | runOnlyForDeploymentPostprocessing = 0;
323 | shellPath = /bin/sh;
324 | shellScript = "sh ios-demo-test/runtest.sh";
325 | showEnvVarsInLog = 0;
326 | };
327 | /* End PBXShellScriptBuildPhase section */
328 |
329 | /* Begin PBXSourcesBuildPhase section */
330 | 42BAE6A7141CE07F005F8432 /* Sources */ = {
331 | isa = PBXSourcesBuildPhase;
332 | buildActionMask = 2147483647;
333 | files = (
334 | 42BAE6BD141CE07F005F8432 /* main.m in Sources */,
335 | 42BAE6C0141CE07F005F8432 /* ios_demoAppDelegate.m in Sources */,
336 | 42BAE6C4141CE07F005F8432 /* ios_demoAppDelegate_iPhone.m in Sources */,
337 | 42BAE6CB141CE07F005F8432 /* ios_demoAppDelegate_iPad.m in Sources */,
338 | );
339 | runOnlyForDeploymentPostprocessing = 0;
340 | };
341 | 42BAE6D4141CE0CA005F8432 /* Sources */ = {
342 | isa = PBXSourcesBuildPhase;
343 | buildActionMask = 2147483647;
344 | files = (
345 | 42BAE6E5141CE0CA005F8432 /* main.m in Sources */,
346 | 42BAE6FE141CF1F4005F8432 /* MyTest.m in Sources */,
347 | 42BAE701141CF299005F8432 /* ExampleTest.m in Sources */,
348 | 42BAE704141CF39D005F8432 /* ExampleAsyncTest.m in Sources */,
349 | 42BED0D6141D163500ABA7EF /* NSArrayTest.m in Sources */,
350 | 42BED0D6141D163500ABA7F1 /* NSDictionaryTest.m in Sources */,
351 | 42BED0D6141D163500ABA7F3 /* NSExceptionTest.m in Sources */,
352 | 42BED0D6141D163500ABA7F5 /* NSLogTest.m in Sources */,
353 | 42BED0D6141D163500ABA7F7 /* NSStringTest.m in Sources */,
354 | 42BED0D6141D163500ABA7F9 /* NSUnitTest.m in Sources */,
355 | 42BED0D6141D163500ABA7FB /* NSSelectorTest.m in Sources */,
356 | 42BED0D6141D163500ABA7FD /* NSObjectTest.m in Sources */,
357 | 42BED0D6141D163500ABA7FF /* NSThreadTest.m in Sources */,
358 | 42BED0D6141D163500ABA801 /* NSTimerTest.m in Sources */,
359 | 42BED0D6141D163500ABA803 /* NSPathTest.m in Sources */,
360 | );
361 | runOnlyForDeploymentPostprocessing = 0;
362 | };
363 | /* End PBXSourcesBuildPhase section */
364 |
365 | /* Begin PBXVariantGroup section */
366 | 42BAE6B8141CE07F005F8432 /* InfoPlist.strings */ = {
367 | isa = PBXVariantGroup;
368 | children = (
369 | 42BAE6B9141CE07F005F8432 /* en */,
370 | );
371 | name = InfoPlist.strings;
372 | sourceTree = "";
373 | };
374 | 42BAE6C5141CE07F005F8432 /* MainWindow_iPhone.xib */ = {
375 | isa = PBXVariantGroup;
376 | children = (
377 | 42BAE6C6141CE07F005F8432 /* en */,
378 | );
379 | name = MainWindow_iPhone.xib;
380 | sourceTree = "";
381 | };
382 | 42BAE6CC141CE07F005F8432 /* MainWindow_iPad.xib */ = {
383 | isa = PBXVariantGroup;
384 | children = (
385 | 42BAE6CD141CE07F005F8432 /* en */,
386 | );
387 | name = MainWindow_iPad.xib;
388 | sourceTree = "";
389 | };
390 | 42BAE6E0141CE0CA005F8432 /* InfoPlist.strings */ = {
391 | isa = PBXVariantGroup;
392 | children = (
393 | 42BAE6E1141CE0CA005F8432 /* en */,
394 | );
395 | name = InfoPlist.strings;
396 | sourceTree = "";
397 | };
398 | /* End PBXVariantGroup section */
399 |
400 | /* Begin XCBuildConfiguration section */
401 | 42BAE6CF141CE07F005F8432 /* Debug */ = {
402 | isa = XCBuildConfiguration;
403 | buildSettings = {
404 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
405 | CODE_SIGN_IDENTITY = "";
406 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
407 | GCC_C_LANGUAGE_STANDARD = gnu99;
408 | GCC_OPTIMIZATION_LEVEL = 0;
409 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
410 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
411 | GCC_VERSION = com.apple.compilers.llvmgcc42;
412 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
413 | GCC_WARN_UNUSED_VARIABLE = YES;
414 | IPHONEOS_DEPLOYMENT_TARGET = 4.3;
415 | SDKROOT = iphoneos;
416 | TARGETED_DEVICE_FAMILY = "1,2";
417 | };
418 | name = Debug;
419 | };
420 | 42BAE6D0141CE07F005F8432 /* Release */ = {
421 | isa = XCBuildConfiguration;
422 | buildSettings = {
423 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
424 | CODE_SIGN_IDENTITY = "";
425 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
426 | GCC_C_LANGUAGE_STANDARD = gnu99;
427 | GCC_VERSION = com.apple.compilers.llvmgcc42;
428 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
429 | GCC_WARN_UNUSED_VARIABLE = YES;
430 | IPHONEOS_DEPLOYMENT_TARGET = 4.3;
431 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
432 | SDKROOT = iphoneos;
433 | TARGETED_DEVICE_FAMILY = "1,2";
434 | };
435 | name = Release;
436 | };
437 | 42BAE6D2141CE07F005F8432 /* Debug */ = {
438 | isa = XCBuildConfiguration;
439 | buildSettings = {
440 | ALWAYS_SEARCH_USER_PATHS = NO;
441 | COPY_PHASE_STRIP = NO;
442 | GCC_DYNAMIC_NO_PIC = NO;
443 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
444 | GCC_PREFIX_HEADER = "ios-demo/ios-demo-Prefix.pch";
445 | INFOPLIST_FILE = "ios-demo/ios-demo-Info.plist";
446 | PRODUCT_NAME = "$(TARGET_NAME)";
447 | WRAPPER_EXTENSION = app;
448 | };
449 | name = Debug;
450 | };
451 | 42BAE6D3141CE07F005F8432 /* Release */ = {
452 | isa = XCBuildConfiguration;
453 | buildSettings = {
454 | ALWAYS_SEARCH_USER_PATHS = NO;
455 | COPY_PHASE_STRIP = YES;
456 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
457 | GCC_PREFIX_HEADER = "ios-demo/ios-demo-Prefix.pch";
458 | INFOPLIST_FILE = "ios-demo/ios-demo-Info.plist";
459 | PRODUCT_NAME = "$(TARGET_NAME)";
460 | VALIDATE_PRODUCT = YES;
461 | WRAPPER_EXTENSION = app;
462 | };
463 | name = Release;
464 | };
465 | 42BAE6F8141CE0CA005F8432 /* Debug */ = {
466 | isa = XCBuildConfiguration;
467 | buildSettings = {
468 | ALWAYS_SEARCH_USER_PATHS = NO;
469 | CODE_SIGN_IDENTITY = "";
470 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
471 | COPY_PHASE_STRIP = NO;
472 | FRAMEWORK_SEARCH_PATHS = (
473 | "$(inherited)",
474 | "\"$(SRCROOT)\"",
475 | );
476 | GCC_DYNAMIC_NO_PIC = NO;
477 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
478 | GCC_PREFIX_HEADER = "ios-demo-test/ios-demo-test-Prefix.pch";
479 | INFOPLIST_FILE = "ios-demo-test/ios-demo-test-Info.plist";
480 | OTHER_LDFLAGS = (
481 | "-ObjC",
482 | "-all_load",
483 | );
484 | PRODUCT_NAME = "$(TARGET_NAME)";
485 | WRAPPER_EXTENSION = app;
486 | };
487 | name = Debug;
488 | };
489 | 42BAE6F9141CE0CA005F8432 /* Release */ = {
490 | isa = XCBuildConfiguration;
491 | buildSettings = {
492 | ALWAYS_SEARCH_USER_PATHS = NO;
493 | CODE_SIGN_IDENTITY = "";
494 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
495 | COPY_PHASE_STRIP = YES;
496 | FRAMEWORK_SEARCH_PATHS = (
497 | "$(inherited)",
498 | "\"$(SRCROOT)\"",
499 | );
500 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
501 | GCC_PREFIX_HEADER = "ios-demo-test/ios-demo-test-Prefix.pch";
502 | INFOPLIST_FILE = "ios-demo-test/ios-demo-test-Info.plist";
503 | OTHER_LDFLAGS = (
504 | "-ObjC",
505 | "-all_load",
506 | );
507 | PRODUCT_NAME = "$(TARGET_NAME)";
508 | VALIDATE_PRODUCT = YES;
509 | WRAPPER_EXTENSION = app;
510 | };
511 | name = Release;
512 | };
513 | /* End XCBuildConfiguration section */
514 |
515 | /* Begin XCConfigurationList section */
516 | 42BAE6A5141CE07F005F8432 /* Build configuration list for PBXProject "ios-demo" */ = {
517 | isa = XCConfigurationList;
518 | buildConfigurations = (
519 | 42BAE6CF141CE07F005F8432 /* Debug */,
520 | 42BAE6D0141CE07F005F8432 /* Release */,
521 | );
522 | defaultConfigurationIsVisible = 0;
523 | defaultConfigurationName = Release;
524 | };
525 | 42BAE6D1141CE07F005F8432 /* Build configuration list for PBXNativeTarget "ios-demo" */ = {
526 | isa = XCConfigurationList;
527 | buildConfigurations = (
528 | 42BAE6D2141CE07F005F8432 /* Debug */,
529 | 42BAE6D3141CE07F005F8432 /* Release */,
530 | );
531 | defaultConfigurationIsVisible = 0;
532 | defaultConfigurationName = Release;
533 | };
534 | 42BAE6F7141CE0CA005F8432 /* Build configuration list for PBXNativeTarget "ios-demo-test" */ = {
535 | isa = XCConfigurationList;
536 | buildConfigurations = (
537 | 42BAE6F8141CE0CA005F8432 /* Debug */,
538 | 42BAE6F9141CE0CA005F8432 /* Release */,
539 | );
540 | defaultConfigurationIsVisible = 0;
541 | defaultConfigurationName = Release;
542 | };
543 | /* End XCConfigurationList section */
544 | };
545 | rootObject = 42BAE6A2141CE07F005F8432 /* Project object */;
546 | }
547 |
--------------------------------------------------------------------------------
/GHUnitIOS.framework/Versions/A/Headers/GHTestMacros.h:
--------------------------------------------------------------------------------
1 | //
2 | // GHTestMacros.h
3 | //
4 | // Created by Gabriel Handford on 1/17/09.
5 | // Copyright 2009. All rights reserved.
6 | //
7 | // Permission is hereby granted, free of charge, to any person
8 | // obtaining a copy of this software and associated documentation
9 | // files (the "Software"), to deal in the Software without
10 | // restriction, including without limitation the rights to use,
11 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the
13 | // Software is furnished to do so, subject to the following
14 | // conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be
17 | // included in all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 | // OTHER DEALINGS IN THE SOFTWARE.
27 | //
28 |
29 | //
30 | // Portions of this file fall under the following license, marked with
31 | // SENTE_BEGIN - SENTE_END
32 | //
33 | // Copyright (c) 1997-2005, Sen:te (Sente SA). All rights reserved.
34 | //
35 | // Use of this source code is governed by the following license:
36 | //
37 | // Redistribution and use in source and binary forms, with or without modification,
38 | // are permitted provided that the following conditions are met:
39 | //
40 | // (1) Redistributions of source code must retain the above copyright notice,
41 | // this list of conditions and the following disclaimer.
42 | //
43 | // (2) Redistributions in binary form must reproduce the above copyright notice,
44 | // this list of conditions and the following disclaimer in the documentation
45 | // and/or other materials provided with the distribution.
46 | //
47 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
48 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
49 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
50 | // IN NO EVENT SHALL Sente SA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
52 | // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
55 | // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 | //
57 | // Note: this license is equivalent to the FreeBSD license.
58 | //
59 | // This notice may not be removed from this file.
60 |
61 | //
62 | // Portions of this file fall under the following license, marked with:
63 | // GTM_BEGIN : GTM_END
64 | //
65 | // Copyright 2008 Google Inc.
66 | //
67 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not
68 | // use this file except in compliance with the License. You may obtain a copy
69 | // of the License at
70 | //
71 | // http://www.apache.org/licenses/LICENSE-2.0
72 | //
73 | // Unless required by applicable law or agreed to in writing, software
74 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
75 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
76 | // License for the specific language governing permissions and limitations under
77 | // the License.
78 | //
79 |
80 | #import
81 |
82 | #import "NSException+GHTestFailureExceptions.h"
83 | #import "NSValue+GHValueFormatter.h"
84 |
85 | // GTM_BEGIN
86 |
87 | extern NSString *const GHTestFilenameKey;
88 | extern NSString *const GHTestLineNumberKey;
89 | extern NSString *const GHTestFailureException;
90 |
91 | #if defined(__cplusplus)
92 | extern "C"
93 | #endif
94 |
95 | NSString *GHComposeString(NSString *, ...);
96 |
97 |
98 | /*!
99 | Generates a failure when a1 != noErr
100 |
101 | @param a1 Should be either an OSErr or an OSStatus
102 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
103 | @param ...: A variable number of arguments to the format string. Can be absent.
104 | */
105 | #define GHAssertNoErr(a1, description, ...) \
106 | do { \
107 | @try {\
108 | OSStatus a1value = (a1); \
109 | if (a1value != noErr) { \
110 | NSString *_expression = [NSString stringWithFormat:@"Expected noErr, got %ld for (%s)", a1value, #a1]; \
111 | if (description) { \
112 | _expression = [NSString stringWithFormat:@"%@: %@", _expression, GHComposeString(description, ##__VA_ARGS__)]; \
113 | } \
114 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
115 | atLine:__LINE__ \
116 | withDescription:_expression]]; \
117 | } \
118 | }\
119 | @catch (id anException) {\
120 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat:@"(%s) == noErr fails", #a1] \
121 | exception:anException \
122 | inFile:[NSString stringWithUTF8String:__FILE__] \
123 | atLine:__LINE__ \
124 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
125 | }\
126 | } while(0)
127 |
128 | /*!
129 | Generates a failure when a1 != a2
130 |
131 | @param a1 Rreceived value. Should be either an OSErr or an OSStatus
132 | @param a2 Expected value. Should be either an OSErr or an OSStatus
133 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
134 | @param ... A variable number of arguments to the format string. Can be absent.
135 | */
136 | #define GHAssertErr(a1, a2, description, ...) \
137 | do { \
138 | @try {\
139 | OSStatus a1value = (a1); \
140 | OSStatus a2value = (a2); \
141 | if (a1value != a2value) { \
142 | NSString *_expression = [NSString stringWithFormat:@"Expected %s(%ld) but got %ld for (%s)", #a2, a2value, a1value, #a1]; \
143 | if (description) { \
144 | _expression = [NSString stringWithFormat:@"%@: %@", _expression, GHComposeString(description, ##__VA_ARGS__)]; \
145 | } \
146 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
147 | atLine:__LINE__ \
148 | withDescription:_expression]]; \
149 | } \
150 | }\
151 | @catch (id anException) {\
152 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat:@"(%s) == (%s) fails", #a1, #a2] \
153 | exception:anException \
154 | inFile:[NSString stringWithUTF8String:__FILE__] \
155 | atLine:__LINE__ \
156 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
157 | }\
158 | } while(0)
159 |
160 |
161 | /*!
162 | Generates a failure when a1 is NULL
163 |
164 | @param a1 Should be a pointer (use GHAssertNotNil for an object)
165 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
166 | @param ... A variable number of arguments to the format string. Can be absent.
167 | */
168 | #define GHAssertNotNULL(a1, description, ...) \
169 | do { \
170 | @try {\
171 | const void* a1value = (a1); \
172 | if (a1value == NULL) { \
173 | NSString *_expression = [NSString stringWithFormat:@"(%s) != NULL", #a1]; \
174 | if (description) { \
175 | _expression = [NSString stringWithFormat:@"%@: %@", _expression, GHComposeString(description, ##__VA_ARGS__)]; \
176 | } \
177 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
178 | atLine:__LINE__ \
179 | withDescription:_expression]]; \
180 | } \
181 | }\
182 | @catch (id anException) {\
183 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat:@"(%s) != NULL fails", #a1] \
184 | exception:anException \
185 | inFile:[NSString stringWithUTF8String:__FILE__] \
186 | atLine:__LINE__ \
187 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
188 | }\
189 | } while(0)
190 |
191 | /*!
192 | Generates a failure when a1 is not NULL
193 |
194 | @param a1 should be a pointer (use GHAssertNil for an object)
195 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
196 | @param ... A variable number of arguments to the format string. Can be absent.
197 | */
198 | #define GHAssertNULL(a1, description, ...) \
199 | do { \
200 | @try {\
201 | const void* a1value = (a1); \
202 | if (a1value != NULL) { \
203 | NSString *_expression = [NSString stringWithFormat:@"(%s) == NULL", #a1]; \
204 | if (description) { \
205 | _expression = [NSString stringWithFormat:@"%@: %@", _expression, GHComposeString(description, ##__VA_ARGS__)]; \
206 | } \
207 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
208 | atLine:__LINE__ \
209 | withDescription:_expression]]; \
210 | } \
211 | }\
212 | @catch (id anException) {\
213 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat:@"(%s) == NULL fails", #a1] \
214 | exception:anException \
215 | inFile:[NSString stringWithUTF8String:__FILE__] \
216 | atLine:__LINE__ \
217 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
218 | }\
219 | } while(0)
220 |
221 | /*!
222 | Generates a failure when a1 is equal to a2. This test is for C scalars, structs and unions.
223 |
224 | @param a1 Argument 1
225 | @param a2 Argument 2
226 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
227 | @param ... A variable number of arguments to the format string. Can be absent.
228 | */
229 | #define GHAssertNotEquals(a1, a2, description, ...) \
230 | do { \
231 | @try {\
232 | if (strcmp(@encode(__typeof__(a1)), @encode(__typeof__(a2))) != 0) { \
233 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
234 | atLine:__LINE__ \
235 | withDescription:[@"Type mismatch -- " stringByAppendingString:GHComposeString(description, ##__VA_ARGS__)]]]; \
236 | } else { \
237 | __typeof__(a1) a1value = (a1); \
238 | __typeof__(a2) a2value = (a2); \
239 | NSValue *a1encoded = [NSValue value:&a1value withObjCType:@encode(__typeof__(a1))]; \
240 | NSValue *a2encoded = [NSValue value:&a2value withObjCType:@encode(__typeof__(a2))]; \
241 | if ([a1encoded isEqualToValue:a2encoded]) { \
242 | NSString *_expression = [NSString stringWithFormat:@"(%s) != (%s)", #a1, #a2]; \
243 | if (description) { \
244 | _expression = [NSString stringWithFormat:@"%@: %@", _expression, GHComposeString(description, ##__VA_ARGS__)]; \
245 | } \
246 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
247 | atLine:__LINE__ \
248 | withDescription:_expression]]; \
249 | } \
250 | } \
251 | } \
252 | @catch (id anException) {\
253 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat:@"(%s) != (%s)", #a1, #a2] \
254 | exception:anException \
255 | inFile:[NSString stringWithUTF8String:__FILE__] \
256 | atLine:__LINE__ \
257 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
258 | }\
259 | } while(0)
260 |
261 | /*!
262 | Generates a failure when a1 is equal to a2. This test is for objects.
263 |
264 | @param a1 Argument 1. object.
265 | @param a2 Argument 2. object.
266 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
267 | @param ... A variable number of arguments to the format string. Can be absent.
268 | */
269 | #define GHAssertNotEqualObjects(a1, a2, desc, ...) \
270 | do { \
271 | @try {\
272 | id a1value = (a1); \
273 | id a2value = (a2); \
274 | if ( (strcmp(@encode(__typeof__(a1value)), @encode(id)) == 0) && \
275 | (strcmp(@encode(__typeof__(a2value)), @encode(id)) == 0) && \
276 | ![(id)a1value isEqual:(id)a2value] ) continue; \
277 | NSString *_expression = [NSString stringWithFormat:@"%s('%@') != %s('%@')", #a1, [a1 description], #a2, [a2 description]]; \
278 | if (desc) { \
279 | _expression = [NSString stringWithFormat:@"%@: %@", _expression, GHComposeString(desc, ##__VA_ARGS__)]; \
280 | } \
281 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
282 | atLine:__LINE__ \
283 | withDescription:_expression]]; \
284 | }\
285 | @catch (id anException) {\
286 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) != (%s)", #a1, #a2] \
287 | exception:anException \
288 | inFile:[NSString stringWithUTF8String:__FILE__] \
289 | atLine:__LINE__ \
290 | withDescription:GHComposeString(desc, ##__VA_ARGS__)]]; \
291 | }\
292 | } while(0)
293 |
294 | /*!
295 | Generates a failure when a1 is not 'op' to a2. This test is for C scalars.
296 |
297 | @param a1 Argument 1
298 | @param a2 Argument 2
299 | @param op Operation
300 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
301 | @param ... A variable number of arguments to the format string. Can be absent.
302 | */
303 | #define GHAssertOperation(a1, a2, op, description, ...) \
304 | do { \
305 | @try {\
306 | if (strcmp(@encode(__typeof__(a1)), @encode(__typeof__(a2))) != 0) { \
307 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
308 | atLine:__LINE__ \
309 | withDescription:[@"Type mismatch -- " stringByAppendingString:GHComposeString(description, ##__VA_ARGS__)]]]; \
310 | } else { \
311 | __typeof__(a1) a1value = (a1); \
312 | __typeof__(a2) a2value = (a2); \
313 | if (!(a1value op a2value)) { \
314 | double a1DoubleValue = a1value; \
315 | double a2DoubleValue = a2value; \
316 | NSString *_expression = [NSString stringWithFormat:@"%s (%lg) %s %s (%lg)", #a1, a1DoubleValue, #op, #a2, a2DoubleValue]; \
317 | if (description) { \
318 | _expression = [NSString stringWithFormat:@"%@: %@", _expression, GHComposeString(description, ##__VA_ARGS__)]; \
319 | } \
320 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
321 | atLine:__LINE__ \
322 | withDescription:_expression]]; \
323 | } \
324 | } \
325 | } \
326 | @catch (id anException) {\
327 | [self failWithException:[NSException \
328 | ghu_failureInRaise:[NSString stringWithFormat:@"(%s) %s (%s)", #a1, #op, #a2] \
329 | exception:anException \
330 | inFile:[NSString stringWithUTF8String:__FILE__] \
331 | atLine:__LINE__ \
332 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
333 | }\
334 | } while(0)
335 |
336 | /*!
337 | Generates a failure when a1 is not > a2. This test is for C scalars.
338 |
339 | @param a1 argument 1
340 | @param a2 argument 2
341 | @param op operation
342 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
343 | @param ... A variable number of arguments to the format string. Can be absent.
344 | */
345 | #define GHAssertGreaterThan(a1, a2, description, ...) \
346 | GHAssertOperation(a1, a2, >, description, ##__VA_ARGS__)
347 |
348 | /*!
349 | Generates a failure when a1 is not >= a2. This test is for C scalars.
350 |
351 | @param a1 argument 1
352 | @param a2 argument 2
353 | @param op operation
354 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
355 | @param ... A variable number of arguments to the format string. Can be absent.
356 | */
357 | #define GHAssertGreaterThanOrEqual(a1, a2, description, ...) \
358 | GHAssertOperation(a1, a2, >=, description, ##__VA_ARGS__)
359 |
360 | /*!
361 | Generates a failure when a1 is not < a2. This test is for C scalars.
362 |
363 | @param a1 argument 1
364 | @param a2 argument 2
365 | @param op operation
366 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
367 | @param ... A variable number of arguments to the format string. Can be absent.
368 | */
369 | #define GHAssertLessThan(a1, a2, description, ...) \
370 | GHAssertOperation(a1, a2, <, description, ##__VA_ARGS__)
371 |
372 | /*! Generates a failure when a1 is not <= a2. This test is for C scalars.
373 |
374 | @param a1 argument 1
375 | @param a2 argument 2
376 | @param op operation
377 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
378 | @param ... A variable number of arguments to the format string. Can be absent.
379 | */
380 | #define GHAssertLessThanOrEqual(a1, a2, description, ...) \
381 | GHAssertOperation(a1, a2, <=, description, ##__VA_ARGS__)
382 |
383 | /*!
384 | Generates a failure when string a1 is not equal to string a2. This call
385 | differs from GHAssertEqualObjects in that strings that are different in
386 | composition (precomposed vs decomposed) will compare equal if their final
387 | representation is equal.
388 | ex O + umlaut decomposed is the same as O + umlaut composed.
389 |
390 | @param a1 string 1
391 | @param a2 string 2
392 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
393 | @param ... A variable number of arguments to the format string. Can be absent.
394 | */
395 | #define GHAssertEqualStrings(a1, a2, description, ...) \
396 | do { \
397 | @try {\
398 | id a1value = (a1); \
399 | id a2value = (a2); \
400 | if (a1value == a2value) continue; \
401 | if ([a1value isKindOfClass:[NSString class]] && \
402 | [a2value isKindOfClass:[NSString class]] && \
403 | [a1value compare:a2value options:0] == NSOrderedSame) continue; \
404 | [self failWithException:[NSException ghu_failureInEqualityBetweenObject: a1value \
405 | andObject: a2value \
406 | inFile: [NSString stringWithUTF8String:__FILE__] \
407 | atLine: __LINE__ \
408 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
409 | }\
410 | @catch (id anException) {\
411 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) == (%s)", #a1, #a2] \
412 | exception:anException \
413 | inFile:[NSString stringWithUTF8String:__FILE__] \
414 | atLine:__LINE__ \
415 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
416 | }\
417 | } while(0)
418 |
419 | /*!
420 | Generates a failure when string a1 is equal to string a2. This call
421 | differs from GHAssertEqualObjects in that strings that are different in
422 | composition (precomposed vs decomposed) will compare equal if their final
423 | representation is equal.
424 | ex O + umlaut decomposed is the same as O + umlaut composed.
425 |
426 | @param a1 string 1
427 | @param a2 string 2
428 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
429 | @param ... A variable number of arguments to the format string. Can be absent.
430 | */
431 | #define GHAssertNotEqualStrings(a1, a2, description, ...) \
432 | do { \
433 | @try {\
434 | id a1value = (a1); \
435 | id a2value = (a2); \
436 | if (([a1value isKindOfClass:[NSString class]] && \
437 | [a2value isKindOfClass:[NSString class]] && \
438 | [a1value compare:a2value options:0] != NSOrderedSame) || \
439 | (a1value == nil && [a2value isKindOfClass:[NSString class]]) || \
440 | (a2value == nil && [a1value isKindOfClass:[NSString class]]) \
441 | ) continue; \
442 | [self failWithException:[NSException ghu_failureInInequalityBetweenObject: a1value \
443 | andObject: a2value \
444 | inFile: [NSString stringWithUTF8String:__FILE__] \
445 | atLine: __LINE__ \
446 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
447 | }\
448 | @catch (id anException) {\
449 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) != (%s)", #a1, #a2] \
450 | exception:anException \
451 | inFile:[NSString stringWithUTF8String:__FILE__] \
452 | atLine:__LINE__ \
453 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
454 | }\
455 | } while(0)
456 |
457 | /*!
458 | Generates a failure when c-string a1 is not equal to c-string a2.
459 |
460 | @param a1 string 1
461 | @param a2 string 2
462 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
463 | @param ... A variable number of arguments to the format string. Can be absent.
464 | */
465 | #define GHAssertEqualCStrings(a1, a2, description, ...) \
466 | do { \
467 | @try {\
468 | const char* a1value = (a1); \
469 | const char* a2value = (a2); \
470 | if (a1value == a2value) continue; \
471 | if (strcmp(a1value, a2value) == 0) continue; \
472 | [self failWithException:[NSException ghu_failureInEqualityBetweenObject: [NSString stringWithUTF8String:a1value] \
473 | andObject: [NSString stringWithUTF8String:a2value] \
474 | inFile: [NSString stringWithUTF8String:__FILE__] \
475 | atLine: __LINE__ \
476 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
477 | }\
478 | @catch (id anException) {\
479 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) == (%s)", #a1, #a2] \
480 | exception:anException \
481 | inFile:[NSString stringWithUTF8String:__FILE__] \
482 | atLine:__LINE__ \
483 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
484 | }\
485 | } while(0)
486 |
487 | /*!
488 | Generates a failure when c-string a1 is equal to c-string a2.
489 |
490 | @param a1 string 1
491 | @param a2 string 2
492 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present.
493 | @param ... A variable number of arguments to the format string. Can be absent.
494 | */
495 | #define GHAssertNotEqualCStrings(a1, a2, description, ...) \
496 | do { \
497 | @try {\
498 | const char* a1value = (a1); \
499 | const char* a2value = (a2); \
500 | if (strcmp(a1value, a2value) != 0) continue; \
501 | [self failWithException:[NSException ghu_failureInEqualityBetweenObject: [NSString stringWithUTF8String:a1value] \
502 | andObject: [NSString stringWithUTF8String:a2value] \
503 | inFile: [NSString stringWithUTF8String:__FILE__] \
504 | atLine: __LINE__ \
505 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
506 | }\
507 | @catch (id anException) {\
508 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) != (%s)", #a1, #a2] \
509 | exception:anException \
510 | inFile:[NSString stringWithUTF8String:__FILE__] \
511 | atLine:__LINE__ \
512 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
513 | }\
514 | } while(0)
515 |
516 | // GTM_END
517 |
518 | // SENTE_BEGIN
519 | /*! Generates a failure when !{ [a1 isEqualTo:a2] } is false
520 | (or one is nil and the other is not).
521 |
522 | @param a1 The object on the left
523 | @param a2 The object on the right
524 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
525 | @param ... A variable number of arguments to the format string. Can be absent
526 | */
527 | #define GHAssertEqualObjects(a1, a2, description, ...) \
528 | do { \
529 | @try {\
530 | id a1value = (a1); \
531 | id a2value = (a2); \
532 | if (a1value == a2value) continue; \
533 | if ( (strcmp(@encode(__typeof__(a1value)), @encode(id)) == 0) && \
534 | (strcmp(@encode(__typeof__(a2value)), @encode(id)) == 0) && \
535 | [(id)a1value isEqual: (id)a2value] ) continue; \
536 | [self failWithException:[NSException ghu_failureInEqualityBetweenObject: a1value \
537 | andObject: a2value \
538 | inFile: [NSString stringWithUTF8String:__FILE__] \
539 | atLine: __LINE__ \
540 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
541 | }\
542 | @catch (id anException) {\
543 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) == (%s)", #a1, #a2] \
544 | exception:anException \
545 | inFile:[NSString stringWithUTF8String:__FILE__] \
546 | atLine:__LINE__ \
547 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
548 | }\
549 | } while(0)
550 |
551 |
552 | /*! Generates a failure when a1 is not equal to a2. This test is for
553 | C scalars, structs and unions.
554 |
555 | @param a1 The argument on the left
556 | @param a2 The argument on the right
557 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
558 | @param ... A variable number of arguments to the format string. Can be absent
559 | */
560 | #define GHAssertEquals(a1, a2, description, ...) \
561 | do { \
562 | @try {\
563 | if ( strcmp(@encode(__typeof__(a1)), @encode(__typeof__(a2))) != 0 ) { \
564 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
565 | atLine:__LINE__ \
566 | withDescription:[@"Type mismatch -- " stringByAppendingString:GHComposeString(description, ##__VA_ARGS__)]]]; \
567 | } else { \
568 | __typeof__(a1) a1value = (a1); \
569 | __typeof__(a2) a2value = (a2); \
570 | NSValue *a1encoded = [NSValue value:&a1value withObjCType: @encode(__typeof__(a1))]; \
571 | NSValue *a2encoded = [NSValue value:&a2value withObjCType: @encode(__typeof__(a2))]; \
572 | if (![a1encoded isEqualToValue:a2encoded]) { \
573 | [self failWithException:[NSException ghu_failureInEqualityBetweenValue: a1encoded \
574 | andValue: a2encoded \
575 | withAccuracy: nil \
576 | inFile: [NSString stringWithUTF8String:__FILE__] \
577 | atLine: __LINE__ \
578 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
579 | } \
580 | } \
581 | } \
582 | @catch (id anException) {\
583 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) == (%s)", #a1, #a2] \
584 | exception:anException \
585 | inFile:[NSString stringWithUTF8String:__FILE__] \
586 | atLine:__LINE__ \
587 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
588 | }\
589 | } while(0)
590 |
591 | //! Absolute difference
592 | #define GHAbsoluteDifference(left,right) (MAX(left,right)-MIN(left,right))
593 |
594 |
595 | /*!
596 | Generates a failure when a1 is not equal to a2 within + or - accuracy is false.
597 | This test is for scalars such as floats and doubles where small differences
598 | could make these items not exactly equal, but also works for all scalars.
599 |
600 | @param a1 The scalar on the left
601 | @param a2 The scalar on the right
602 | @param accuracy The maximum difference between a1 and a2 for these values to be considered equal
603 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
604 | @param ... A variable number of arguments to the format string. Can be absent
605 | */
606 | #define GHAssertEqualsWithAccuracy(a1, a2, accuracy, description, ...) \
607 | do { \
608 | @try {\
609 | if (strcmp(@encode(__typeof__(a1)), @encode(__typeof__(a2))) != 0) { \
610 | [self failWithException:[NSException ghu_failureInFile:[NSString stringWithUTF8String:__FILE__] \
611 | atLine:__LINE__ \
612 | withDescription:[@"Type mismatch -- " stringByAppendingString:GHComposeString(description, ##__VA_ARGS__)]]]; \
613 | } else { \
614 | __typeof__(a1) a1value = (a1); \
615 | __typeof__(a2) a2value = (a2); \
616 | __typeof__(accuracy) accuracyvalue = (accuracy); \
617 | if (GHAbsoluteDifference(a1value, a2value) > accuracyvalue) { \
618 | NSValue *a1encoded = [NSValue value:&a1value withObjCType:@encode(__typeof__(a1))]; \
619 | NSValue *a2encoded = [NSValue value:&a2value withObjCType:@encode(__typeof__(a2))]; \
620 | NSValue *accuracyencoded = [NSValue value:&accuracyvalue withObjCType:@encode(__typeof__(accuracy))]; \
621 | [self failWithException:[NSException ghu_failureInEqualityBetweenValue: a1encoded \
622 | andValue: a2encoded \
623 | withAccuracy: accuracyencoded \
624 | inFile: [NSString stringWithUTF8String:__FILE__] \
625 | atLine: __LINE__ \
626 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
627 | } \
628 | } \
629 | } \
630 | @catch (id anException) {\
631 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) == (%s)", #a1, #a2] \
632 | exception:anException \
633 | inFile:[NSString stringWithUTF8String:__FILE__] \
634 | atLine:__LINE__ \
635 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
636 | }\
637 | } while(0)
638 |
639 |
640 |
641 | /*!
642 | Generates a failure unconditionally.
643 |
644 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
645 | @param ... A variable number of arguments to the format string. Can be absent
646 | */
647 | #define GHFail(description, ...) \
648 | [self failWithException:[NSException ghu_failureInFile: [NSString stringWithUTF8String:__FILE__] \
649 | atLine: __LINE__ \
650 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]
651 |
652 |
653 |
654 | /*!
655 | Generates a failure when a1 is not nil.
656 |
657 | @param a1 An object
658 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
659 | @param ... A variable number of arguments to the format string. Can be absent
660 | */
661 | #define GHAssertNil(a1, description, ...) \
662 | do { \
663 | @try {\
664 | id a1value = (a1); \
665 | if (a1value != nil) { \
666 | NSString *_a1 = [NSString stringWithUTF8String: #a1]; \
667 | NSString *_expression = [NSString stringWithFormat:@"((%@) == nil)", _a1]; \
668 | [self failWithException:[NSException ghu_failureInCondition: _expression \
669 | isTrue: NO \
670 | inFile: [NSString stringWithUTF8String:__FILE__] \
671 | atLine: __LINE__ \
672 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
673 | } \
674 | }\
675 | @catch (id anException) {\
676 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) == nil fails", #a1] \
677 | exception:anException \
678 | inFile:[NSString stringWithUTF8String:__FILE__] \
679 | atLine:__LINE__ \
680 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
681 | }\
682 | } while(0)
683 |
684 |
685 | /*!
686 | Generates a failure when a1 is nil.
687 |
688 | @param a1 An object
689 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
690 | @param ... A variable number of arguments to the format string. Can be absent
691 | */
692 | #define GHAssertNotNil(a1, description, ...) \
693 | do { \
694 | @try {\
695 | id a1value = (a1); \
696 | if (a1value == nil) { \
697 | NSString *_a1 = [NSString stringWithUTF8String: #a1]; \
698 | NSString *_expression = [NSString stringWithFormat:@"((%@) != nil)", _a1]; \
699 | [self failWithException:[NSException ghu_failureInCondition: _expression \
700 | isTrue: NO \
701 | inFile: [NSString stringWithUTF8String:__FILE__] \
702 | atLine: __LINE__ \
703 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
704 | } \
705 | }\
706 | @catch (id anException) {\
707 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) != nil fails", #a1] \
708 | exception:anException \
709 | inFile:[NSString stringWithUTF8String:__FILE__] \
710 | atLine:__LINE__ \
711 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
712 | }\
713 | } while(0)
714 |
715 |
716 | /*!
717 | Generates a failure when expression evaluates to false.
718 |
719 | @param expr The expression that is tested
720 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
721 | @param ... A variable number of arguments to the format string. Can be absent
722 | */
723 | #define GHAssertTrue(expr, description, ...) \
724 | do { \
725 | BOOL _evaluatedExpression = (expr);\
726 | if (!_evaluatedExpression) {\
727 | NSString *_expression = [NSString stringWithUTF8String: #expr];\
728 | [self failWithException:[NSException ghu_failureInCondition: _expression \
729 | isTrue: YES \
730 | inFile: [NSString stringWithUTF8String:__FILE__] \
731 | atLine: __LINE__ \
732 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
733 | } \
734 | } while (0)
735 |
736 |
737 | /*!
738 | Generates a failure when expression evaluates to false and in addition will
739 | generate error messages if an exception is encountered.
740 |
741 | @param expr The expression that is tested
742 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
743 | @param ... A variable number of arguments to the format string. Can be absent
744 | */
745 | #define GHAssertTrueNoThrow(expr, description, ...) \
746 | do { \
747 | @try {\
748 | BOOL _evaluatedExpression = (expr);\
749 | if (!_evaluatedExpression) {\
750 | NSString *_expression = [NSString stringWithUTF8String: #expr];\
751 | [self failWithException:[NSException ghu_failureInCondition: _expression \
752 | isTrue: NO \
753 | inFile: [NSString stringWithUTF8String:__FILE__] \
754 | atLine: __LINE__ \
755 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
756 | } \
757 | } \
758 | @catch (id anException) {\
759 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"(%s) ", #expr] \
760 | exception:anException \
761 | inFile:[NSString stringWithUTF8String:__FILE__] \
762 | atLine:__LINE__ \
763 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
764 | }\
765 | } while (0)
766 |
767 |
768 | /*!
769 | Generates a failure when the expression evaluates to true.
770 |
771 | @param expr The expression that is tested
772 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
773 | @param ... A variable number of arguments to the format string. Can be absent
774 | */
775 | #define GHAssertFalse(expr, description, ...) \
776 | do { \
777 | BOOL _evaluatedExpression = (expr);\
778 | if (_evaluatedExpression) {\
779 | NSString *_expression = [NSString stringWithUTF8String: #expr];\
780 | [self failWithException:[NSException ghu_failureInCondition: _expression \
781 | isTrue: NO \
782 | inFile: [NSString stringWithUTF8String:__FILE__] \
783 | atLine: __LINE__ \
784 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
785 | } \
786 | } while (0)
787 |
788 |
789 | /*!
790 | Generates a failure when the expression evaluates to true and in addition
791 | will generate error messages if an exception is encountered.
792 |
793 | @param expr The expression that is tested
794 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
795 | @param ... A variable number of arguments to the format string. Can be absent
796 | */
797 | #define GHAssertFalseNoThrow(expr, description, ...) \
798 | do { \
799 | @try {\
800 | BOOL _evaluatedExpression = (expr);\
801 | if (_evaluatedExpression) {\
802 | NSString *_expression = [NSString stringWithUTF8String: #expr];\
803 | [self failWithException:[NSException ghu_failureInCondition: _expression \
804 | isTrue: YES \
805 | inFile: [NSString stringWithUTF8String:__FILE__] \
806 | atLine: __LINE__ \
807 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
808 | } \
809 | } \
810 | @catch (id anException) {\
811 | [self failWithException:[NSException ghu_failureInRaise:[NSString stringWithFormat: @"!(%s) ", #expr] \
812 | exception:anException \
813 | inFile:[NSString stringWithUTF8String:__FILE__] \
814 | atLine:__LINE__ \
815 | withDescription:GHComposeString(description, ##__VA_ARGS__)]]; \
816 | }\
817 | } while (0)
818 |
819 |
820 | /*!
821 | Generates a failure when expression does not throw an exception.
822 |
823 | @param expression The expression that is evaluated
824 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
825 | @param ... A variable number of arguments to the format string. Can be absent.
826 | */
827 | #define GHAssertThrows(expr, description, ...) \
828 | do { \
829 | @try { \
830 | (expr);\
831 | } \
832 | @catch (id anException) { \
833 | continue; \
834 | }\
835 | [self failWithException:[NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
836 | exception: nil \
837 | inFile: [NSString stringWithUTF8String:__FILE__] \
838 | atLine: __LINE__ \
839 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
840 | } while (0)
841 |
842 |
843 | /*!
844 | Generates a failure when expression does not throw an exception of a
845 | specific class.
846 |
847 | @param expression The expression that is evaluated
848 | @param specificException The specified class of the exception
849 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
850 | @param ... A variable number of arguments to the format string. Can be absent
851 | */
852 | #define GHAssertThrowsSpecific(expr, specificException, description, ...) \
853 | do { \
854 | @try { \
855 | (expr);\
856 | } \
857 | @catch (specificException *anException) { \
858 | continue; \
859 | }\
860 | @catch (id anException) {\
861 | NSString *_descrip = GHComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description);\
862 | [self failWithException:[NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
863 | exception: anException \
864 | inFile: [NSString stringWithUTF8String:__FILE__] \
865 | atLine: __LINE__ \
866 | withDescription: GHComposeString(_descrip, ##__VA_ARGS__)]]; \
867 | continue; \
868 | }\
869 | NSString *_descrip = GHComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description);\
870 | [self failWithException:[NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
871 | exception: nil \
872 | inFile: [NSString stringWithUTF8String:__FILE__] \
873 | atLine: __LINE__ \
874 | withDescription: GHComposeString(_descrip, ##__VA_ARGS__)]]; \
875 | } while (0)
876 |
877 |
878 | /*! Generates a failure when expression does not throw an exception of a
879 | specific class with a specific name. Useful for those frameworks like
880 | AppKit or Foundation that throw generic NSException w/specific names
881 | (NSInvalidArgumentException, etc).
882 |
883 | @param expression The expression that is evaluated
884 | @param specificException The specified class of the exception
885 | @param aName The name of the specified exception
886 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
887 | @param ... A variable number of arguments to the format string. Can be absent
888 | */
889 | #define GHAssertThrowsSpecificNamed(expr, specificException, aName, description, ...) \
890 | do { \
891 | @try { \
892 | (expr);\
893 | } \
894 | @catch (specificException *anException) { \
895 | if ([aName isEqualToString: [anException name]]) continue; \
896 | NSString *_descrip = GHComposeString(@"(Expected exception: %@ (name: %@)) %@", NSStringFromClass([specificException class]), aName, description);\
897 | [self failWithException: \
898 | [NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
899 | exception: anException \
900 | inFile: [NSString stringWithUTF8String:__FILE__] \
901 | atLine: __LINE__ \
902 | withDescription: GHComposeString(_descrip, ##__VA_ARGS__)]]; \
903 | continue; \
904 | }\
905 | @catch (id anException) {\
906 | NSString *_descrip = GHComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description);\
907 | [self failWithException: \
908 | [NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
909 | exception: anException \
910 | inFile: [NSString stringWithUTF8String:__FILE__] \
911 | atLine: __LINE__ \
912 | withDescription: GHComposeString(_descrip, ##__VA_ARGS__)]]; \
913 | continue; \
914 | }\
915 | NSString *_descrip = GHComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description);\
916 | [self failWithException: \
917 | [NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
918 | exception: nil \
919 | inFile: [NSString stringWithUTF8String:__FILE__] \
920 | atLine: __LINE__ \
921 | withDescription: GHComposeString(_descrip, ##__VA_ARGS__)]]; \
922 | } while (0)
923 |
924 |
925 | /*!
926 | Generates a failure when expression does throw an exception.
927 |
928 | @param expression The expression that is evaluated
929 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
930 | @param ... A variable number of arguments to the format string. Can be absent
931 | */
932 | #define GHAssertNoThrow(expr, description, ...) \
933 | do { \
934 | @try { \
935 | (expr);\
936 | } \
937 | @catch (id anException) { \
938 | [self failWithException:[NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
939 | exception: anException \
940 | inFile: [NSString stringWithUTF8String:__FILE__] \
941 | atLine: __LINE__ \
942 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
943 | }\
944 | } while (0)
945 |
946 |
947 | /*!
948 | Generates a failure when expression does throw an exception of the specitied
949 | class. Any other exception is okay (i.e. does not generate a failure).
950 |
951 | @param expression The expression that is evaluated
952 | @param specificException The specified class of the exception
953 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
954 | @param ... A variable number of arguments to the format string. Can be absent
955 | */
956 | #define GHAssertNoThrowSpecific(expr, specificException, description, ...) \
957 | do { \
958 | @try { \
959 | (expr);\
960 | } \
961 | @catch (specificException *anException) { \
962 | [self failWithException:[NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
963 | exception: anException \
964 | inFile: [NSString stringWithUTF8String:__FILE__] \
965 | atLine: __LINE__ \
966 | withDescription: GHComposeString(description, ##__VA_ARGS__)]]; \
967 | }\
968 | @catch (id anythingElse) {\
969 | ; \
970 | }\
971 | } while (0)
972 |
973 |
974 | /*!
975 | Generates a failure when expression does throw an exception of a
976 | specific class with a specific name. Useful for those frameworks like
977 | AppKit or Foundation that throw generic NSException w/specific names
978 | (NSInvalidArgumentException, etc).
979 |
980 | @param expression The expression that is evaluated.
981 | @param specificException The specified class of the exception
982 | @param aName The name of the specified exception
983 | @param description A format string as in the printf() function. Can be nil or an empty string but must be present
984 | @param ... A variable number of arguments to the format string. Can be absent
985 | */
986 | #define GHAssertNoThrowSpecificNamed(expr, specificException, aName, description, ...) \
987 | do { \
988 | @try { \
989 | (expr);\
990 | } \
991 | @catch (specificException *anException) { \
992 | if ([aName isEqualToString: [anException name]]) { \
993 | NSString *_descrip = GHComposeString(@"(Expected exception: %@ (name: %@)) %@", NSStringFromClass([specificException class]), aName, description);\
994 | [self failWithException: \
995 | [NSException ghu_failureInRaise: [NSString stringWithUTF8String:#expr] \
996 | exception: anException \
997 | inFile: [NSString stringWithUTF8String:__FILE__] \
998 | atLine: __LINE__ \
999 | withDescription: GHComposeString(_descrip, ##__VA_ARGS__)]]; \
1000 | } \
1001 | continue; \
1002 | }\
1003 | @catch (id anythingElse) {\
1004 | ; \
1005 | }\
1006 | } while (0)
1007 |
1008 |
1009 | @interface NSException(GHTestMacros_GTMSenTestAdditions)
1010 | + (NSException *)ghu_failureInFile:(NSString *)filename
1011 | atLine:(int)lineNumber
1012 | withDescription:(NSString *)formatString, ...;
1013 | + (NSException *)ghu_failureInCondition:(NSString *)condition
1014 | isTrue:(BOOL)isTrue
1015 | inFile:(NSString *)filename
1016 | atLine:(int)lineNumber
1017 | withDescription:(NSString *)formatString, ...;
1018 | + (NSException *)ghu_failureInEqualityBetweenObject:(id)left
1019 | andObject:(id)right
1020 | inFile:(NSString *)filename
1021 | atLine:(int)lineNumber
1022 | withDescription:(NSString *)formatString, ...;
1023 | + (NSException *)ghu_failureInInequalityBetweenObject:(id)left
1024 | andObject:(id)right
1025 | inFile:(NSString *)filename
1026 | atLine:(int)lineNumber
1027 | withDescription:(NSString *)formatString, ...;
1028 | + (NSException *)ghu_failureInEqualityBetweenValue:(NSValue *)left
1029 | andValue:(NSValue *)right
1030 | withAccuracy:(NSValue *)accuracy
1031 | inFile:(NSString *)filename
1032 | atLine:(int) ineNumber
1033 | withDescription:(NSString *)formatString, ...;
1034 | + (NSException *)ghu_failureInRaise:(NSString *)expression
1035 | inFile:(NSString *)filename
1036 | atLine:(int)lineNumber
1037 | withDescription:(NSString *)formatString, ...;
1038 | + (NSException *)ghu_failureInRaise:(NSString *)expression
1039 | exception:(NSException *)exception
1040 | inFile:(NSString *)filename
1041 | atLine:(int)lineNumber
1042 | withDescription:(NSString *)formatString, ...;
1043 | @end
1044 |
1045 | // SENTE_END
1046 |
--------------------------------------------------------------------------------