Skip to content

Instantly share code, notes, and snippets.

@datsuns
Created June 4, 2012 14:48
Show Gist options
  • Save datsuns/2868831 to your computer and use it in GitHub Desktop.
Save datsuns/2868831 to your computer and use it in GitHub Desktop.
gtestでパラメータライズテスト
#include <gtest/gtest.h>
class Hello {
public:
int ping( int a ){ return a; }
};
class HelloTest : public ::testing::TestWithParam<int> {
protected:
Hello hello;
};
TEST_P( HelloTest, hello ){
EXPECT_TRUE( hello.ping(GetParam()) );
}
INSTANTIATE_TEST_CASE_P( TestCaseP, HelloTest, ::testing::Values( 1, 2, 0 ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment