Commit 101237c0b0876f3c2171cbf33e5bca995f051f6c
1 parent
0cf6a321
Do not use logger as this leads to badly formatted output.
So far the classes have a GLog member. The output using GLog is however not satisfactory, hence we switched to std::cout. This should be okay, but maybe someday we want to clean the logger.
Showing
2 changed files
with
20 additions
and
16 deletions
src/test/GTestSuite.cpp
| ... | ... | @@ -262,9 +262,6 @@ bool GTestSuite::run(void) |
| 262 | 262 | // executed. |
| 263 | 263 | set(); |
| 264 | 264 | |
| 265 | - // Log name of test suite | |
| 266 | - m_log << std::endl; | |
| 267 | - | |
| 268 | 265 | // Initialise success flag |
| 269 | 266 | bool success = true; |
| 270 | 267 | |
| ... | ... | @@ -281,7 +278,7 @@ bool GTestSuite::run(void) |
| 281 | 278 | int old_failures = failures(); |
| 282 | 279 | |
| 283 | 280 | // Log the name of the test |
| 284 | - m_log << m_names[m_index] << ": "; | |
| 281 | + std::cout << m_names[m_index] << ": "; | |
| 285 | 282 | |
| 286 | 283 | // Create a test of error type for function testing |
| 287 | 284 | GTestCase* test = new GTestCase(GTestCase::ERROR_TEST, m_names[m_index]); |
| ... | ... | @@ -331,14 +328,14 @@ bool GTestSuite::run(void) |
| 331 | 328 | } |
| 332 | 329 | |
| 333 | 330 | // Log the result (".","F" or, "E") |
| 334 | - m_log << test->print(); | |
| 331 | + std::cout << test->print(); | |
| 335 | 332 | |
| 336 | 333 | // Log if there are errors or failures |
| 337 | 334 | if ((m_errors == old_errors && m_failures == old_failures)) { |
| 338 | - m_log << " ok" << std::endl; | |
| 335 | + std::cout << " ok" << std::endl; | |
| 339 | 336 | } |
| 340 | 337 | else { |
| 341 | - m_log << " NOK" << std::endl; | |
| 338 | + std::cout << " NOK" << std::endl; | |
| 342 | 339 | success = false; |
| 343 | 340 | } |
| 344 | 341 | |
| ... | ... | @@ -431,7 +428,7 @@ void GTestSuite::test_assert(bool assert, |
| 431 | 428 | testcase->message(message); |
| 432 | 429 | |
| 433 | 430 | // Log the result (".","F" or, "E") |
| 434 | - m_log << testcase->print(); | |
| 431 | + std::cout << testcase->print(); | |
| 435 | 432 | |
| 436 | 433 | // Add test case to test suite |
| 437 | 434 | m_tests.push_back(testcase); |
| ... | ... | @@ -495,7 +492,7 @@ void GTestSuite::test_value(const double& value, |
| 495 | 492 | testcase->message(formated_message); |
| 496 | 493 | |
| 497 | 494 | // Log the result (".","F" or, "E") |
| 498 | - m_log << testcase->print(); | |
| 495 | + std::cout << testcase->print(); | |
| 499 | 496 | |
| 500 | 497 | // Add test case to test suite |
| 501 | 498 | m_tests.push_back(testcase); |
| ... | ... | @@ -576,7 +573,7 @@ void GTestSuite::test_try_success(void) |
| 576 | 573 | m_stack_try.pop_back(); |
| 577 | 574 | |
| 578 | 575 | // Log the result (".","F" or, "E") |
| 579 | - m_log << m_tests.back()->print(); | |
| 576 | + std::cout << m_tests.back()->print(); | |
| 580 | 577 | |
| 581 | 578 | // Return |
| 582 | 579 | return; |
| ... | ... | @@ -639,7 +636,7 @@ void GTestSuite::test_try_failure(const std::string& message, |
| 639 | 636 | m_stack_try.pop_back(); |
| 640 | 637 | |
| 641 | 638 | // Log the result ( ".","F" or, "E") |
| 642 | - m_log << m_tests.back()->print(); | |
| 639 | + std::cout << m_tests.back()->print(); | |
| 643 | 640 | |
| 644 | 641 | //Return |
| 645 | 642 | return; |
| ... | ... | @@ -901,6 +898,9 @@ void GTestSuite::free_members(void) |
| 901 | 898 | delete m_tests[i]; |
| 902 | 899 | } |
| 903 | 900 | |
| 901 | + // Close logger | |
| 902 | + m_log.close(); | |
| 903 | + | |
| 904 | 904 | // Return |
| 905 | 905 | return; |
| 906 | 906 | } | ... | ... |
src/test/GTestSuites.cpp
| ... | ... | @@ -222,10 +222,10 @@ int GTestSuites::size(void) const |
| 222 | 222 | ***************************************************************************/ |
| 223 | 223 | void GTestSuites::append(GTestSuite& suite) |
| 224 | 224 | { |
| 225 | - //Add testsuite to container | |
| 225 | + // Add testsuite to container | |
| 226 | 226 | m_testsuites.push_back(&suite); |
| 227 | 227 | |
| 228 | - //Return | |
| 228 | + // Return | |
| 229 | 229 | return; |
| 230 | 230 | } |
| 231 | 231 | |
| ... | ... | @@ -244,9 +244,10 @@ bool GTestSuites::run(void) |
| 244 | 244 | std::string frame = fill("*", text.length()); |
| 245 | 245 | |
| 246 | 246 | // Log name of test suites |
| 247 | - m_log << std::endl << frame; | |
| 248 | - m_log << std::endl << text; | |
| 249 | - m_log << std::endl << frame; | |
| 247 | + std::cout << std::endl; | |
| 248 | + std::cout << frame << std::endl; | |
| 249 | + std::cout << text << std::endl; | |
| 250 | + std::cout << frame << std::endl; | |
| 250 | 251 | |
| 251 | 252 | // Initialise success flag |
| 252 | 253 | bool success = true; |
| ... | ... | @@ -472,6 +473,9 @@ void GTestSuites::copy_members(const GTestSuites& suites) |
| 472 | 473 | ***************************************************************************/ |
| 473 | 474 | void GTestSuites::free_members(void) |
| 474 | 475 | { |
| 476 | + // Close logger | |
| 477 | + m_log.close(); | |
| 478 | + | |
| 475 | 479 | // Return |
| 476 | 480 | return; |
| 477 | 481 | } | ... | ... |