jeudi 23 juin 2016

Using a static constexpr in gtest typed test

template <typename T> class ClassA : public ::testing::Test {
public:
  ClassA() {}

  constexpr static uint ZERO = 0;
};

typedef ::testing::Types<ClassB, ClassC, ClassD> ParamTypes;
TYPED_TEST_CASE(ClassA, ParamTypes);

template <> constexpr uint ClassA<test::ClassB>::ZERO;
template <> constexpr uint ClassA<test::ClassC>::ZERO;
template <> constexpr uint ClassA<test::ClassD>::ZERO;

TYPED_TEST(ClassA, testSomething) { ASSERT_EQ(ClassA::ZERO, 0); } ??
TYPED_TEST(ClassA, testSomething) { ASSERT_EQ(this->ZERO, 0); } ??

What is the right way to use static constexpr inside typed test with google test?

Aucun commentaire:

Enregistrer un commentaire