mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-27 00:44:35 +00:00
Replaced assert() with new macro TEST() in all tests, to check conditions also in Release configuration.
# Conflicts: # src/SparseBindingTest.cpp # src/Tests.cpp # src/VulkanSample.cpp
This commit is contained in:
parent
1f7f8afdd7
commit
b8d34d5e6a
17
src/Common.h
17
src/Common.h
@ -16,6 +16,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -25,7 +26,21 @@
|
|||||||
typedef std::chrono::high_resolution_clock::time_point time_point;
|
typedef std::chrono::high_resolution_clock::time_point time_point;
|
||||||
typedef std::chrono::high_resolution_clock::duration duration;
|
typedef std::chrono::high_resolution_clock::duration duration;
|
||||||
|
|
||||||
#define ERR_GUARD_VULKAN(Expr) do { VkResult res__ = (Expr); if (res__ < 0) assert(0); } while(0)
|
#ifdef _DEBUG
|
||||||
|
#define TEST(expr) do { \
|
||||||
|
if(!(expr)) { \
|
||||||
|
assert(0 && #expr); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define TEST(expr) do { \
|
||||||
|
if(!(expr)) { \
|
||||||
|
throw std::runtime_error("TEST FAILED: " #expr); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ERR_GUARD_VULKAN(expr) TEST((expr) >= 0)
|
||||||
|
|
||||||
extern VkPhysicalDevice g_hPhysicalDevice;
|
extern VkPhysicalDevice g_hPhysicalDevice;
|
||||||
extern VkDevice g_hDevice;
|
extern VkDevice g_hDevice;
|
||||||
|
368
src/Tests.cpp
368
src/Tests.cpp
File diff suppressed because it is too large
Load Diff
@ -1714,7 +1714,14 @@ static LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
PostMessage(hWnd, WM_CLOSE, 0, 0);
|
PostMessage(hWnd, WM_CLOSE, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
|
try
|
||||||
|
{
|
||||||
Test();
|
Test();
|
||||||
|
}
|
||||||
|
catch(const std::exception& ex)
|
||||||
|
{
|
||||||
|
printf("ERROR: %s\n", ex.what());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user