UnitTestHelper.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 <AZTestShared/Math/MathTestHelpers.h>
  10. #include <AzCore/std/containers/vector.h>
  11. #include <AzCore/Math/Vector3.h>
  12. #include <AzCore/Math/Vector4.h>
  13. #include <AzCore/Math/Quaternion.h>
  14. #include <NvCloth/Types.h>
  15. // NvCloth library includes
  16. #include <NvCloth/Range.h>
  17. #include <foundation/PxVec3.h>
  18. #include <foundation/PxVec4.h>
  19. #include <foundation/PxQuat.h>
  20. #include <NvClothExt/ClothFabricCooker.h>
  21. namespace UnitTest
  22. {
  23. static constexpr float Tolerance = 1e-4f;
  24. static constexpr float ToleranceU8 = 1.0f / 255.0f;
  25. void ExpectEq(const AZ::Vector3& azVec, const physx::PxVec3& pxVec, const float tolerance = Tolerance);
  26. void ExpectEq(const AZ::Vector4& azVec, const physx::PxVec4& pxVec, const float tolerance = Tolerance);
  27. void ExpectEq(const AZ::Quaternion& azQuat, const physx::PxQuat& pxQuat, const float tolerance = Tolerance);
  28. void ExpectEq(const physx::PxVec4& pxVecA, const physx::PxVec4& pxVecB, const float tolerance = Tolerance);
  29. void ExpectEq(const NvCloth::FabricCookedData::InternalCookedData& azCookedData, const nv::cloth::CookedData& nvCookedData, const float tolerance = Tolerance);
  30. void ExpectEq(const NvCloth::FabricCookedData::InternalCookedData& azCookedDataA, const NvCloth::FabricCookedData::InternalCookedData& azCookedDataB, const float tolerance = Tolerance);
  31. void ExpectEq(const NvCloth::FabricCookedData& fabricCookedDataA, const NvCloth::FabricCookedData& fabricCookedDataB, const float tolerance = Tolerance);
  32. void ExpectEq(const AZStd::vector<float>& azVecA, const AZStd::vector<float> azVecB, const float tolerance = Tolerance);
  33. void ExpectEq(const AZStd::vector<AZ::s32>& azVector, const nv::cloth::Range<const AZ::s32>& nvRange);
  34. void ExpectEq(const AZStd::vector<AZ::u32>& azVector, const nv::cloth::Range<const AZ::u32>& nvRange);
  35. void ExpectEq(const AZStd::vector<float>& azVector, const nv::cloth::Range<const float>& nvRange, const float tolerance = Tolerance);
  36. void ExpectEq(const AZStd::vector<AZ::Vector4>& azVector, const nv::cloth::Range<const physx::PxVec4>& nvRange, const float tolerance = Tolerance);
  37. NvCloth::FabricCookedData CreateTestFabricCookedData();
  38. } // namespace UnitTest