Václav Kubernát | 5395e71 | 2019-12-03 18:24:33 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "trompeloeil_doctest.h" |
| 9 | #include "ast_path.hpp" |
| 10 | |
| 11 | TEST_CASE("path utils") |
| 12 | { |
| 13 | SECTION("pathToDataString") |
| 14 | { |
| 15 | dataPath_ path; |
| 16 | std::string expected; |
| 17 | SECTION("example-schema:twoKeyList[first='a'][second='b']") |
| 18 | { |
| 19 | SECTION("absolute") |
| 20 | { |
| 21 | path.m_scope = Scope::Absolute; |
| 22 | expected += "/"; |
| 23 | } |
| 24 | SECTION("relative") |
| 25 | { |
| 26 | path.m_scope = Scope::Relative; |
| 27 | } |
| 28 | path.m_nodes.push_back(dataNode_{module_{"example-schema"}, listElement_{"twoKeyList", {{"first", "a"}, {"second", "b"}}}}); |
| 29 | expected += "example-schema:twoKeyList[first='a'][second='b']"; |
| 30 | } |
| 31 | REQUIRE(pathToDataString(path) == expected); |
| 32 | } |
| 33 | } |