@@ -79,13 +79,13 @@ class TestContext : public chip::Test::AppContext
79
79
{
80
80
public:
81
81
// Performs shared setup for all tests in the test suite
82
- void SetUpTestSuite () override
82
+ static void SetUpTestSuite ()
83
83
{
84
84
chip::Test::AppContext::SetUpTestSuite ();
85
85
gRealClock = &chip::System::SystemClock ();
86
86
chip::System::Clock::Internal::SetSystemClockForTesting (&gMockClock );
87
87
88
- if (mSyncScheduler )
88
+ if (sSyncScheduler )
89
89
{
90
90
gReportScheduler = chip::app::reporting::GetSynchronizedReportScheduler ();
91
91
sUsingSubSync = true ;
@@ -96,14 +96,8 @@ class TestContext : public chip::Test::AppContext
96
96
}
97
97
}
98
98
99
- static int nlTestSetUpTestSuite_Sync (void * context)
100
- {
101
- static_cast <TestContext *>(context)->mSyncScheduler = true ;
102
- return nlTestSetUpTestSuite (context);
103
- }
104
-
105
99
// Performs shared teardown for all tests in the test suite
106
- void TearDownTestSuite () override
100
+ static void TearDownTestSuite ()
107
101
{
108
102
chip::System::Clock::Internal::SetSystemClockForTesting (gRealClock );
109
103
chip::Test::AppContext::TearDownTestSuite ();
@@ -133,9 +127,21 @@ class TestContext : public chip::Test::AppContext
133
127
chip::Test::AppContext::TearDown ();
134
128
}
135
129
136
- private :
130
+ protected :
137
131
chip::MonotonicallyIncreasingCounter<chip::EventNumber> mEventCounter ;
138
- bool mSyncScheduler = false ;
132
+ static bool sSyncScheduler ;
133
+ };
134
+
135
+ bool TestContext::sSyncScheduler = false ;
136
+
137
+ class TestSyncContext : public TestContext
138
+ {
139
+ public:
140
+ static void SetUpTestSuite ()
141
+ {
142
+ sSyncScheduler = true ;
143
+ TestContext::SetUpTestSuite ();
144
+ }
139
145
};
140
146
141
147
class TestEventGenerator : public chip ::app::EventLoggingDelegate
@@ -5146,19 +5152,19 @@ const nlTest sTests[] = {
5146
5152
nlTestSuite sSuite = {
5147
5153
" TestReadInteraction" ,
5148
5154
&sTests [0 ],
5149
- TestContext::nlTestSetUpTestSuite ,
5150
- TestContext::nlTestTearDownTestSuite ,
5151
- TestContext::nlTestSetUp ,
5152
- TestContext::nlTestTearDown ,
5155
+ NL_TEST_WRAP_FUNCTION ( TestContext::SetUpTestSuite) ,
5156
+ NL_TEST_WRAP_FUNCTION ( TestContext::TearDownTestSuite) ,
5157
+ NL_TEST_WRAP_METHOD ( TestContext, SetUp) ,
5158
+ NL_TEST_WRAP_METHOD ( TestContext, TearDown) ,
5153
5159
};
5154
5160
5155
5161
nlTestSuite sSyncSuite = {
5156
5162
" TestSyncReadInteraction" ,
5157
5163
&sTests [0 ],
5158
- TestContext::nlTestSetUpTestSuite_Sync ,
5159
- TestContext::nlTestTearDownTestSuite ,
5160
- TestContext::nlTestSetUp ,
5161
- TestContext::nlTestTearDown ,
5164
+ NL_TEST_WRAP_FUNCTION (TestSyncContext::SetUpTestSuite) ,
5165
+ NL_TEST_WRAP_FUNCTION (TestSyncContext::TearDownTestSuite) ,
5166
+ NL_TEST_WRAP_METHOD (TestSyncContext, SetUp) ,
5167
+ NL_TEST_WRAP_METHOD (TestSyncContext, TearDown) ,
5162
5168
};
5163
5169
5164
5170
} // namespace
0 commit comments