Browse Source

GL,Audio: use CORRADE_ITERATION() in extension list tests.

pull/454/head
Vladimír Vondruš 6 years ago
parent
commit
b45514cb1c
  1. 14
      src/Magnum/Audio/Test/ContextTest.cpp
  2. 21
      src/Magnum/GL/Test/ContextTest.cpp

14
src/Magnum/Audio/Test/ContextTest.cpp

@ -73,23 +73,25 @@ void ContextTest::extensions() {
std::set<std::string> unique;
/* Check that all extension indices are unique and are listed just once */
/* Check that all extension indices are unique, are listed just once etc. */
for(const Extension& e: Extension::extensions()) {
CORRADE_ITERATION(e.string());
/** @todo convert to CORRADE_ERROR() when that's done */
if(e.index() >= Implementation::ExtensionCount) {
Error{} << "Index" << e.index() << "used by" << e.string()
<< "larger than" << Implementation::ExtensionCount;
Error{} << "Index" << e.index() << "larger than" << Implementation::ExtensionCount;
CORRADE_VERIFY(false);
}
if(used[e.index()]) {
Error{} << "Index" << e.index() << "used by both"
<< used[e.index()] << "and" << e.string();
Error{} << "Index" << e.index() << "already used by" << used[e.index()];
CORRADE_VERIFY(false);
}
used[e.index()] = e.string();
if(!unique.insert(e.string()).second) {
Error{} << "Extension" << e.string() << "listed more than once";
Error{} << "Extension listed more than once";
CORRADE_VERIFY(false);
}
}

21
src/Magnum/GL/Test/ContextTest.cpp

@ -126,21 +126,24 @@ void ContextTest::extensions() {
Version::None})
{
for(const Extension& e: Extension::extensions(version)) {
CORRADE_ITERATION(version);
CORRADE_ITERATION(e.string());
/** @todo convert to CORRADE_ERROR() when that's done */
if(e.index() >= GL::Implementation::ExtensionCount) {
Error{} << "Index" << e.index() << "used by" << e.string()
<< "larger than" << GL::Implementation::ExtensionCount;
Error{} << "Index" << e.index() << "larger than" << GL::Implementation::ExtensionCount;
CORRADE_VERIFY(false);
}
if(used[e.index()]) {
Error{} << "Index" << e.index() << "used by both"
<< used[e.index()] << "and" << e.string();
Error{} << "Index" << e.index() << "already used by" << used[e.index()];
CORRADE_VERIFY(false);
}
used[e.index()] = e.string();
if(!unique.insert(e.string()).second) {
Error{} << "Extension" << e.string() << "listed more than once";
Error{} << "Extension listed more than once";
CORRADE_VERIFY(false);
}
@ -153,22 +156,20 @@ void ContextTest::extensions() {
&& e.index() != Extensions::WEBGL::color_buffer_float::Index
#endif
) {
Error{} << "Extension" << e.string() << "should have core version"
<< version << "but has" << e.coreVersion();
Error{} << "Extension should have core version" << version << "but has" << e.coreVersion();
CORRADE_VERIFY(false);
}
#ifdef MAGNUM_TARGET_GLES2
if(e.requiredVersion() != Version::GLES200) {
Error{} << "Extension" << e.string() << "should have required version"
<< Version::GLES200 << "but has" << e.requiredVersion();
Error{} << "Extension should have required version" << Version::GLES200 << "but has" << e.requiredVersion();
CORRADE_VERIFY(false);
}
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2)
if(e.coreVersion() == Version::GLES300 && e.index() != Extensions::MAGNUM::shader_vertex_id::Index) {
Error{} << "Extension" << e.string() << "has core version" << e.coreVersion() << "on a GLES3 build -- it shouldn't be present at all";
Error{} << "Extension has core version" << e.coreVersion() << "on a GLES3 build -- it shouldn't be present at all";
CORRADE_VERIFY(false);
}
#endif

Loading…
Cancel
Save