From c80ba92ab72391f98eb42491db102707ace3f874 Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 2 Jan 2023 17:21:36 +0100 Subject: [PATCH] Add more tests for ESM::FixedString --- .../esm/test_fixed_string.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apps/openmw_test_suite/esm/test_fixed_string.cpp b/apps/openmw_test_suite/esm/test_fixed_string.cpp index bcf776ca51..f3d4071c28 100644 --- a/apps/openmw_test_suite/esm/test_fixed_string.cpp +++ b/apps/openmw_test_suite/esm/test_fixed_string.cpp @@ -37,6 +37,7 @@ namespace EXPECT_TRUE(name == ss); } } + TEST(EsmFixedString, operator__eq_ne_const) { { @@ -143,4 +144,30 @@ namespace constexpr ESM::NAME value(ESM::RecNameInts::REC_ACTI); EXPECT_EQ(value, static_cast(ESM::RecNameInts::REC_ACTI)) << value.toInt(); } + + TEST(EsmFixedString, equality_operator_for_not_convertible_to_uint32_with_string_literal) + { + const ESM::FixedString<5> value("abcd"); + EXPECT_EQ(value, "abcd"); + } + + TEST(EsmFixedString, equality_operator_for_not_convertible_to_uint32_with_fixed_size_char_array) + { + const ESM::FixedString<5> value("abcd"); + const char other[5] = { 'a', 'b', 'c', 'd', '\0' }; + EXPECT_EQ(value, other); + } + + TEST(EsmFixedString, equality_operator_for_not_convertible_to_uint32_with_const_char_pointer) + { + const ESM::FixedString<5> value("abcd"); + const char other[5] = { 'a', 'b', 'c', 'd', '\0' }; + EXPECT_EQ(value, static_cast(other)); + } + + TEST(EsmFixedString, equality_operator_for_not_convertible_to_uint32_with_string) + { + const ESM::FixedString<5> value("abcd"); + EXPECT_EQ(value, std::string("abcd")); + } }