blob: 62e4c23872d1ba515cd39567b30d3a31441f29a3 [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
9#include "trompeloeil_catch.h"
10#include "utils.hpp"
11
12TEST_CASE("utils")
13{
14 SECTION("filterAndErasePrefix")
15 {
16 std::set<std::string> set{"ahoj", "coze", "copak", "aha", "polivka"};
17
18 REQUIRE((filterAndErasePrefix(set, "a") == std::set<std::string>{"hoj", "ha"}));
19 REQUIRE((filterAndErasePrefix(set, "ah") == std::set<std::string>{"oj", "a"}));
20 REQUIRE((filterAndErasePrefix(set, "aho") == std::set<std::string>{"j"}));
21 REQUIRE((filterAndErasePrefix(set, "polivka") == std::set<std::string>{""}));
22 REQUIRE((filterAndErasePrefix(set, "polivka") == std::set<std::string>{""}));
23 REQUIRE((filterAndErasePrefix(set, "polivkax") == std::set<std::string>{}));
24 REQUIRE((filterAndErasePrefix(set, "co") == std::set<std::string>{"pak", "ze"}));
25 }
26
27}