-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
So the issue you fixed was about missing float types, which is indeed covered by this test. However, I now see that mod_equals, as well as all of the other operations above, are only tested for double.
Have you considered using a TYPED_TEST_SUITE (there is an example further down in the file), which would test all types for all operations?
For example, something like
template <class T> class ElementArithmeticTest : public testing::Test {
public:
const T a = static_cast<T>(15.); // or any number you want
const T b = static_cast<T>(7.); // or any number you want
T val = a;
};
using ElementArithmeticTypes = testing::Types<float, double, int32_t, int64_t>;
TYPED_TEST_SUITE(ElementArithmeticTest, ElementArithmeticTypes);
TYPED_TEST(ElementArithmeticTest, add_equals) {
add_equals(this->val, this->b);
EXPECT_EQ(this->val, this->a + this->b);
}
TYPED_TEST(ElementArithmeticTest, subtract_equals) {
subtract_equals(this->val, this->b);
EXPECT_EQ(this->val, this->a - this->b);
}
...This would have the benefit of increasing test coverage overall.
Originally posted by @nvaytet in #3179 (comment)
Metadata
Metadata
Assignees
Labels
No labels