Statistics
| Branch: | Revision:

root / asi-http-request-with-pithos / iPhone Sample / GHUnitIOSTestMain.m @ be116d22

History | View | Annotate | Download (3.1 kB)

1
//
2
//  GHUnitIOSTestMain.m
3
//  GHUnitIPhone
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 <UIKit/UIKit.h>
31

    
32
// If you are using the framework
33
#import <GHUnitIOS/GHUnit.h>
34
// If you are using the static library and importing header files manually
35
//#import "GHUnit.h"
36

    
37
// Default exception handler
38
void exceptionHandler(NSException *exception) { 
39
  NSLog(@"%@\n%@", [exception reason], GHUStackTraceFromException(exception));
40
}
41

    
42
int main(int argc, char *argv[]) {
43
  
44
  /*!
45
   For debugging:
46
   Go into the "Get Info" contextual menu of your (test) executable (inside the "Executables" group in the left panel of XCode). 
47
   Then go in the "Arguments" tab. You can add the following environment variables:
48
   
49
   Default:   Set to:
50
   NSDebugEnabled                        NO       "YES"
51
   NSZombieEnabled                       NO       "YES"
52
   NSDeallocateZombies                   NO       "YES"
53
   NSHangOnUncaughtException             NO       "YES"
54
   
55
   NSEnableAutoreleasePool              YES       "NO"
56
   NSAutoreleaseFreedObjectCheckEnabled  NO       "YES"
57
   NSAutoreleaseHighWaterMark             0       non-negative integer
58
   NSAutoreleaseHighWaterResolution       0       non-negative integer
59
   
60
   For info on these varaiables see NSDebug.h; http://theshadow.uw.hu/iPhoneSDKdoc/Foundation.framework/NSDebug.h.html
61
   
62
   For malloc debugging see: http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html
63
   */
64
  
65
  NSSetUncaughtExceptionHandler(&exceptionHandler);
66
  
67
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
68
  
69
  // Register any special test case classes
70
  //[[GHTesting sharedInstance] registerClassName:@"GHSpecialTestCase"];  
71
  
72
  int retVal = 0;
73
  // If GHUNIT_CLI is set we are using the command line interface and run the tests
74
  // Otherwise load the GUI app
75
  if (getenv("GHUNIT_CLI")) {
76
    retVal = [GHTestRunner run];
77
  } else {
78
    retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIPhoneAppDelegate");
79
  }
80
  [pool release];
81
  return retVal;
82
}