@@ -29,22 +29,22 @@ of test functions in a given source file is called a "suite".
29
29
30
30
TEST(YourTestFunction1)
31
31
{
32
- //// Do some test things here, then check the results using EXPECT_*
32
+ // Do some test things here, then check the results using EXPECT_*
33
33
SomeTypeX foo;
34
34
foo.DoSomething();
35
35
EXPECT_EQ(foo.GetResultCount(), 7);
36
36
foo.DoSomethingElse();
37
37
EXPECT_EQ(foo.GetResultCount(), 5);
38
38
39
- //// If you want to abort the rest of the test upon failure, use ASSERT_*
39
+ // If you want to abort the rest of the test upon failure, use ASSERT_*
40
40
SomeTypeY * ptr = foo.GetSomePointer();
41
41
ASSERT_NE(ptr, nullptr);
42
42
ptr->DoTheThing(); // Won't reach here if the ASSERT failed.
43
43
}
44
44
45
45
TEST(YourTestFunction2)
46
46
{
47
- //// Do some test things here, then check the results using EXPECT_*
47
+ // Do some test things here, then check the results using EXPECT_*
48
48
SomeTypeZ foo;
49
49
foo.DoSomething();
50
50
EXPECT_EQ(foo.GetResultCount(), 3);
@@ -74,59 +74,59 @@ public:
74
74
// Performs shared setup for all tests in the test suite. Run once for the whole suite.
75
75
static void SetUpTestSuite()
76
76
{
77
- //// Your per-suite setup goes here:
78
- // sPerSuiteFixture.Init();
79
- // ASSERT_TRUE(sPerSuiteFixture.WorkingGreat());
77
+ // Your per-suite setup goes here:
78
+ sPerSuiteFixture.Init();
79
+ ASSERT_TRUE(sPerSuiteFixture.WorkingGreat());
80
80
}
81
81
82
82
// Performs shared teardown for all tests in the test suite. Run once for the whole suite.
83
83
static void TearDownTestSuite()
84
84
{
85
- //// Your per-suite teardown goes here:
86
- // sPerSuiteFixture.Shutdown();
85
+ // Your per-suite teardown goes here:
86
+ sPerSuiteFixture.Shutdown();
87
87
}
88
88
89
89
protected:
90
90
// Performs setup for each test in the suite. Run once for each test function.
91
91
void SetUp()
92
92
{
93
- //// Your per-test setup goes here:
94
- // mPerTestFixture.Init();
95
- // ASSERT_TRUE(mPerTestFixture.WorkingGreat());
93
+ // Your per-test setup goes here:
94
+ mPerTestFixture.Init();
95
+ ASSERT_TRUE(mPerTestFixture.WorkingGreat());
96
96
}
97
97
98
98
// Performs teardown for each test in the suite. Run once for each test function.
99
99
void TearDown()
100
100
{
101
- //// Your per-test teardown goes here:
102
- // mPerTestFixture.Shutdown();
101
+ // Your per-test teardown goes here:
102
+ mPerTestFixture.Shutdown();
103
103
}
104
104
105
105
private:
106
- //// Your per-suite and per-test fixtures are declared here:
107
- // static SomeTypeA sPerSuiteFixture;
108
- // SomeTypeB mPerTestFixture;
106
+ // Your per-suite and per-test fixtures are declared here:
107
+ static SomeTypeA sPerSuiteFixture;
108
+ SomeTypeB mPerTestFixture;
109
109
};
110
- //// Your per-suite fixtures are defined here:
111
- // SomeTypeA YourTestContext::sPerSuiteFixture;
110
+ // Your per-suite fixtures are defined here:
111
+ SomeTypeA YourTestContext::sPerSuiteFixture;
112
112
113
113
TEST_F(YourTestContext, YourTestFunction1)
114
114
{
115
- //// Do some test things here, then check the results using EXPECT_*
115
+ // Do some test things here, then check the results using EXPECT_*
116
116
mPerTestFixture.DoSomething();
117
117
EXPECT_EQ(mPerTestFixture.GetResultCount(), 7);
118
118
sPerSuiteFixture.DoSomething();
119
119
EXPECT_EQ(sPerSuiteFixture.GetResultCount(), 5);
120
120
121
- //// If you want to abort the rest of the test upon failure, use ASSERT_*
121
+ // If you want to abort the rest of the test upon failure, use ASSERT_*
122
122
SomeTypeC * ptr = mPerTestFixture.GetSomePointer();
123
123
ASSERT_NE(ptr, nullptr);
124
124
ptr->DoTheThing(); // Won't reach here if the ASSERT failed.
125
125
}
126
126
127
127
TEST_F(YourTestContext, YourTestFunction2)
128
128
{
129
- //// Do some test things here, then check the results using EXPECT_*
129
+ // Do some test things here, then check the results using EXPECT_*
130
130
mPerTestFixture.DoSomethingElse();
131
131
EXPECT_EQ(mPerTestFixture.GetResultCount(), 9);
132
132
}
@@ -152,16 +152,16 @@ public:
152
152
AppContext::SetUpTestSuite(); // Call parent.
153
153
VerifyOrReturn(!HasFailure()); // Stop if parent had a failure.
154
154
155
- //// Your per-suite setup goes here:
156
- // sPerSuiteFixture.Init();
157
- // ASSERT_TRUE(sPerSuiteFixture.WorkingGreat());
155
+ // Your per-suite setup goes here:
156
+ sPerSuiteFixture.Init();
157
+ ASSERT_TRUE(sPerSuiteFixture.WorkingGreat());
158
158
}
159
159
160
160
// Performs shared teardown for all tests in the test suite. Run once for the whole suite.
161
161
static void TearDownTestSuite()
162
162
{
163
- //// Your per-suite teardown goes here:
164
- // sPerSuiteFixture.Shutdown();
163
+ // Your per-suite teardown goes here:
164
+ sPerSuiteFixture.Shutdown();
165
165
166
166
AppContext::TearDownTestSuite(); // Call parent.
167
167
}
@@ -173,37 +173,37 @@ protected:
173
173
AppContext::SetUp(); // Call parent.
174
174
VerifyOrReturn(!HasFailure()); // Stop if parent had a failure.
175
175
176
- //// Your per-test setup goes here:
177
- // mPerTestFixture.Init();
178
- // ASSERT_TRUE(mPerTestFixture.WorkingGreat());
176
+ // Your per-test setup goes here:
177
+ mPerTestFixture.Init();
178
+ ASSERT_TRUE(mPerTestFixture.WorkingGreat());
179
179
}
180
180
181
181
// Performs teardown for each test in the suite. Run once for each test function.
182
182
void TearDown()
183
183
{
184
- //// Your per-test teardown goes here:
185
- // mPerTestFixture.Shutdown();
184
+ // Your per-test teardown goes here:
185
+ mPerTestFixture.Shutdown();
186
186
187
187
chip::app::EventManagement::DestroyEventManagement();
188
188
AppContext::TearDown(); // Call parent.
189
189
}
190
190
191
191
private:
192
- //// Your per-suite and per-test fixtures are declared here:
193
- // static SomeTypeA sPerSuiteFixture;
194
- // SomeTypeB mPerTestFixture;
192
+ // Your per-suite and per-test fixtures are declared here:
193
+ static SomeTypeA sPerSuiteFixture;
194
+ SomeTypeB mPerTestFixture;
195
195
};
196
- //// Your per-suite fixtures are defined here:
197
- // SomeTypeA YourTestContext::sPerSuiteFixture;
196
+ // Your per-suite fixtures are defined here:
197
+ SomeTypeA YourTestContext::sPerSuiteFixture;
198
198
199
199
TEST_F(YourTestContext, YourTestFunction1)
200
200
{
201
- //// Do some test things here, then check the results using EXPECT_*
201
+ // Do some test things here, then check the results using EXPECT_*
202
202
}
203
203
204
204
TEST_F(YourTestContext, YourTestFunction2)
205
205
{
206
- //// Do some test things here, then check the results using EXPECT_*
206
+ // Do some test things here, then check the results using EXPECT_*
207
207
}
208
208
```
209
209
0 commit comments