API
Applications
Utilities
API
Handbook
GitHub
Home
indiUtils_test.cpp
Go to the documentation of this file.
1
//#define CATCH_CONFIG_MAIN
2
#include "../../../tests/catch2/catch.hpp"
3
4
#include "../indiUtils.hpp"
5
using namespace
MagAOX::app::indi
;
6
7
8
SCENARIO
(
"Parsing INDI unique key"
,
"[indiUtils]"
)
9
{
10
GIVEN
(
"valid keys"
)
11
{
12
WHEN
(
"standard dev.prop"
)
13
{
14
std::string devName;
15
std::string propName;
16
17
int
rv =
parseIndiKey
( devName, propName,
"dev.prop"
);
18
19
REQUIRE
( rv == 0 );
20
REQUIRE
( devName ==
"dev"
);
21
REQUIRE
( propName ==
"prop"
);
22
}
23
24
25
}
26
27
GIVEN
(
"invalid keys"
)
28
{
29
WHEN
(
"empty"
)
30
{
31
std::string devName;
32
std::string propName;
33
34
int
rv =
parseIndiKey
( devName, propName,
""
);
35
36
REQUIRE
( rv == -1 );
37
}
38
39
WHEN
(
". only"
)
40
{
41
std::string devName;
42
std::string propName;
43
44
int
rv =
parseIndiKey
( devName, propName,
"."
);
45
46
REQUIRE
( rv == -1 );
47
}
48
49
WHEN
(
"no ."
)
50
{
51
std::string devName;
52
std::string propName;
53
54
int
rv =
parseIndiKey
( devName, propName,
"nada"
);
55
56
REQUIRE
( rv == -2 );
57
}
58
59
WHEN
(
"dev."
)
60
{
61
std::string devName;
62
std::string propName;
63
64
int
rv =
parseIndiKey
( devName, propName,
"dev."
);
65
66
REQUIRE
( rv == -4 );
67
}
68
69
WHEN
(
".prop"
)
70
{
71
std::string devName;
72
std::string propName;
73
74
int
rv =
parseIndiKey
( devName, propName,
".prop"
);
75
76
REQUIRE
( rv == -3 );
77
}
78
}
79
}
80
81
GIVEN
#define GIVEN(desc)
Definition:
catch.hpp:17763
WHEN
#define WHEN(desc)
Definition:
catch.hpp:17765
REQUIRE
#define REQUIRE(...)
Definition:
catch.hpp:17676
SCENARIO
SCENARIO("Parsing INDI unique key", "[indiUtils]")
Definition:
indiUtils_test.cpp:8
MagAOX::app::indi
Definition:
indiUtils.hpp:26
MagAOX::app::indi::parseIndiKey
int parseIndiKey(std::string &devName, std::string &propName, const std::string &key)
Parse an INDI key into the device and property names.
Definition:
indiUtils.hpp:317
libMagAOX
app
tests
indiUtils_test.cpp
Generated by
1.9.1