stdafx.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. #pragma warning(disable: 4127) // constant expression for Trace/Assert
  7. #include <map>
  8. #define IfFailedReturn(EXPR) do { hr = (EXPR); if (FAILED(hr)) { return hr; }} while(FALSE)
  9. #define IfFailedGoLabel(expr, label) do { hr = (expr); if (FAILED(hr)) { goto label; } } while (FALSE)
  10. #define IfFailGo(expr) IfFailedGoLabel(hr = (expr), Error)
  11. #define IfFalseGo(expr) do { if(!(expr)) { hr = E_FAIL; goto Error; } } while(0)
  12. #ifdef Assert
  13. #undef Assert
  14. #endif
  15. #ifdef AssertMsg
  16. #undef AssertMsg
  17. #endif
  18. #if defined(DBG)
  19. #define DebugOnly(x) x
  20. #define AssertMsg(exp, comment) \
  21. do { \
  22. if (!(exp)) \
  23. { \
  24. fprintf(stderr, "ASSERTION (%s, line %d) %s %s\n", __FILE__, __LINE__, _STRINGIZE(exp), comment); \
  25. fflush(stderr); \
  26. DebugBreak(); \
  27. } \
  28. } while (0)
  29. #else
  30. #define AssertMsg(exp, comment) ((void)0)
  31. #endif //defined(DBG)
  32. #define Assert(exp) AssertMsg(exp, #exp)
  33. #define _JSRT_
  34. #include "ChakraCore.h"
  35. #include "Core/CommonTypedefs.h"
  36. #include <FileLoadHelpers.h>
  37. #include "TestHooks.h"
  38. extern TestHooks g_testHooks;
  39. extern bool g_testHooksLoaded;