diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-02-17 20:58:17 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-02-17 20:58:17 +0000 |
| commit | ec3e81b7a7be77836ac52dc6168aa5ac4c498217 (patch) | |
| tree | 6feacc63f6f2cfa51463831a1ea7399f8de9be81 /Tests/TestApp/include | |
| parent | Fixed few compiler warnings (diff) | |
| download | DiligentEngine-ec3e81b7a7be77836ac52dc6168aa5ac4c498217.tar.gz DiligentEngine-ec3e81b7a7be77836ac52dc6168aa5ac4c498217.zip | |
Added test result reporting
Diffstat (limited to 'Tests/TestApp/include')
25 files changed, 140 insertions, 25 deletions
diff --git a/Tests/TestApp/include/AllocatorTest.h b/Tests/TestApp/include/AllocatorTest.h index c6854ea..f24a97c 100644 --- a/Tests/TestApp/include/AllocatorTest.h +++ b/Tests/TestApp/include/AllocatorTest.h @@ -23,7 +23,9 @@ #pragma once -class AllocatorTest +#include "UnitTestBase.h" + +class AllocatorTest : public UnitTestBase { public: AllocatorTest(); diff --git a/Tests/TestApp/include/MTResourceCreationTest.h b/Tests/TestApp/include/MTResourceCreationTest.h index 8e3d979..6073c65 100644 --- a/Tests/TestApp/include/MTResourceCreationTest.h +++ b/Tests/TestApp/include/MTResourceCreationTest.h @@ -28,7 +28,9 @@ #include <atomic> #include <condition_variable> -class MTResourceCreationTest +#include "UnitTestBase.h" + +class MTResourceCreationTest : public UnitTestBase { public: MTResourceCreationTest(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pContext, Diligent::Uint32 NumThreads); diff --git a/Tests/TestApp/include/RenderScriptTest.h b/Tests/TestApp/include/RenderScriptTest.h index 76aeb2d..8675c0d 100644 --- a/Tests/TestApp/include/RenderScriptTest.h +++ b/Tests/TestApp/include/RenderScriptTest.h @@ -23,7 +23,9 @@ #pragma once -class RenderScriptTest +#include "UnitTestBase.h" + +class RenderScriptTest : public UnitTestBase { public: RenderScriptTest( Diligent::IRenderDevice *pRenderDevice, Diligent::IDeviceContext *pContext ); diff --git a/Tests/TestApp/include/ShaderConverterTest.h b/Tests/TestApp/include/ShaderConverterTest.h index d064201..4b90a26 100644 --- a/Tests/TestApp/include/ShaderConverterTest.h +++ b/Tests/TestApp/include/ShaderConverterTest.h @@ -23,7 +23,9 @@ #pragma once -class ShaderConverterTest +#include "UnitTestBase.h" + +class ShaderConverterTest : public UnitTestBase { public: ShaderConverterTest( Diligent::IRenderDevice *pRenderDevice, Diligent::IDeviceContext *pContext ); diff --git a/Tests/TestApp/include/SmartPointerTest.h b/Tests/TestApp/include/SmartPointerTest.h index 1e22a7d..5d7407a 100644 --- a/Tests/TestApp/include/SmartPointerTest.h +++ b/Tests/TestApp/include/SmartPointerTest.h @@ -30,9 +30,11 @@ #include <condition_variable> #include <atomic> -class SmartPointerTest +#include "UnitTestBase.h" + +class SmartPointerTest : public UnitTestBase { -public: +public: class Object : public Diligent::RefCountedObject<Diligent::IObject> { public: diff --git a/Tests/TestApp/include/TestBlendState.h b/Tests/TestApp/include/TestBlendState.h index 9c7d411..a7fd655 100644 --- a/Tests/TestApp/include/TestBlendState.h +++ b/Tests/TestApp/include/TestBlendState.h @@ -24,6 +24,7 @@ #pragma once #include "TestPipelineStateBase.h" +#include "UnitTestBase.h" class TestBlendState : public TestPipelineStateBase { diff --git a/Tests/TestApp/include/TestBufferAccess.h b/Tests/TestApp/include/TestBufferAccess.h index c4bf038..b864960 100644 --- a/Tests/TestApp/include/TestBufferAccess.h +++ b/Tests/TestApp/include/TestBufferAccess.h @@ -23,7 +23,9 @@ #pragma once -class TestBufferAccess +#include "UnitTestBase.h" + +class TestBufferAccess : public UnitTestBase { public: static const int TriGridSize = 16; @@ -44,4 +46,4 @@ private: Diligent::RefCntAutoPtr<Diligent::IPipelineState> m_pPSO; Diligent::RefCntAutoPtr<Diligent::IBuffer> m_pVertexBuff, m_pInstBuff[7]; float m_fXExtent, m_fYExtent; -};
\ No newline at end of file +}; diff --git a/Tests/TestApp/include/TestBufferCreation.h b/Tests/TestApp/include/TestBufferCreation.h index b36d101..644606b 100644 --- a/Tests/TestApp/include/TestBufferCreation.h +++ b/Tests/TestApp/include/TestBufferCreation.h @@ -23,8 +23,9 @@ #pragma once +#include "UnitTestBase.h" -class TestBufferCreation +class TestBufferCreation : public UnitTestBase { public: TestBufferCreation(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pContext); diff --git a/Tests/TestApp/include/TestComputeShaders.h b/Tests/TestApp/include/TestComputeShaders.h index 7042d65..797b39d 100644 --- a/Tests/TestApp/include/TestComputeShaders.h +++ b/Tests/TestApp/include/TestComputeShaders.h @@ -24,8 +24,9 @@ #pragma once #include "ScriptParser.h" +#include "UnitTestBase.h" -class TestComputeShaders +class TestComputeShaders : public UnitTestBase { public: TestComputeShaders(); diff --git a/Tests/TestApp/include/TestCopyTexData.h b/Tests/TestApp/include/TestCopyTexData.h index 5fa57ae..913ea35 100644 --- a/Tests/TestApp/include/TestCopyTexData.h +++ b/Tests/TestApp/include/TestCopyTexData.h @@ -23,7 +23,9 @@ #pragma once -class TestCopyTexData +#include "UnitTestBase.h" + +class TestCopyTexData : public UnitTestBase { public: TestCopyTexData(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pContext); diff --git a/Tests/TestApp/include/TestCreateObjFromNativeRes.h b/Tests/TestApp/include/TestCreateObjFromNativeRes.h index a0b1e8e..1e9b335 100644 --- a/Tests/TestApp/include/TestCreateObjFromNativeRes.h +++ b/Tests/TestApp/include/TestCreateObjFromNativeRes.h @@ -23,10 +23,26 @@ #pragma once -class TestCreateObjFromNativeRes +#include "UnitTestBase.h" + +class TestCreateObjFromNativeRes : public UnitTestBase { public: - virtual ~TestCreateObjFromNativeRes() {} + TestCreateObjFromNativeRes() : UnitTestBase("Object initialization from native resource handle test") {} + virtual ~TestCreateObjFromNativeRes() + { + if(m_NumTexturesCreated != 0 || m_NumBuffersCreated != 0 ) + { + std::stringstream infoss; + infoss << "Textures crated: " << m_NumTexturesCreated <<" Buffers created: " << m_NumBuffersCreated; + SetStatus(TestResult::Succeeded, infoss.str().c_str()); + } + else + SetStatus(TestResult::Skipped); + } virtual void CreateTexture(Diligent::ITexture *pTexture) = 0; virtual void CreateBuffer(Diligent::IBuffer *pBuffer) = 0; +protected: + int m_NumTexturesCreated = 0; + int m_NumBuffersCreated = 0; }; diff --git a/Tests/TestApp/include/TestCreateObjFromNativeResGL.h b/Tests/TestApp/include/TestCreateObjFromNativeResGL.h index ae4d5b1..3d1a0cd 100644 --- a/Tests/TestApp/include/TestCreateObjFromNativeResGL.h +++ b/Tests/TestApp/include/TestCreateObjFromNativeResGL.h @@ -24,6 +24,7 @@ #pragma once #include "TestCreateObjFromNativeRes.h" + class TestCreateObjFromNativeResGL : public TestCreateObjFromNativeRes { public: diff --git a/Tests/TestApp/include/TestDepthStencilState.h b/Tests/TestApp/include/TestDepthStencilState.h index c08ce30..ca28685 100644 --- a/Tests/TestApp/include/TestDepthStencilState.h +++ b/Tests/TestApp/include/TestDepthStencilState.h @@ -24,6 +24,7 @@ #pragma once #include "TestPipelineStateBase.h" + class TestDepthStencilState : public TestPipelineStateBase { public: @@ -32,4 +33,4 @@ public: private: void CreateTestDSS( Diligent::DepthStencilStateDesc &DSSDesc ); Diligent::RefCntAutoPtr<Diligent::IDeviceContext> m_pDeviceContext; -};
\ No newline at end of file +}; diff --git a/Tests/TestApp/include/TestDrawCommands.h b/Tests/TestApp/include/TestDrawCommands.h index 3faaeea..00dce01 100644 --- a/Tests/TestApp/include/TestDrawCommands.h +++ b/Tests/TestApp/include/TestDrawCommands.h @@ -23,9 +23,13 @@ #pragma once -class TestDrawCommands +#include "UnitTestBase.h" + +class TestDrawCommands : public UnitTestBase { public: + TestDrawCommands() : UnitTestBase("Draw commands test"){} + static const int TriGridSize = 16; void Init(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent); diff --git a/Tests/TestApp/include/TestGeometryShader.h b/Tests/TestApp/include/TestGeometryShader.h index 65d7151..7f9577b 100644 --- a/Tests/TestApp/include/TestGeometryShader.h +++ b/Tests/TestApp/include/TestGeometryShader.h @@ -23,9 +23,13 @@ #pragma once -class TestGeometryShader +#include "UnitTestBase.h" + +class TestGeometryShader : public UnitTestBase { public: + TestGeometryShader() : UnitTestBase("Test Geometry Shaders"){} + void Init(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext); void Draw(); diff --git a/Tests/TestApp/include/TestPipelineStateBase.h b/Tests/TestApp/include/TestPipelineStateBase.h index 177d595..c66166f 100644 --- a/Tests/TestApp/include/TestPipelineStateBase.h +++ b/Tests/TestApp/include/TestPipelineStateBase.h @@ -23,10 +23,12 @@ #pragma once -class TestPipelineStateBase +#include "UnitTestBase.h" + +class TestPipelineStateBase : public UnitTestBase { public: - TestPipelineStateBase( Diligent::IRenderDevice *pDevice ); + TestPipelineStateBase( Diligent::IRenderDevice *pDevice, const char *TestName ); protected: Diligent::RefCntAutoPtr<Diligent::IRenderDevice> m_pDevice; diff --git a/Tests/TestApp/include/TestRasterizerState.h b/Tests/TestApp/include/TestRasterizerState.h index db6c268..ad08a75 100644 --- a/Tests/TestApp/include/TestRasterizerState.h +++ b/Tests/TestApp/include/TestRasterizerState.h @@ -24,6 +24,7 @@ #pragma once #include "TestPipelineStateBase.h" + class TestRasterizerState : public TestPipelineStateBase { public: diff --git a/Tests/TestApp/include/TestRenderTarget.h b/Tests/TestApp/include/TestRenderTarget.h index dde43c3..0277c93 100644 --- a/Tests/TestApp/include/TestRenderTarget.h +++ b/Tests/TestApp/include/TestRenderTarget.h @@ -24,8 +24,9 @@ #pragma once #include "ScriptParser.h" +#include "UnitTestBase.h" -class TestRenderTarget +class TestRenderTarget : public UnitTestBase { public: TestRenderTarget(); diff --git a/Tests/TestApp/include/TestSamplerCreation.h b/Tests/TestApp/include/TestSamplerCreation.h index c6a6ff9..e6b67b2 100644 --- a/Tests/TestApp/include/TestSamplerCreation.h +++ b/Tests/TestApp/include/TestSamplerCreation.h @@ -23,7 +23,9 @@ #pragma once -class TestSamplerCreation +#include "UnitTestBase.h" + +class TestSamplerCreation : public UnitTestBase { public: TestSamplerCreation(Diligent::IRenderDevice *pDevice); diff --git a/Tests/TestApp/include/TestShaderResArrays.h b/Tests/TestApp/include/TestShaderResArrays.h index 9ba0c7d..ae5a417 100644 --- a/Tests/TestApp/include/TestShaderResArrays.h +++ b/Tests/TestApp/include/TestShaderResArrays.h @@ -23,7 +23,9 @@ #pragma once -class TestShaderResArrays +#include "UnitTestBase.h" + +class TestShaderResArrays : public UnitTestBase { public: TestShaderResArrays(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext, bool bUseOpenGL, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent); diff --git a/Tests/TestApp/include/TestTessellation.h b/Tests/TestApp/include/TestTessellation.h index baa3456..48c1150 100644 --- a/Tests/TestApp/include/TestTessellation.h +++ b/Tests/TestApp/include/TestTessellation.h @@ -23,9 +23,12 @@ #pragma once -class TestTessellation +#include "UnitTestBase.h" + +class TestTessellation : public UnitTestBase { public: + TestTessellation() : UnitTestBase("Tessellation test") {} void Init(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext); void Draw(); diff --git a/Tests/TestApp/include/TestTextureCreation.h b/Tests/TestApp/include/TestTextureCreation.h index 20b44c3..a3b2907 100644 --- a/Tests/TestApp/include/TestTextureCreation.h +++ b/Tests/TestApp/include/TestTextureCreation.h @@ -23,9 +23,11 @@ #pragma once +#include "UnitTestBase.h" + const bool bIsGL43 = false; -class TestTextureCreation +class TestTextureCreation : public UnitTestBase { public: TestTextureCreation(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pContext); @@ -35,4 +37,6 @@ private: void CheckFormatSize( Diligent::TEXTURE_FORMAT *begin, Diligent::TEXTURE_FORMAT *end, Diligent::Uint32 RefSize ); void CheckNumComponents( Diligent::TEXTURE_FORMAT *begin, Diligent::TEXTURE_FORMAT *end, Diligent::Uint32 RefComponents ); void CheckComponentType( Diligent::TEXTURE_FORMAT *begin, Diligent::TEXTURE_FORMAT *end, Diligent::COMPONENT_TYPE RefType ); + + int m_NumFormatsTested = 0; }; diff --git a/Tests/TestApp/include/TestTexturing.h b/Tests/TestApp/include/TestTexturing.h index 8649674..ed55bac 100644 --- a/Tests/TestApp/include/TestTexturing.h +++ b/Tests/TestApp/include/TestTexturing.h @@ -23,7 +23,9 @@ #pragma once -class TestTexturing +#include "UnitTestBase.h" + +class TestTexturing : public UnitTestBase { public: TestTexturing(); diff --git a/Tests/TestApp/include/TestVPAndSR.h b/Tests/TestApp/include/TestVPAndSR.h index 4c0e01d..07893d5 100644 --- a/Tests/TestApp/include/TestVPAndSR.h +++ b/Tests/TestApp/include/TestVPAndSR.h @@ -23,9 +23,10 @@ #pragma once +#include "UnitTestBase.h" #include "ScriptParser.h" -class TestVPAndSR +class TestVPAndSR : public UnitTestBase { public: TestVPAndSR(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pContext); diff --git a/Tests/TestApp/include/UnitTestBase.h b/Tests/TestApp/include/UnitTestBase.h new file mode 100644 index 0000000..38b3fd0 --- /dev/null +++ b/Tests/TestApp/include/UnitTestBase.h @@ -0,0 +1,54 @@ +/* Copyright 2015-2017 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include <string> +#include "UnitTestBase.h" + +class UnitTestBase +{ +public: + enum class TestResult + { + Unknown = 0, + Skipped, + Failed, + Succeeded + }; + UnitTestBase(const char *Name); + ~UnitTestBase(); + void SetStatus(TestResult result, const char *info ="") + { + m_TestResult = result; + m_TestResultInfo = info != nullptr ? info : ""; + } + +protected: + std::string m_TestName; + TestResult m_TestResult = TestResult::Unknown; + std::string m_TestResultInfo; + int m_TestNum = 0; + static int m_TotalTests; + static size_t m_MaxNameLen; +}; |
