1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge branch 'fixed_string_tests' into 'master'

Replace deprecated std::is_pod

See merge request OpenMW/openmw!2239
This commit is contained in:
psi29a 2022-08-04 09:55:51 +00:00
commit 00f8c9760a
2 changed files with 9 additions and 14 deletions

View File

@ -87,20 +87,6 @@ TEST(EsmFixedString, empty_strings)
}
}
TEST(EsmFixedString, struct_size)
{
ASSERT_EQ(4, sizeof(ESM::NAME));
ASSERT_EQ(32, sizeof(ESM::NAME32));
ASSERT_EQ(64, sizeof(ESM::NAME64));
}
TEST(EsmFixedString, is_pod)
{
ASSERT_TRUE(std::is_pod<ESM::NAME>::value);
ASSERT_TRUE(std::is_pod<ESM::NAME32>::value);
ASSERT_TRUE(std::is_pod<ESM::NAME64>::value);
}
TEST(EsmFixedString, assign_should_zero_untouched_bytes_for_4)
{
ESM::NAME value;

View File

@ -8,6 +8,7 @@
#include <cstdint>
#include <cassert>
#include <limits>
#include <type_traits>
namespace ESM
{
@ -171,6 +172,14 @@ using NAME = FixedString<4>;
using NAME32 = FixedString<32>;
using NAME64 = FixedString<64>;
static_assert(std::is_standard_layout_v<NAME> && std::is_trivial_v<NAME>);
static_assert(std::is_standard_layout_v<NAME32> && std::is_trivial_v<NAME32>);
static_assert(std::is_standard_layout_v<NAME64> && std::is_trivial_v<NAME64>);
static_assert(sizeof(NAME) == 4);
static_assert(sizeof(NAME32) == 32);
static_assert(sizeof(NAME64) == 64);
/* This struct defines a file 'context' which can be saved and later
restored by an ESMReader instance. It will save the position within
a file, and when restored will let you read from that position as