Commit e56058a5e48a922939c751555e24c9234375bb32

Authored by Jürgen Knödlseder
1 parent 6d3f797e

Use empty() instead of size() for emptiness check.

Showing 1 changed file with 4 additions and 4 deletions
src/test/GTestSuite.cpp
... ... @@ -621,7 +621,7 @@ void GTestSuite::test_try(const std::string& name)
621 621 void GTestSuite::test_try_success(void)
622 622 {
623 623 // If the stack is empty
624   - if (m_stack_try.size() == 0) {
  624 + if (m_stack_try.empty()) {
625 625 throw GException::test_nested_try_error(G_TRY_SUCCESS,
626 626 "Called "G_TRY_SUCCESS" without a previous call to test_try()");
627 627 }
... ... @@ -669,7 +669,7 @@ void GTestSuite::test_try_failure(const std::string& message,
669 669 const std::string& type)
670 670 {
671 671 // If the stack is empty
672   - if (m_stack_try.size() == 0) {
  672 + if (m_stack_try.empty()) {
673 673 throw GException::test_nested_try_error(G_TRY_FAILURE1,
674 674 "Called "G_TRY_FAILURE1" without a previous call to test_try()");
675 675 }
... ... @@ -730,7 +730,7 @@ void GTestSuite::test_try_failure(const std::string& message,
730 730 void GTestSuite::test_try_failure(const std::exception& e)
731 731 {
732 732 // If the stack is empty
733   - if (m_stack_try.size() == 0) {
  733 + if (m_stack_try.empty()) {
734 734 throw GException::test_nested_try_error(G_TRY_FAILURE2,
735 735 "Called "G_TRY_FAILURE2" without a previous call to test_try()");
736 736 }
... ... @@ -987,7 +987,7 @@ std::string GTestSuite::format_name(const std::string& name)
987 987 std::string format_name;
988 988  
989 989 // Set name of the try blocks
990   - if (m_stack_try.size() > 0) {
  990 + if (!m_stack_try.empty()) {
991 991 format_name += m_stack_try.back()->name();
992 992 }
993 993 else {
... ...