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 11 #include "catch_session.h" 12 13 #ifndef __OBJC__ 14 15 #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) 16 // Standard C/C++ Win32 Unicode wmain entry point wmain(int argc,wchar_t * argv[],wchar_t * [])17extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { 18 #else 19 // Standard C/C++ main entry point 20 int main (int argc, char * argv[]) { 21 #endif 22 23 return Catch::Session().run( argc, argv ); 24 } 25 26 #else // __OBJC__ 27 28 // Objective-C entry point 29 int main (int argc, char * const argv[]) { 30 #if !CATCH_ARC_ENABLED 31 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 32 #endif 33 34 Catch::registerTestMethods(); 35 int result = Catch::Session().run( argc, (char**)argv ); 36 37 #if !CATCH_ARC_ENABLED 38 [pool drain]; 39 #endif 40 41 return result; 42 } 43 44 #endif // __OBJC__ 45 46 #endif // TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED 47