inject no long for FBS generation to remove logs in flattests (#7926)

* inject no long for FBS generation to remove logs in flattests

* updated blaze rules
This commit is contained in:
Derek Bailey
2023-04-28 13:40:38 -07:00
committed by GitHub
parent e7dc252b0e
commit 966aae2144
8 changed files with 113 additions and 42 deletions

View File

@@ -17,6 +17,7 @@
#endif
#define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
#define TEST_NE(exp, val) TestNe(exp, val, "'" #exp "' == '" #val "'", __FILE__, __LINE__, "")
#define TEST_ASSERT(val) TestEq(true, !!(val), "'" "true" "' != '" #val "'", __FILE__, __LINE__, "")
#define TEST_NOTNULL(val) TestEq(true, (val) != nullptr, "'" "nullptr" "' == '" #val "'", __FILE__, __LINE__, "")
#define TEST_EQ_STR(exp, val) TestEqStr(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
@@ -106,4 +107,24 @@ inline void TestEq<std::string, std::string>(std::string expval,
}
}
template<typename T, typename U>
void TestNe(T expval, U val, const char *exp, const char *file, int line,
const char *func) {
if (static_cast<U>(expval) == val) {
TestFail(flatbuffers::NumToString(scalar_as_underlying(expval)).c_str(),
flatbuffers::NumToString(scalar_as_underlying(val)).c_str(), exp,
file, line, func);
}
}
template<>
inline void TestNe<std::string, std::string>(std::string expval,
std::string val, const char *exp,
const char *file, int line,
const char *func) {
if (expval == val) {
TestFail(expval.c_str(), val.c_str(), exp, file, line, func);
}
}
#endif // !TEST_ASSERT_H