Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 1 | /* |
| 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át | a33cf08 | 2019-03-28 11:55:57 +0100 | [diff] [blame^] | 9 | #include "trompeloeil_doctest.h" |
Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 10 | #include "utils.hpp" |
| 11 | |
| 12 | TEST_CASE("utils") |
| 13 | { |
Václav Kubernát | a395d33 | 2019-02-13 16:49:20 +0100 | [diff] [blame] | 14 | SECTION("filterByPrefix") |
Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 15 | { |
| 16 | std::set<std::string> set{"ahoj", "coze", "copak", "aha", "polivka"}; |
| 17 | |
Václav Kubernát | a395d33 | 2019-02-13 16:49:20 +0100 | [diff] [blame] | 18 | 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át | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 24 | } |
Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 25 | } |