From 992fa938951558f4515145c9b82af0123c979a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 21 Aug 2016 01:04:32 +0200 Subject: Add get_first_non_empty and use it into Database to simplify a little bit --- tests/utils.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/utils.cpp') diff --git a/tests/utils.cpp b/tests/utils.cpp index 01d070e..e7ba415 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -6,6 +6,9 @@ #include #include #include +#include + +using namespace std::string_literals; TEST_CASE("String split") { @@ -100,3 +103,11 @@ TEST_CASE("string cut") CHECK(res[0] == "rhello, "); CHECK(res[1] == "♥"); } + +TEST_CASE("first non-empty string") +{ + CHECK(get_first_non_empty(""s, ""s, "hello"s, "world"s) == "hello"s); + CHECK(get_first_non_empty(""s, ""s, ""s, ""s) == ""s); + CHECK(get_first_non_empty("first"s) == "first"s); + CHECK(get_first_non_empty(0, 1, 2, 3) == 1); +} -- cgit v1.2.3