Skip to content

Commit ea28f8a

Browse files
committed
Slight re-factor of function privateLogNumberOfRunTests to reduce bloat for issue #20.
1 parent 43f7630 commit ea28f8a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/TestClass.hpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -859,30 +859,28 @@ class TestClass
859859
Max(max_digits + TestStringUtility::UnsafeLength(str_test) + 1,
860860
TestStringUtility::UnsafeLength(str_test)) + 1;
861861

862-
TestString whole_str, msg_str, num_str, pad_str;
862+
// Build up the string with number of tests or failed tests, then appended message.
863+
TestString whole_str;
864+
TestString msg_str;
863865

864866
if (m_check_count > 0)
865867
{
866868
if (m_failure_check_count > 0)
867869
{
868-
num_str.Append(static_cast<unsigned long>(m_failure_check_count));
870+
whole_str.Append(static_cast<unsigned long>(m_failure_check_count));
869871
msg_str.Append(str_failed);
870872
}
871873
else
872874
{
873-
num_str.Append(static_cast<unsigned long>(m_check_count));
875+
whole_str.Append(static_cast<unsigned long>(m_check_count));
874876
msg_str.Append((m_check_count > 1) ? str_tests : str_test);
875877
}
876-
num_str.PadLeft(' ', max_digits);
878+
whole_str.PadLeft(' ', max_digits);
879+
whole_str.Append(" ");
877880
}
878881
else
879882
msg_str.Append(str_no_tests);
880883

881-
if (!num_str.IsEmpty())
882-
{
883-
whole_str.Append(num_str);
884-
whole_str.Append(" ");
885-
}
886884
whole_str.Append(msg_str);
887885
whole_str.PadRight(' ', max_chars);
888886

@@ -928,7 +926,7 @@ class TestClass
928926
static void privateLogCount(TestString const& msg, ocl_size_type count)
929927
{
930928
TestString count_msg(msg);
931-
count_msg += " = ";
929+
count_msg.Append(" = ");
932930
count_msg.Append(static_cast<unsigned long>(count));
933931
if (GetLogger() != NULL)
934932
GetLogger()->WriteLine(count_msg);
@@ -939,7 +937,7 @@ class TestClass
939937
{
940938
if (GetLogger() != NULL)
941939
{
942-
GetLogger()->WriteLine("");
940+
GetLogger()->WriteEOL();
943941
privateLogCount("Total checks", GetSharedData().GetTotalChecks());
944942
if (GetSharedData().GetTotalNotTested() > 0)
945943
privateLogCount("Total not tested", GetSharedData().GetTotalNotTested());

0 commit comments

Comments
 (0)