catch_default_main.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Created by Phil on 20/05/2011.
  3. * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
  4. *
  5. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
  9. #define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
  10. #include "catch_session.h"
  11. #include "catch_platform.h"
  12. #ifndef __OBJC__
  13. #if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
  14. // Standard C/C++ Win32 Unicode wmain entry point
  15. extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
  16. #else
  17. // Standard C/C++ main entry point
  18. int main (int argc, char * argv[]) {
  19. #endif
  20. return Catch::Session().run( argc, argv );
  21. }
  22. #else // __OBJC__
  23. // Objective-C entry point
  24. int main (int argc, char * const argv[]) {
  25. #if !CATCH_ARC_ENABLED
  26. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  27. #endif
  28. Catch::registerTestMethods();
  29. int result = Catch::Session().run( argc, (char**)argv );
  30. #if !CATCH_ARC_ENABLED
  31. [pool drain];
  32. #endif
  33. return result;
  34. }
  35. #endif // __OBJC__
  36. #endif // TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED