blob: 868189d508b415221f0b2fb4b8ae73b6978e1db8 [file] [log] [blame]
Václav Kubernát1d593902021-03-08 08:55:16 +01001/*
2 * Copyright (C) 2021 CESNET, https://photonics.cesnet.cz/
3 *
4 * Written by Václav Kubernát <kubervac@cesnet.cz>
5 *
6*/
7
8#include "trompeloeil_doctest.hpp"
9#include "parser.hpp"
10#include "pretty_printers.hpp"
11#include "static_schema.hpp"
12
13TEST_CASE("miscellaneous commands")
14{
15 auto schema = std::make_shared<StaticSchema>();
16 Parser parser(schema);
17 std::ostringstream errorStream;
18 SECTION("switch")
19 {
20 std::string input;
21 switch_ expected;
22 SECTION("operational")
23 {
24 expected.m_target = DatastoreTarget::Operational;
25 input = "switch operational";
26 }
27
28 SECTION("running")
29 {
30 expected.m_target = DatastoreTarget::Running;
31 input = "switch running";
32 }
33
34 SECTION("startup")
35 {
36 expected.m_target = DatastoreTarget::Startup;
37 input = "switch startup";
38 }
39 REQUIRE(boost::get<switch_>(parser.parseCommand(input, errorStream)) == expected);
40 }
41}