main.cpp 991 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzTest/AzTest.h>
  9. DECLARE_AZ_UNIT_TEST_MAIN();
  10. int runDefaultRunner(int argc, char* argv[])
  11. {
  12. INVOKE_AZ_UNIT_TEST_MAIN(nullptr)
  13. return 0;
  14. }
  15. int main(int argc, char* argv[])
  16. {
  17. const AZ::Debug::Trace tracer;
  18. AZ::Debug::Trace::HandleExceptions(true);
  19. AZ::Test::ApplyGlobalParameters(&argc, argv);
  20. if (argc == 1)
  21. {
  22. // if no parameters are provided, add the --unittests parameter
  23. constexpr int defaultArgc = 2;
  24. char unittest_arg[] = "--unittests"; // Conversion from string literal to char* is not allowed per ISO C++11
  25. char* defaultArgv[defaultArgc] = { argv[0], unittest_arg };
  26. return runDefaultRunner(defaultArgc, defaultArgv);
  27. }
  28. INVOKE_AZ_UNIT_TEST_MAIN(nullptr);
  29. return 0;
  30. }