main.cpp 881 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include <gtest/gtest.h>
  2. #include "Bullet3Common/b3Logging.h"
  3. void myerrorprintf(const char* msg)
  4. {
  5. printf("%s", msg);
  6. }
  7. static bool sVerboseWarning = true;
  8. void mywarningprintf(const char* msg)
  9. {
  10. if (sVerboseWarning)
  11. {
  12. //OutputDebugStringA(msg);
  13. printf("%s", msg);
  14. }
  15. }
  16. static bool sVerbosePrintf = true; //false;
  17. void myprintf(const char* msg)
  18. {
  19. if (sVerbosePrintf)
  20. {
  21. //OutputDebugStringA(msg);
  22. printf("%s", msg);
  23. }
  24. }
  25. int gArgc = 0;
  26. char** gArgv = 0;
  27. int main(int argc, char** argv)
  28. {
  29. #if _MSC_VER
  30. _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
  31. //void *testWhetherMemoryLeakDetectionWorks = malloc(1);
  32. #endif
  33. ::testing::InitGoogleTest(&argc, argv);
  34. gArgc = argc;
  35. gArgv = argv;
  36. b3SetCustomPrintfFunc(myprintf);
  37. b3SetCustomWarningMessageFunc(mywarningprintf);
  38. b3SetCustomErrorMessageFunc(myerrorprintf);
  39. return RUN_ALL_TESTS();
  40. }