From 9941c06c33c601a3e59c008c35c6181ba8a2e7f9 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 15 Dec 2018 12:07:00 +0100 Subject: testing: rework test code --- tests/wanda/core_driver.cpp | 18 ------------------ tests/wanda/driver.cpp | 23 +++++++++++++++++++++++ tests/wanda/test_suite_xdg.cpp | 9 +++++---- tests/wanda/test_suite_xdg.hpp | 16 ---------------- 4 files changed, 28 insertions(+), 38 deletions(-) delete mode 100644 tests/wanda/core_driver.cpp create mode 100644 tests/wanda/driver.cpp delete mode 100644 tests/wanda/test_suite_xdg.hpp (limited to 'tests') diff --git a/tests/wanda/core_driver.cpp b/tests/wanda/core_driver.cpp deleted file mode 100644 index 3643da0..0000000 --- a/tests/wanda/core_driver.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "test_suite_xdg.hpp" - -#include "cute/cute.h" -#include "cute/cute_runner.h" -#include "cute/tap_listener.h" - -#include -#include -#include -#include - -int main(int argc, char const *const *argv) -{ - auto listener = cute::tap_listener<>{std::cout}; - auto runner = cute::makeRunner(listener, argc, argv); - auto suites = std::vector>{wanda::test_suite_xdg()}; - return !all_of(cbegin(suites), cend(suites), [&](auto const &suite) { return runner(suite.first, suite.second.c_str()); }); -} \ No newline at end of file diff --git a/tests/wanda/driver.cpp b/tests/wanda/driver.cpp new file mode 100644 index 0000000..e0dd7c8 --- /dev/null +++ b/tests/wanda/driver.cpp @@ -0,0 +1,23 @@ +#include "cute/cute.h" +#include "cute/cute_runner.h" +#include "cute/tap_listener.h" + +#include +#include +#include +#include +#include +#include + +namespace wanda::test +{ + std::pair suite(); +} + +int main(int argc, char const *const *argv) +{ + auto listener = cute::tap_listener<>{std::cout}; + auto runner = cute::makeRunner(listener, argc, argv); + auto suite = wanda::test::suite(); + return !runner(suite.first, suite.second.c_str()); +} \ No newline at end of file diff --git a/tests/wanda/test_suite_xdg.cpp b/tests/wanda/test_suite_xdg.cpp index 0338ee3..70597f7 100644 --- a/tests/wanda/test_suite_xdg.cpp +++ b/tests/wanda/test_suite_xdg.cpp @@ -1,13 +1,14 @@ -#include "test_suite_xdg.hpp" #include -#include "cute/cute.h" +#include #include #include +#include +#include -namespace wanda +namespace wanda::test { namespace @@ -76,7 +77,7 @@ void test_xdg_path_for_runtime_dir_with_xdg_runtime_dir_in_environment() ASSERT_EQUAL("/home/cute/xdg_runtime_dir", xdg_path_for(xdg_directory::runtime_dir, env)); } -std::pair test_suite_xdg() +std::pair suite() { return std::make_pair(cute::suite{ CUTE(test_xdg_variables), diff --git a/tests/wanda/test_suite_xdg.hpp b/tests/wanda/test_suite_xdg.hpp deleted file mode 100644 index 698ad9a..0000000 --- a/tests/wanda/test_suite_xdg.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef WANDA_TEST_SUITE_XDG_HPP -#define WANDA_TEST_SUITE_XDG_HPP - -#include "cute/cute.h" - -#include -#include - -namespace wanda -{ - -std::pair test_suite_xdg(); - -} // namespace wanda - -#endif \ No newline at end of file -- cgit v1.2.3