Commit c0ca6bc6ecce0d16d1ca072820e998f5edc2791d
1 parent
fe39596d
Put the test suite test case before the individual test cases that are done within a test suite.
GTestSuite::run starts with creating a test case that collects the total time spent in a test and that also collects any failures of the individual test cases. Before, this test case was appended AFTER running the individual test cases, which led to an XML file out of order. Now the general test case is appended BEFORE running the test cases.
Showing
1 changed file
with
5 additions
and
5 deletions
src/test/GTestSuite.cpp
| @@ -279,6 +279,9 @@ bool GTestSuite::run(void) | @@ -279,6 +279,9 @@ bool GTestSuite::run(void) | ||
| 279 | // Create a test of error type for function testing | 279 | // Create a test of error type for function testing |
| 280 | GTestCase* test = new GTestCase(GTestCase::ERROR_TEST, m_names[m_index]); | 280 | GTestCase* test = new GTestCase(GTestCase::ERROR_TEST, m_names[m_index]); |
| 281 | 281 | ||
| 282 | + // Add test case to test suite | ||
| 283 | + m_tests.push_back(test); | ||
| 284 | + | ||
| 282 | // Set start time | 285 | // Set start time |
| 283 | #ifdef _OPENMP | 286 | #ifdef _OPENMP |
| 284 | double t_start = omp_get_wtime(); | 287 | double t_start = omp_get_wtime(); |
| @@ -335,12 +338,9 @@ bool GTestSuite::run(void) | @@ -335,12 +338,9 @@ bool GTestSuite::run(void) | ||
| 335 | success = false; | 338 | success = false; |
| 336 | } | 339 | } |
| 337 | 340 | ||
| 338 | - // Add test case to test suite | ||
| 339 | - m_tests.push_back(test); | ||
| 340 | - | ||
| 341 | } // endif: test case has a function pointer | 341 | } // endif: test case has a function pointer |
| 342 | 342 | ||
| 343 | - } // endwhile: there were tests on the stack | 343 | + } // endfor: looped over tests on the stack |
| 344 | 344 | ||
| 345 | // Reset index | 345 | // Reset index |
| 346 | m_index = 0; | 346 | m_index = 0; |
| @@ -354,7 +354,7 @@ bool GTestSuite::run(void) | @@ -354,7 +354,7 @@ bool GTestSuite::run(void) | ||
| 354 | * @brief Test an assert | 354 | * @brief Test an assert |
| 355 | * | 355 | * |
| 356 | * @param[in] assert Assert (true/false). | 356 | * @param[in] assert Assert (true/false). |
| 357 | - * @param[in] name Test case name (defaults to ""). | 357 | + * @param[in] name Test case name. |
| 358 | * @param[in] message Test case name (defaults to ""). | 358 | * @param[in] message Test case name (defaults to ""). |
| 359 | * | 359 | * |
| 360 | * Tests if a condition is true or false. This method adds a test case of | 360 | * Tests if a condition is true or false. This method adds a test case of |