mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-13 11:43:06 +00:00
Put ESM::FixedString tests into unnamed namespace
This commit is contained in:
parent
c9d57788fb
commit
7c60905266
1 changed files with 132 additions and 129 deletions
|
|
@ -2,8 +2,10 @@
|
|||
#include "components/esm/esmcommon.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(EsmFixedString, operator__eq_ne)
|
||||
namespace
|
||||
{
|
||||
TEST(EsmFixedString, operator__eq_ne)
|
||||
{
|
||||
{
|
||||
SCOPED_TRACE("asdc == asdc");
|
||||
constexpr ESM::NAME name("asdc");
|
||||
|
|
@ -34,9 +36,9 @@ TEST(EsmFixedString, operator__eq_ne)
|
|||
EXPECT_TRUE(name == ss.c_str());
|
||||
EXPECT_TRUE(name == ss);
|
||||
}
|
||||
}
|
||||
TEST(EsmFixedString, operator__eq_ne_const)
|
||||
{
|
||||
}
|
||||
TEST(EsmFixedString, operator__eq_ne_const)
|
||||
{
|
||||
{
|
||||
SCOPED_TRACE("asdc == asdc (const)");
|
||||
constexpr ESM::NAME name("asdc");
|
||||
|
|
@ -67,10 +69,10 @@ TEST(EsmFixedString, operator__eq_ne_const)
|
|||
EXPECT_TRUE(name == ss.c_str());
|
||||
EXPECT_TRUE(name == ss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, empty_strings)
|
||||
{
|
||||
TEST(EsmFixedString, empty_strings)
|
||||
{
|
||||
{
|
||||
SCOPED_TRACE("4 bytes");
|
||||
ESM::NAME empty = ESM::NAME();
|
||||
|
|
@ -85,59 +87,60 @@ TEST(EsmFixedString, empty_strings)
|
|||
EXPECT_TRUE(empty == "");
|
||||
EXPECT_TRUE(empty != "some string");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, assign_should_zero_untouched_bytes_for_4)
|
||||
{
|
||||
TEST(EsmFixedString, assign_should_zero_untouched_bytes_for_4)
|
||||
{
|
||||
ESM::NAME value;
|
||||
value = static_cast<uint32_t>(0xFFFFFFFFu);
|
||||
value.assign(std::string(1, 'a'));
|
||||
EXPECT_EQ(value, static_cast<uint32_t>('a')) << value.toInt();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, assign_should_only_truncate_for_4)
|
||||
{
|
||||
TEST(EsmFixedString, assign_should_only_truncate_for_4)
|
||||
{
|
||||
ESM::NAME value;
|
||||
value.assign(std::string(5, 'a'));
|
||||
EXPECT_EQ(value, std::string(4, 'a'));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, assign_should_truncate_and_set_last_element_to_zero)
|
||||
{
|
||||
TEST(EsmFixedString, assign_should_truncate_and_set_last_element_to_zero)
|
||||
{
|
||||
ESM::FixedString<17> value;
|
||||
value.assign(std::string(20, 'a'));
|
||||
EXPECT_EQ(value, std::string(16, 'a'));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, assign_should_truncate_and_set_last_element_to_zero_for_32)
|
||||
{
|
||||
TEST(EsmFixedString, assign_should_truncate_and_set_last_element_to_zero_for_32)
|
||||
{
|
||||
ESM::NAME32 value;
|
||||
value.assign(std::string(33, 'a'));
|
||||
EXPECT_EQ(value, std::string(31, 'a'));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, assign_should_truncate_and_set_last_element_to_zero_for_64)
|
||||
{
|
||||
TEST(EsmFixedString, assign_should_truncate_and_set_last_element_to_zero_for_64)
|
||||
{
|
||||
ESM::NAME64 value;
|
||||
value.assign(std::string(65, 'a'));
|
||||
EXPECT_EQ(value, std::string(63, 'a'));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, assignment_operator_is_supported_for_uint32)
|
||||
{
|
||||
TEST(EsmFixedString, assignment_operator_is_supported_for_uint32)
|
||||
{
|
||||
ESM::NAME value;
|
||||
value = static_cast<uint32_t>(0xFEDCBA98u);
|
||||
EXPECT_EQ(value, static_cast<uint32_t>(0xFEDCBA98u)) << value.toInt();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, construction_from_uint32_is_supported)
|
||||
{
|
||||
TEST(EsmFixedString, construction_from_uint32_is_supported)
|
||||
{
|
||||
constexpr ESM::NAME value(0xFEDCBA98u);
|
||||
EXPECT_EQ(value, static_cast<std::uint32_t>(0xFEDCBA98u)) << value.toInt();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(EsmFixedString, construction_from_RecNameInts_is_supported)
|
||||
{
|
||||
TEST(EsmFixedString, construction_from_RecNameInts_is_supported)
|
||||
{
|
||||
constexpr ESM::NAME value(ESM::RecNameInts::REC_ACTI);
|
||||
EXPECT_EQ(value, static_cast<std::uint32_t>(ESM::RecNameInts::REC_ACTI)) << value.toInt();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue