我的代码:
#include <gtest/gtest.h>
bool IsEven(int i){return i%2==0;}
class IsEvenParamTest:public testing::TestWithParam<int>{};
INITIALIZE_TEST_CASE_P(MySuccess,IsEvenParamTest,testing::Range(2,6));
TEST_P(IsEvenParamTest, All){
int n = GetParam();
EXPECT_TRUE(IsEven(n));
}
g ++编译失败:
mytest.cpp:4:23: error: expected constructor, destructor, or type conversion before ‘(’ token
INITIALIZE_TEST_CASE_P(MySuccess,IsEvenParamTest,testing::Range(2,6));
^
如何解决?