MathTest.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #pragma once
  9. #include <AzCore/UnitTest/TestTypes.h>
  10. #if AZ_DEBUG_BUILD
  11. #define AZ_MATH_TEST_START_TRACE_SUPPRESSION AZ_TEST_START_TRACE_SUPPRESSION
  12. #define AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(x) AZ_TEST_STOP_TRACE_SUPPRESSION(x)
  13. #else
  14. #define AZ_MATH_TEST_START_TRACE_SUPPRESSION
  15. #define AZ_MATH_TEST_STOP_TRACE_SUPPRESSION(x)
  16. #endif
  17. namespace UnitTest::Constants
  18. {
  19. #if AZ_TRAIT_USE_PLATFORM_SIMD_NEON
  20. // Larger tolerance is needed when using NEON.
  21. static const float SimdTolerance = 0.005f;
  22. // Low precision from NEON causes some estimate functions,
  23. // like SetLengthEstimate(), to need larger tolerance.
  24. static const float SimdToleranceEstimateFuncs = 0.05f;
  25. // Low precision from NEON InvSqrt() leads to AngleDeg tests to need
  26. // large tolerance since converting to degrees exacerbates the low precision.
  27. static const float SimdToleranceAngleDeg = 0.2f;
  28. #else
  29. static const float SimdTolerance = AZ::Constants::Tolerance;
  30. static const float SimdToleranceEstimateFuncs = AZ::Constants::Tolerance;
  31. static const float SimdToleranceAngleDeg = AZ::Constants::Tolerance;
  32. #endif
  33. }