From 2dce34daf936a0b8a6396f13bc1602d76f77aed4 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Thu, 25 Oct 2018 00:46:46 +0200 Subject: [PATCH] Use ASSERT_* instead of if()s and FAIL() --- tests/core/test_appdir.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/tests/core/test_appdir.cpp b/tests/core/test_appdir.cpp index 09d6f16..222f716 100644 --- a/tests/core/test_appdir.cpp +++ b/tests/core/test_appdir.cpp @@ -62,14 +62,10 @@ namespace AppDirTest { recursive_directory_iterator end_itr; // default construction yields past-the-end for (recursive_directory_iterator itr(tmpAppDir); itr != end_itr; itr++) { std::string path = relative(itr->path(), tmpAppDir).string(); - if (expected.find(path) == expected.end()) - FAIL(); - else - expected.erase(path); + ASSERT_NE(expected.find(path), expected.end()); + expected.erase(path); } - if (!expected.empty()) - FAIL(); - + ASSERT_TRUE(expected.empty()); } @@ -92,8 +88,7 @@ namespace AppDirTest { libsimple_library_found = true; } - if (!libsimple_library_found) - FAIL(); + ASSERT_TRUE(libsimple_library_found); } TEST_F(AppDirUnitTestsFixture, deployExecutable) { @@ -116,8 +111,7 @@ namespace AppDirTest { simple_executable_found = true; } - if (!libsimple_library_found || !simple_executable_found) - FAIL(); + ASSERT_TRUE(libsimple_library_found && !simple_executable_found); } TEST_F(AppDirUnitTestsFixture, deployDesktopFile) { @@ -134,8 +128,7 @@ namespace AppDirTest { simple_app_desktop_found = true; } - if (!simple_app_desktop_found) - FAIL(); + ASSERT_TRUE(simple_app_desktop_found); } @@ -153,8 +146,7 @@ namespace AppDirTest { simple_icon_found = true; } - if (!simple_icon_found) - FAIL(); + ASSERT_TRUE(simple_icon_found); } @@ -172,8 +164,7 @@ namespace AppDirTest { simple_file_found = true; } - if (!simple_file_found) - FAIL(); + ASSERT_TRUE(simple_file_found); } }