Use macro for better message during failure

This commit is contained in:
Richard Berger
2020-11-13 15:14:28 -05:00
parent 504e675023
commit 5d79ba12d7

View File

@ -248,14 +248,12 @@ struct AtomState {
bool has_mass_setflag = false; bool has_mass_setflag = false;
}; };
template<typename T> #define ASSERT_ARRAY_ALLOCATED(ptr, enabled) \
void ASSERT_ARRAY_ALLOCATED(const T * ptr, bool enabled) { if (enabled) { \
if (enabled) { ASSERT_NE(ptr, nullptr); \
ASSERT_NE(ptr, nullptr); } else { \
} else { ASSERT_EQ(ptr, nullptr); \
ASSERT_EQ(ptr, nullptr);
} }
}
void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) { void ASSERT_ATOM_STATE_EQ(Atom* atom, const AtomState& expected) {
ASSERT_THAT(std::string(atom->atom_style), Eq(expected.atom_style)); ASSERT_THAT(std::string(atom->atom_style), Eq(expected.atom_style));