From bdea6b24e7bd0b3ae949e95e2dad32f19bd6cafd Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 22 May 2024 11:31:11 +0200 Subject: [PATCH] folded single-use of `LOAD_LIB_2_EXE` --- test/fixture.cpp | 3 ++- test/fixture.h | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/fixture.cpp b/test/fixture.cpp index ffbd9be8de5a..a4deb169307a 100644 --- a/test/fixture.cpp +++ b/test/fixture.cpp @@ -455,7 +455,8 @@ TestFixture::SettingsBuilder& TestFixture::SettingsBuilder::library(const char l if (REDUNDANT_CHECK && std::find(settings.libraries.cbegin(), settings.libraries.cend(), lib) != settings.libraries.cend()) throw std::runtime_error("redundant setting: libraries (" + std::string(lib) + ")"); // TODO: exename is not yet set - LOAD_LIB_2_EXE(settings.library, lib, fixture.exename.c_str()); + if (settings.library.load(fixture.exename.c_str(), lib).errorcode != Library::ErrorCode::OK) + throw std::runtime_error("library '" + std::string(lib) + "' not found"); // strip extension std::string lib_s(lib); const std::string ext(".cfg"); diff --git a/test/fixture.h b/test/fixture.h index 1defa6ac3aff..0dd50d13a6b5 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -308,8 +308,6 @@ class TestFixture : public ErrorLogger { #define EXPECT_EQ( EXPECTED, ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL) #define REGISTER_TEST( CLASSNAME ) namespace { CLASSNAME instance_ ## CLASSNAME; } -#define LOAD_LIB_2_EXE( LIB, NAME, EXE ) do { if (((LIB).load((EXE), NAME).errorcode != Library::ErrorCode::OK)) throw std::runtime_error("library '" + std::string(NAME) + "' not found"); } while (false) - #define PLATFORM( P, T ) do { std::string errstr; assertEquals(__FILE__, __LINE__, true, P.set(Platform::toString(T), errstr, {exename}), errstr); } while (false) #endif // fixtureH