I have a template test class which I am looking to write test fixtures for. I have the following snippet which works but it doesn't "group" the test fixtures together because of the template type so I have to run each of them separately rather than just once (i.e UTestClass
). When I run UTestClass
, it says No tests were found
Note that the snippet below allows accessing of member variable _value
across different test fixtures too so I'd want to have this behavior.
Is there a way to group the template test fixtures together? Perhaps in a test suite or another class which allows each test to run ONLY with a specified type?
template<typename T>
struct UTestClass : public testing::Test
{
T _value;
};
using Float = UTestClass<float>;
using Double = UTestClass<double>;
TEST_F(Float, TestA)
{
// able to access _value
}
TEST_F(Double, TestB)
{
// able to access _value
}