8#include <gmock/gmock.h>
9#include <gtest/gtest.h>
15using namespace ::testing;
34 long naxes[2] = {128, 128};
35 fits_create_img(GetFile(), SHORT_IMG, 2, naxes, &status);
41 ElementsAre(IsKeyword(
"SIMPLE", KeywordType::Value),
42 IsKeyword(
"BITPIX", KeywordType::Value),
43 IsKeyword(
"NAXIS", KeywordType::Value),
44 IsKeyword(
"NAXIS1", KeywordType::Value),
45 IsKeyword(
"NAXIS2", KeywordType::Value),
46 IsKeyword(
"EXTEND", KeywordType::Value),
47 IsKeyword(
"COMMENT", KeywordType::Commentary),
48 IsKeyword(
"COMMENT", KeywordType::Commentary)))
49 << PrintToString(kws);
58 ElementsAre(IsKeyword(
"SIMPLE", KeywordType::Value),
59 IsKeyword(
"BITPIX", KeywordType::Value),
60 IsKeyword(
"NAXIS", KeywordType::Value),
61 IsKeyword(
"EXTEND", KeywordType::Value)))
62 << PrintToString(kws);
68 std::vector<LiteralKeyword> write;
69 write.emplace_back(
"SIMPLE = T / Standard FITS");
70 write.emplace_back(
"BITPIX = 8 / # of bits per pix value");
71 write.emplace_back(
"NAXIS = 0 / # of axes in data array");
79 ElementsAre(IsKeyword(
"SIMPLE", KeywordType::Value),
80 IsKeyword(
"BITPIX", KeywordType::Value),
81 IsKeyword(
"NAXIS", KeywordType::Value)))
82 << PrintToString(kws);
Contains functions and data structures related to cfitsio.
fitsfile * GetFile() const noexcept
Represents the literal 80-character FITS keyword record.
fitsfile * GetFile() const noexcept
Get fits pointer.
Contains common matchers.
void WriteKeywords(fitsfile *ptr, int hdu_num, std::vector< LiteralKeyword > const &keywords, std::optional< ssize_t > *remaining_size)
Write keywords to HDU identified by number hdu_num.
KeywordClass GetKeywordClass(std::string_view name)
Get keyword class.
void InitPrimaryHduNoImage(fitsfile *ptr)
Initializes an empty FITS file with a primary HDU.
KeywordClass
Fits keyword type.
std::vector< LiteralKeyword > ReadKeywords(fitsfile *ptr, int hdu_num)
Read keywords from HDU identifed by absolute position hdu_num.
void InitPrimaryHduEmpty(fitsfile *ptr)
Initializes an empty FITS file with an empty primary HDU (no keywords)
TEST_F(TestReadKeywords, ReadSimpleImg)
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")
ASSERT_EQ(meta.keyword_rules.size(), 1u)