Skip to content

Commit

Permalink
Replace C array with std::array<> (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhuggett authored Nov 18, 2023
1 parent b3ad08c commit 5042e6c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions unittests/test_dom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@ TEST_F (Dom, Array2) {
ASSERT_THAT (root, Optional (VariantWith<array> (_)));
auto const &arr = *std::get<array> (*root);
// Check the array contents.
std::byte const expected_bytes[] = {
std::array<std::byte, 4> const expected_bytes = {{
std::byte{0xEF}, std::byte{0xBF},
std::byte{0xBD}, // REPLACEMENT CHARACTER
std::byte{0x00} // NULL
};
ASSERT_THAT (arr, ElementsAre (VariantWith<u8string> (u8string{
reinterpret_cast<char8 const *> (expected_bytes)})));
}};
ASSERT_THAT (arr,
ElementsAre (VariantWith<u8string> (u8string{
reinterpret_cast<char8 const *> (expected_bytes.data ())})));
// Check the parent pointers.
EXPECT_EQ (root->parent, nullptr);
EXPECT_THAT (arr, Each (Field ("parent", parent_field, Eq (&root.value ()))));
Expand Down

0 comments on commit 5042e6c

Please sign in to comment.