Main.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 <AzCore/Debug/TraceMessageBus.h>
  9. #include <AzCore/std/typetraits/typetraits.h>
  10. #include <AzCore/UnitTest/TestTypes.h>
  11. #include <AzTest/AzTest.h>
  12. #include <AzCore/Memory/OSAllocator.h>
  13. DECLARE_AZ_UNIT_TEST_MAIN()
  14. namespace AZ
  15. {
  16. inline void* AZMemAlloc(AZStd::size_t byteSize, AZStd::size_t alignment, const char* name = "No name allocation")
  17. {
  18. (void)name;
  19. return AZ_OS_MALLOC(byteSize, alignment);
  20. }
  21. inline void AZFree(void* ptr, AZStd::size_t byteSize = 0, AZStd::size_t alignment = 0)
  22. {
  23. (void)byteSize;
  24. (void)alignment;
  25. AZ_OS_FREE(ptr);
  26. }
  27. }
  28. // END OF TEMP MEMORY ALLOCATIONS
  29. using namespace AZ;
  30. // Handle asserts
  31. class TestEnvironmentHook
  32. : public AZ::Test::ITestEnvironment
  33. , public UnitTest::TraceBusRedirector
  34. {
  35. public:
  36. void SetupEnvironment() override
  37. {
  38. BusConnect();
  39. }
  40. void TeardownEnvironment() override
  41. {
  42. BusDisconnect();
  43. }
  44. };
  45. AZ_UNIT_TEST_HOOK(new TestEnvironmentHook());