From 9311d80614cf709f942d5b53422e8848ecb543cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 17:41:00 +0200 Subject: [PATCH] MeshTools: better assertion message for interleave(). Print expected and actual count to simplify debugging. Also the phrase "nothing done." is useless, as nothing is _ever_ done after assertion failure. Probably remains from the times where that wasn't assertion but merely harmless warning. --- src/MeshTools/Interleave.h | 2 +- src/MeshTools/Test/InterleaveTest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MeshTools/Interleave.h b/src/MeshTools/Interleave.h index e95ec8ebd..8396219ae 100644 --- a/src/MeshTools/Interleave.h +++ b/src/MeshTools/Interleave.h @@ -76,7 +76,7 @@ class Interleave { } template static typename std::enable_if::value, std::size_t>::type attributeCount(const T& first, const U&... next) { - CORRADE_ASSERT(sizeof...(next) == 0 || attributeCount(next...) == first.size() || attributeCount(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, nothing done.", 0); + CORRADE_ASSERT(sizeof...(next) == 0 || attributeCount(next...) == first.size() || attributeCount(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, expected" << first.size() << "but got" << attributeCount(next...), 0); return first.size(); } diff --git a/src/MeshTools/Test/InterleaveTest.cpp b/src/MeshTools/Test/InterleaveTest.cpp index d987be6ee..13375461f 100644 --- a/src/MeshTools/Test/InterleaveTest.cpp +++ b/src/MeshTools/Test/InterleaveTest.cpp @@ -57,7 +57,7 @@ void InterleaveTest::attributeCount() { Error::setOutput(&ss); CORRADE_COMPARE((Implementation::Interleave::attributeCount(std::vector{0, 1, 2}, std::vector{0, 1, 2, 3, 4, 5})), std::size_t(0)); - CORRADE_COMPARE(ss.str(), "MeshTools::interleave(): attribute arrays don't have the same length, nothing done.\n"); + CORRADE_COMPARE(ss.str(), "MeshTools::interleave(): attribute arrays don't have the same length, expected 3 but got 6\n"); CORRADE_COMPARE((Implementation::Interleave::attributeCount(std::vector{0, 1, 2}, std::vector{3, 4, 5})), std::size_t(3));