qvec: allow gtest to print
This commit is contained in:
parent
ed62ec1040
commit
f5d105b34d
|
|
@ -296,6 +296,12 @@ public:
|
|||
constexpr auto end() const { return v.end(); }
|
||||
constexpr auto cbegin() const { return v.cbegin(); }
|
||||
constexpr auto cend() const { return v.cend(); }
|
||||
|
||||
// gtest support
|
||||
friend std::ostream& operator<<(std::ostream& os, const qvec& point) {
|
||||
os << fmt::format("{}", point);
|
||||
return os;
|
||||
}
|
||||
};
|
||||
|
||||
// Fmt support
|
||||
|
|
|
|||
|
|
@ -717,6 +717,20 @@ TEST(mathlib, qvecConstructorExtra)
|
|||
EXPECT_EQ(2, test[1]);
|
||||
}
|
||||
|
||||
TEST(mathlib, qvecGTestPrint)
|
||||
{
|
||||
const qvec2f test(1, 2);
|
||||
|
||||
EXPECT_EQ(testing::PrintToString(test), "1 2");
|
||||
}
|
||||
|
||||
TEST(mathlib, qvecFmtFormat)
|
||||
{
|
||||
const qvec2f test(1, 2);
|
||||
|
||||
EXPECT_EQ("1 2", fmt::format("{}", test));
|
||||
}
|
||||
|
||||
// aabb3f
|
||||
|
||||
TEST(mathlib, aabbBasic)
|
||||
|
|
|
|||
Loading…
Reference in New Issue