Change cpp unit test framework to catch2 for all cpp unit test projects

This commit is contained in:
Jan
2021-02-20 10:44:33 +01:00
parent 7ff87c2b73
commit b4f1e09315
7 changed files with 50 additions and 40 deletions

View File

@ -1,22 +1,17 @@
#include "CppUnitTest.h"
#include <catch2/catch.hpp>
#include "Image/ImageFormat.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace ObjCommonTests
namespace image::image_format
{
TEST_CLASS(ImageFormatTests)
TEST_CASE("ImageFormat: EnsureAllFormatsArrayIndicesAreIds", "[image]")
{
public:
TEST_METHOD(EnsureAllFormatsArrayIndicesAreIds)
{
Assert::AreEqual(static_cast<unsigned int>(ImageFormatId::MAX), _countof(ImageFormat::ALL_FORMATS));
REQUIRE(static_cast<unsigned int>(ImageFormatId::MAX) == _countof(ImageFormat::ALL_FORMATS));
for(unsigned i = 0; i < _countof(ImageFormat::ALL_FORMATS); i++)
{
Assert::IsNotNull(ImageFormat::ALL_FORMATS[i]);
Assert::AreEqual(i, static_cast<unsigned>(ImageFormat::ALL_FORMATS[i]->GetId()));
}
for(unsigned i = 0; i < _countof(ImageFormat::ALL_FORMATS); i++)
{
REQUIRE(ImageFormat::ALL_FORMATS[i] != nullptr);
REQUIRE(i == static_cast<unsigned>(ImageFormat::ALL_FORMATS[i]->GetId()));
}
};
}
}