chore: add PRegParser header test (endianness)

This commit is contained in:
Корней Гедерт 2024-08-14 09:07:21 +04:00
parent a63b57c998
commit c5c9487589
2 changed files with 17 additions and 0 deletions

View File

@ -132,6 +132,21 @@ void PolTest::autogenerateCases(size_t seed)
auto test = parser->parse(file);
QCOMPARE(policyFile, test);
}
void PolTest::testPRegHeader()
{
std::stringstream stream;
pol::PolicyFile file;
auto parser = pol::createPregParser();
parser->write(stream, file);
std::vector<uint8_t> result(8), expected = { 0x50, 0x52, 0x65, 0x67, 0x01, 0x00, 0x00, 0x00};
stream.read(reinterpret_cast<char*>(result.data()), 8);
QCOMPARE(result, expected);
}
} // namespace tests
QTEST_MAIN(tests::PolTest)

View File

@ -39,6 +39,8 @@ private slots:
void testCase(QString filename);
void autogenerateCases(size_t seed);
void testPRegHeader();
};
} // namespace tests