Skip to content

Commit

Permalink
folded single-use of LOAD_LIB_2_EXE
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed May 23, 2024
1 parent 06eba23 commit bdea6b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion test/fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions test/fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bdea6b2

Please sign in to comment.