HashCombineTest.cpp 828 B

12345678910111213141516171819202122232425262728293031
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2024 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #include "UnitTestFramework.h"
  5. #include <Jolt/Core/HashCombine.h>
  6. TEST_SUITE("HashCombineTest")
  7. {
  8. TEST_CASE("TestHashBytes")
  9. {
  10. CHECK(HashBytes("This is a test", 14) == 2733878766136413408UL);
  11. }
  12. TEST_CASE("TestHashString")
  13. {
  14. CHECK(HashString("This is a test") == 2733878766136413408UL);
  15. }
  16. TEST_CASE("TestHashStruct")
  17. {
  18. const char *char_test = "This is a test";
  19. CHECK(Hash<const char *> { } (char_test) == 2733878766136413408UL);
  20. std::string_view str_view_test = "This is a test";
  21. CHECK(Hash<std::string_view> { } (str_view_test) == 2733878766136413408UL);
  22. String str_test = "This is a test";
  23. CHECK(Hash<String> { } (str_test) == 2733878766136413408UL);
  24. }
  25. }