diff --git a/src/Magnum/CMakeLists.txt b/src/Magnum/CMakeLists.txt index e6476374f..a0c9a3b0e 100644 --- a/src/Magnum/CMakeLists.txt +++ b/src/Magnum/CMakeLists.txt @@ -29,7 +29,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake # Files shared between main library and unit test library set(Magnum_SRCS FileCallback.cpp - Mesh.cpp PixelStorage.cpp Resource.cpp Sampler.cpp @@ -38,6 +37,7 @@ set(Magnum_SRCS set(Magnum_GracefulAssert_SRCS Image.cpp ImageView.cpp + Mesh.cpp PixelFormat.cpp Animation/Player.cpp diff --git a/src/Magnum/Mesh.cpp b/src/Magnum/Mesh.cpp index 57e0d79a9..97e8ad83d 100644 --- a/src/Magnum/Mesh.cpp +++ b/src/Magnum/Mesh.cpp @@ -39,7 +39,7 @@ UnsignedInt meshIndexTypeSize(MeshIndexType type) { case MeshIndexType::UnsignedInt: return 4; } - CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ + CORRADE_ASSERT(false, "meshIndexTypeSize(): invalid type" << type, {}); } #ifndef DOXYGEN_GENERATING_OUTPUT diff --git a/src/Magnum/Test/CMakeLists.txt b/src/Magnum/Test/CMakeLists.txt index 1cf8df71b..043a0e70b 100644 --- a/src/Magnum/Test/CMakeLists.txt +++ b/src/Magnum/Test/CMakeLists.txt @@ -27,7 +27,7 @@ corrade_add_test(ArrayTest ArrayTest.cpp LIBRARIES Magnum) corrade_add_test(FileCallbackTest FileCallbackTest.cpp LIBRARIES Magnum) corrade_add_test(ImageTest ImageTest.cpp LIBRARIES MagnumTestLib) corrade_add_test(ImageViewTest ImageViewTest.cpp LIBRARIES MagnumTestLib) -corrade_add_test(MeshTest MeshTest.cpp LIBRARIES Magnum) +corrade_add_test(MeshTest MeshTest.cpp LIBRARIES MagnumTestLib) corrade_add_test(PixelFormatTest PixelFormatTest.cpp LIBRARIES MagnumTestLib) target_compile_definitions(PixelFormatTest PRIVATE "CORRADE_GRACEFUL_ASSERT") corrade_add_test(PixelStorageTest PixelStorageTest.cpp LIBRARIES Magnum) diff --git a/src/Magnum/Test/MeshTest.cpp b/src/Magnum/Test/MeshTest.cpp index 0dc66dc9f..517ad4440 100644 --- a/src/Magnum/Test/MeshTest.cpp +++ b/src/Magnum/Test/MeshTest.cpp @@ -39,6 +39,7 @@ struct MeshTest: TestSuite::Tester { void indexTypeMapping(); void indexTypeSize(); + void indexTypeSizeInvalid(); void debugPrimitive(); void debugIndexType(); @@ -51,6 +52,7 @@ MeshTest::MeshTest() { &MeshTest::indexTypeMapping, &MeshTest::indexTypeSize, + &MeshTest::indexTypeSizeInvalid, &MeshTest::debugPrimitive, &MeshTest::debugIndexType, @@ -138,6 +140,15 @@ void MeshTest::indexTypeSize() { CORRADE_COMPARE(meshIndexTypeSize(MeshIndexType::UnsignedInt), 4); } +void MeshTest::indexTypeSizeInvalid() { + std::ostringstream out; + Error redirectError{&out}; + + meshIndexTypeSize(MeshIndexType(0xdead)); + + CORRADE_COMPARE(out.str(), "meshIndexTypeSize(): invalid type MeshIndexType(0xdead)\n"); +} + void MeshTest::debugPrimitive() { std::ostringstream o; Debug(&o) << MeshPrimitive::TriangleFan << MeshPrimitive(0xdead);