Created
June 4, 2012 14:48
-
-
Save datsuns/2868831 to your computer and use it in GitHub Desktop.
gtestでパラメータライズテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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