Skip to content

Commit ea49efd

Browse files
committed
Rename some of the functions and member variables to match the terminology of a check or test for improved readability.
1 parent b9527ed commit ea49efd

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

test/TestClass.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class TestClass
338338

339339
m_logged = true;
340340

341-
privateLogFunction();
341+
privateLogTest();
342342

343343
// Ensure tear down happens before leak checking stops.
344344
Teardown();
@@ -752,10 +752,10 @@ class TestClass
752752

753753
// Log reporting private helpers.
754754
private:
755-
// Log the whole line for a function or member function.
756-
void privateLogFunction()
755+
// Log the whole line for a test name, function or member function name.
756+
void privateLogTest()
757757
{
758-
privateLogFunctionLineNumber();
758+
privateLogTestLineNumber();
759759

760760
privateLogTestStatus();
761761

@@ -773,8 +773,8 @@ class TestClass
773773
privateLogFailures();
774774
}
775775

776-
// Log the current tested function with a line number.
777-
void privateLogFunctionLineNumber()
776+
// Log the current test or function with a line number.
777+
void privateLogTestLineNumber()
778778
{
779779
TestString str, line_number_str;
780780

@@ -796,7 +796,7 @@ class TestClass
796796
if (HasTests())
797797
{
798798
if (!IsGeneralTest())
799-
GetSharedData().IncTotalFunctionsTested();
799+
GetSharedData().IncTotalTested();
800800
if (HasFailed() || m_leak_check.IsLeaking())
801801
LogWrite(GetSharedData().GetFailedMessage());
802802
else
@@ -994,9 +994,9 @@ class TestClass
994994
privateLogCount("Total failed checks", GetSharedData().GetTotalFailedChecks());
995995
if (GetSharedData().GetTotalNotTested() > 0)
996996
privateLogCount("Total not tested", GetSharedData().GetTotalNotTested());
997-
privateLogCount("Total tested", GetSharedData().GetTotalFunctionsTested());
998-
if (GetSharedData().GetTotalTimedFunctions() > 0)
999-
privateLogCount("Total timed", GetSharedData().GetTotalTimedFunctions());
997+
privateLogCount("Total tested", GetSharedData().GetTotalTested());
998+
if (GetSharedData().GetTotalTimed() > 0)
999+
privateLogCount("Total timed", GetSharedData().GetTotalTimed());
10001000
privateLogCount("Total tests", GetSharedData().GetTotalTests());
10011001
if (GetSharedData().GetTotalLeakedTests() > 0)
10021002
privateLogCount("Total memory leaks", GetSharedData().GetTotalLeakedTests());

test/TestClassSharedData.hpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class TestClassSharedData
4444
, m_total_not_tested(0)
4545
, m_total_failed_checks(0)
4646
, m_total_leaked_tests(0)
47-
, m_total_functions_tested(0)
48-
, m_total_timed_functions(0)
47+
, m_total_tested(0)
48+
, m_total_timed(0)
4949
, m_total_tests(0)
5050

5151
// Padded to be lined up for output as columns.
@@ -193,34 +193,34 @@ class TestClassSharedData
193193
++m_total_leaked_tests;
194194
}
195195

196-
SizeType GetTotalFunctionsTested() const throw()
196+
SizeType GetTotalTested() const throw()
197197
{
198-
return m_total_functions_tested;
198+
return m_total_tested;
199199
}
200200

201-
void SetTotalFunctionsTested(SizeType total_functions_tested) throw()
201+
void SetTotalTested(SizeType total_tested) throw()
202202
{
203-
m_total_functions_tested = total_functions_tested;
203+
m_total_tested = total_tested;
204204
}
205205

206-
void IncTotalFunctionsTested()
206+
void IncTotalTested()
207207
{
208-
++m_total_functions_tested;
208+
++m_total_tested;
209209
}
210210

211-
SizeType GetTotalTimedFunctions() const throw()
211+
SizeType GetTotalTimed() const throw()
212212
{
213-
return m_total_timed_functions;
213+
return m_total_timed;
214214
}
215215

216-
void SetTotalTimedFunctions(SizeType total_timed_functions) throw()
216+
void SetTotalTimed(SizeType total_timed) throw()
217217
{
218-
m_total_timed_functions = total_timed_functions;
218+
m_total_timed = total_timed;
219219
}
220220

221221
void IncTotalTimedFunctions()
222222
{
223-
++m_total_timed_functions;
223+
++m_total_timed;
224224
}
225225

226226
SizeType GetTotalTests() const throw()
@@ -292,12 +292,14 @@ class TestClassSharedData
292292
SizeType m_logged_line;
293293

294294
// Counts for all tests.
295+
// The counts are either for a check, e.g. CHECK_TRUE, CHECK_EQUAL, etc.
296+
// or a test, e.g. TEST, TEST_FUNCTION, etc.
295297
SizeType m_total_checks;
296298
SizeType m_total_not_tested;
297299
SizeType m_total_failed_checks;
298300
SizeType m_total_leaked_tests;
299-
SizeType m_total_functions_tested;
300-
SizeType m_total_timed_functions;
301+
SizeType m_total_tested;
302+
SizeType m_total_timed;
301303
SizeType m_total_tests;
302304

303305
// Last class name set for TestClass.

0 commit comments

Comments
 (0)