9 #include <gtest/gtest.h>
10 #include <gmock/gmock.h>
12 #include <nlohmann/json.hpp>
25 auto trailing_comma = R
"(
28 "type": "valueKeyword",
30 "value": "VALUE STRING"
41 auto keywords_str = R
"(
44 "type": "valueKeyword",
46 "value": "VALUE STRING"
49 "type": "valueKeyword",
54 "type": "valueKeyword",
56 "value": -9223372036854775807
59 "type": "valueKeyword",
61 "value": 9223372036854775807
64 "type": "valueKeyword",
66 "value": 18446744073709551615
69 "type": "valueKeyword",
71 "value": -1.79769313486231e+308
74 "type": "valueKeyword",
76 "value": 1.79769313486231e+308
84 for (
auto const& kw_var : parsed) {
85 ASSERT_TRUE(std::holds_alternative<ValueKeyword>(kw_var));
120 auto keywords_str = R
"(
123 "type": "esoKeyword",
125 "value": "VALUE STRING"
128 "type": "esoKeyword",
133 "type": "esoKeyword",
135 "value": -9223372036854775807
138 "type": "esoKeyword",
140 "value": 9223372036854775807
143 "type": "esoKeyword",
145 "value": 18446744073709551615
148 "type": "esoKeyword",
150 "value": -1.79769313486231e+308
153 "type": "esoKeyword",
155 "value": 1.79769313486231e+308
158 "type": "esoKeyword",
159 "name": "KW WITH SPACE",
168 for (
auto const& kw_var : parsed) {
169 ASSERT_TRUE(std::holds_alternative<EsoKeyword>(kw_var));
173 EsoKeyword kw = std::get<EsoKeyword>(parsed[0]);
177 EsoKeyword kw = std::get<EsoKeyword>(parsed[1]);
181 EsoKeyword kw = std::get<EsoKeyword>(parsed[2]);
185 EsoKeyword kw = std::get<EsoKeyword>(parsed[3]);
189 EsoKeyword kw = std::get<EsoKeyword>(parsed[4]);
193 EsoKeyword kw = std::get<EsoKeyword>(parsed[5]);
197 EsoKeyword kw = std::get<EsoKeyword>(parsed[6]);
201 EsoKeyword kw = std::get<EsoKeyword>(parsed[7]);
208 auto keywords_str = R
"(
211 "type": "literalKeyword",
212 "value": "SIMPLE = T / Standard FITS"
215 "type": "literalKeyword",
216 "value": "OBJECT = 'target.cat' / Original target."
219 "type": "literalKeyword",
220 "value": "HIERARCH ESO KW = T / Comment"
228 for (
auto const& kw_var : parsed) {
229 ASSERT_TRUE(std::holds_alternative<LiteralKeyword>(kw_var));
249 auto keywords_str = R
"(
252 "type": "valueKeyword",
254 "value": "VALUE STRING",
255 "comment": "this is a comment"
258 "type": "esoKeyword",
260 "value": "VALUE STRING",
261 "comment": "this is also a comment"
269 ASSERT_TRUE(std::holds_alternative<ValueKeyword>(parsed[0]));
270 ASSERT_TRUE(std::holds_alternative<EsoKeyword>(parsed[1]));
277 EsoKeyword kw = std::get<EsoKeyword>(parsed[1]);
278 EXPECT_EQ(
EsoKeyword(
"STRKW2", std::string(
"VALUE STRING"),
"this is also a comment"), kw);
284 auto keywords_str = R
"(
293 auto keywords_str = R
"(
295 "type": "valueKeyword",
297 "value": 1.79769313486231e+308
305 auto keywords_str = R
"(
318 auto keywords_str = R
"(
331 auto keywords_str = R
"(
336 "value": 1.79769313486231e+308
345 auto keywords_str = R
"(
350 "value": 1.79769313486231e+308
359 auto keywords_str = R
"(
362 "type": "valueKeyword",
363 "value": 1.79769313486231e+308
372 auto keywords_str = R
"(
375 "type": "valueKeyword",
385 auto keywords_str = R
"(
388 "type": "literalKeyword"
397 auto keywords_str = R
"(
400 "type": "literalKeyword",
410 auto keywords_str = R
"(
413 "type": "literalKeyword",
414 "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0"
423 auto keywords_str = R
"(
426 "type": "valueKeyword",
428 "value": {"foo": true}
437 auto keywords_str = R
"(
440 "type": "valueKeyword",
451 auto keywords_str = R
"(
454 "type": "valueKeyword",
466 kws.push_back(ValueKeyword("NAME",
"VALUE",
"COMMENT"));
469 kws.push_back(
EsoKeyword(
"FOO BAR", -1234l,
"COMMENT"));
470 kws.push_back(
EsoKeyword(
"FOO BAR BAZ", 1234lu,
"COMMENT"));
476 EXPECT_THAT(parsed_kws, ::testing::ContainerEq(kws));
Represents the literal 80-character FITS keyword record.
std::string_view GetRecord() const &noexcept
Contains data structure for FITS keywords.
nlohmann::json SerializeJsonKeywords(std::vector< KeywordVariant > const &keywords)
SerializeJsons keyword to JSON.
std::vector< KeywordVariant > KeywordVector
Vector of keywords.
std::vector< KeywordVariant > ParseJsonKeywords(char const *keywords)
Parse and return FITS keywords.
BasicKeyword< ValueKeywordTraits > ValueKeyword
Standard FITS value keyword.
BasicKeyword< EsoKeywordTraits > EsoKeyword
ESO hiearchical keyword.
TEST_F(TestDpmDaqController, StatusUpdateInNotScheduledSucceeds)
A type safe version of LiteralKeyword that consist of the three basic components of a FITS keyword ke...
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")
ASSERT_EQ(meta.keyword_rules.size(), 1u)