blob: a6a982bbd61cbad5271c837a5f3fb8414cb852ad [file] [log] [blame]
Václav Kubernát4108e0d2018-10-29 13:32:22 +01001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
8
Jan Kundráta33cf082019-03-28 11:55:57 +01009#include "trompeloeil_doctest.h"
Václav Kubernát4108e0d2018-10-29 13:32:22 +010010#include "utils.hpp"
11
12TEST_CASE("utils")
13{
Václav Kubernáta395d332019-02-13 16:49:20 +010014 SECTION("filterByPrefix")
Václav Kubernát4108e0d2018-10-29 13:32:22 +010015 {
16 std::set<std::string> set{"ahoj", "coze", "copak", "aha", "polivka"};
17
Václav Kubernáta395d332019-02-13 16:49:20 +010018 REQUIRE((filterByPrefix(set, "a") == std::set<std::string>{"ahoj", "aha"}));
19 REQUIRE((filterByPrefix(set, "ah") == std::set<std::string>{"ahoj", "aha"}));
20 REQUIRE((filterByPrefix(set, "aho") == std::set<std::string>{"ahoj"}));
21 REQUIRE((filterByPrefix(set, "polivka") == std::set<std::string>{"polivka"}));
22 REQUIRE((filterByPrefix(set, "polivkax") == std::set<std::string>{}));
23 REQUIRE((filterByPrefix(set, "co") == std::set<std::string>{"copak", "coze"}));
Václav Kubernát4108e0d2018-10-29 13:32:22 +010024 }
Václav Kubernát4108e0d2018-10-29 13:32:22 +010025}