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