From 7f08cf83aa5db58bfac004dddae565e6536eeb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 15 Feb 2017 01:02:27 +0100 Subject: Little scopeguard cleanup, and add a test --- 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 48951da..d1f0edf 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -8,6 +8,7 @@ #include #include #include +#include using namespace std::string_literals; @@ -140,3 +141,13 @@ TEST_CASE("parse_datetime") CHECK(utils::parse_datetime("1970-01-02T00:00:12*00:00") == -1); CHECK(utils::parse_datetime("1970-01-02T00:00:12+0000") == -1); } + +TEST_CASE("scope_guard") +{ + bool res = false; + { + auto guard = utils::make_scope_guard([&res](){ res = true; }); + CHECK(!res); + } + CHECK(res); +} -- cgit v1.2.3 From d81cbc4a33ee2c28628ccb632af9ae1b27e84d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 27 Feb 2017 18:01:20 +0100 Subject: Use uname() instead of CMAKE_SYSTEM fix #3235 --- tests/utils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/utils.cpp') diff --git a/tests/utils.cpp b/tests/utils.cpp index d1f0edf..b8a3e75 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include using namespace std::string_literals; @@ -151,3 +152,9 @@ TEST_CASE("scope_guard") } CHECK(res); } + +TEST_CASE("system_name") +{ + CHECK(utils::get_system_name() != "Unknown"); + CHECK(!utils::get_system_name().empty()); +} \ No newline at end of file -- cgit v1.2.3 From 7b3e0e0cf3eddd3537455a3605b04a48ee663f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 30 Apr 2017 15:04:40 +0200 Subject: =?UTF-8?q?Make=20botan=E2=80=99s=20policy=20configurable=20from?= =?UTF-8?q?=20a=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #3244 --- tests/utils.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests/utils.cpp') diff --git a/tests/utils.cpp b/tests/utils.cpp index b8a3e75..c5ef7e7 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -10,6 +10,7 @@ #include #include #include +#include using namespace std::string_literals; @@ -157,4 +158,16 @@ TEST_CASE("system_name") { CHECK(utils::get_system_name() != "Unknown"); CHECK(!utils::get_system_name().empty()); -} \ No newline at end of file +} + +TEST_CASE("dirname") +{ + CHECK(utils::dirname("/") == "/"); + CHECK(utils::dirname("coucou.txt") == "./"); + CHECK(utils::dirname("../coucou.txt") == "../"); + CHECK(utils::dirname("/etc/biboumi/coucou.txt") == "/etc/biboumi/"); + CHECK(utils::dirname("..") == ".."); + CHECK(utils::dirname("../") == "../"); + CHECK(utils::dirname(".") == "."); + CHECK(utils::dirname("./") == "./"); +} -- cgit v1.2.3