/core/externals/update-engine/externals/google-toolbox-for-mac/UnitTesting/GTMIPhoneUnitTestMain.m

http://macfuse.googlecode.com/ · Objective C · 48 lines · 24 code · 2 blank · 22 comment · 1 complexity · db50c91b3f40817fe703b0098035fe42 MD5 · raw file

  1. //
  2. // GTMIPhoneUnitTestMain.m
  3. //
  4. // Copyright 2008 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import "GTMDefines.h"
  19. #if !GTM_IPHONE_SDK
  20. #error GTMIPhoneUnitTestMain for iPhone only
  21. #endif
  22. #import <UIKit/UIKit.h>
  23. // Creates an application that runs all tests from classes extending
  24. // SenTestCase, outputs results and test run time, and terminates right
  25. // afterwards.
  26. int main(int argc, char *argv[]) {
  27. int retVal;
  28. #if __has_feature(objc_arc)
  29. @autoreleasepool {
  30. #else
  31. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  32. #endif
  33. #if GTM_IPHONE_USE_SENTEST
  34. // Is using SenTest, just create a dummy app that can be used as the
  35. // TEST_HOST.
  36. retVal = UIApplicationMain(argc, argv, nil, nil);
  37. #else
  38. retVal = UIApplicationMain(argc, argv, nil, @"GTMIPhoneUnitTestDelegate");
  39. #endif
  40. #if __has_feature(objc_arc)
  41. }
  42. #else
  43. [pool release];
  44. #endif
  45. return retVal;
  46. }