From b0546c4edaf3eccf2f8014fa1d5d436437e1deb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 26 Aug 2019 19:40:59 +0200 Subject: [PATCH] Audio: improve extension tests similarly to GL. --- src/Magnum/Audio/Test/ContextTest.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Audio/Test/ContextTest.cpp b/src/Magnum/Audio/Test/ContextTest.cpp index 1eb0138f6..c4b20b734 100644 --- a/src/Magnum/Audio/Test/ContextTest.cpp +++ b/src/Magnum/Audio/Test/ContextTest.cpp @@ -24,6 +24,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include #include @@ -70,7 +71,9 @@ void ContextTest::constructCopyMove() { void ContextTest::extensions() { const char* used[Implementation::ExtensionCount]{}; - /* Check that all extension indices are unique */ + std::set unique; + + /* Check that all extension indices are unique and are listed just once */ for(const Extension& e: Extension::extensions()) { if(e.index() >= Implementation::ExtensionCount) { Error{} << "Index" << e.index() << "used by" << e.string() @@ -85,6 +88,10 @@ void ContextTest::extensions() { } used[e.index()] = e.string(); + if(!unique.insert(e.string()).second) { + Error{} << "Extension" << e.string() << "listed more than once"; + CORRADE_VERIFY(false); + } } CORRADE_VERIFY(true);