43 #define GTEST_IMPLEMENTATION_ 1
45 #undef GTEST_IMPLEMENTATION_
63 #define GTEST_CHECK_INT_EQ_(expected, actual) \
65 const int expected_val = (expected);\
66 const int actual_val = (actual);\
67 if (::testing::internal::IsTrue(expected_val != actual_val)) {\
68 ::std::cout << "Value of: " #actual "\n"\
69 << " Actual: " << actual_val << "\n"\
70 << "Expected: " #expected "\n"\
71 << "Which is: " << expected_val << "\n";\
72 ::testing::internal::posix::Abort();\
74 } while (::testing::internal::AlwaysFalse())
80 int g_environment_set_up_count = 0;
81 int g_environment_tear_down_count = 0;
86 virtual void SetUp() { g_environment_set_up_count++; }
87 virtual void TearDown() { g_environment_tear_down_count++; }
92 int g_should_fail_count = 0;
94 TEST(FooTest, ShouldFail) {
95 g_should_fail_count++;
101 int g_should_pass_count = 0;
103 TEST(FooTest, ShouldPass) {
104 g_should_pass_count++;
110 int g_death_test_count = 0;
112 TEST(BarDeathTest, ThreadSafeAndFast) {
113 g_death_test_count++;
122 #if GTEST_HAS_PARAM_TEST
123 int g_param_test_count = 0;
125 const int kNumberOfParamTests = 10;
127 class MyParamTest :
public testing::TestWithParam<int> {};
129 TEST_P(MyParamTest, ShouldPass) {
133 g_param_test_count++;
138 #endif // GTEST_HAS_PARAM_TEST
142 g_environment_set_up_count = 0;
143 g_environment_tear_down_count = 0;
144 g_should_fail_count = 0;
145 g_should_pass_count = 0;
146 g_death_test_count = 0;
147 #if GTEST_HAS_PARAM_TEST
148 g_param_test_count = 0;
149 #endif // GTEST_HAS_PARAM_TEST
153 void CheckCounts(
int expected) {
159 #if GTEST_HAS_PARAM_TEST
161 #endif // GTEST_HAS_PARAM_TEST
165 void TestRepeatUnspecified() {
172 void TestRepeat(
int repeat) {
182 void TestRepeatWithEmptyFilter(
int repeat) {
193 void TestRepeatWithFilterForSuccessfulTests(
int repeat) {
204 #if GTEST_HAS_PARAM_TEST
206 #endif // GTEST_HAS_PARAM_TEST
211 void TestRepeatWithFilterForFailedTests(
int repeat) {
222 #if GTEST_HAS_PARAM_TEST
224 #endif // GTEST_HAS_PARAM_TEST
229 int main(
int argc,
char **argv) {
233 TestRepeatUnspecified();
238 TestRepeatWithEmptyFilter(2);
239 TestRepeatWithEmptyFilter(3);
241 TestRepeatWithFilterForSuccessfulTests(3);
243 TestRepeatWithFilterForFailedTests(4);