main_test.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2010-2016 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause
  4. */
  5. #define CATCH_CONFIG_RUNNER
  6. #include "test.h"
  7. static const char* s_argv[] = { "bx.test" };
  8. int runAllTests(int _argc, const char* _argv[])
  9. {
  10. DBG(BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME);
  11. return Catch::Session().run(_argc, _argv);
  12. }
  13. #if BX_PLATFORM_ANDROID
  14. # include <android/native_activity.h>
  15. void ANativeActivity_onCreate(ANativeActivity*, void*, size_t)
  16. {
  17. exit(runAllTests(BX_COUNTOF(s_argv), s_argv) );
  18. }
  19. #elif BX_PLATFORM_NACL
  20. # include <ppapi/c/pp_errors.h>
  21. # include <ppapi/c/ppp.h>
  22. PP_EXPORT const void* PPP_GetInterface(const char* /*_name*/)
  23. {
  24. return NULL;
  25. }
  26. PP_EXPORT int32_t PPP_InitializeModule(PP_Module /*_module*/, PPB_GetInterface /*_interface*/)
  27. {
  28. DBG("PPAPI version: %d", PPAPI_RELEASE);
  29. runAllTests(BX_COUNTOF(s_argv), s_argv);
  30. return PP_ERROR_NOINTERFACE;
  31. }
  32. PP_EXPORT void PPP_ShutdownModule()
  33. {
  34. }
  35. #else
  36. int main(int _argc, const char* _argv[])
  37. {
  38. return runAllTests(_argc, _argv);
  39. }
  40. #endif // BX_PLATFORM