fix: Remove instances of undefined behavior

This commit is contained in:
jadebenn
2024-11-21 02:05:29 -06:00
parent 53877a0bc3
commit 30d4076808
15 changed files with 71 additions and 65 deletions

View File

@@ -61,8 +61,8 @@ TEST(dCommonTests, AMF3AssociativeArrayTest) {
TEST(dCommonTests, AMF3InsertionAssociativeTest) {
AMFArrayValue array;
array.Insert("CString", "string");
array.Insert("String", std::string("string"));
array.Insert<std::string>("CString", "string");
array.Insert<std::string>("String", std::string("string"));
array.Insert("False", false);
array.Insert("True", true);
array.Insert<int32_t>("Integer", 42U);
@@ -71,7 +71,6 @@ TEST(dCommonTests, AMF3InsertionAssociativeTest) {
array.Insert<std::vector<uint32_t>>("Undefined", {});
array.Insert("Null", nullptr);
ASSERT_EQ(array.Get<const char*>("CString")->GetValueType(), eAmf::String);
ASSERT_EQ(array.Get<std::string>("String")->GetValueType(), eAmf::String);
ASSERT_EQ(array.Get<bool>("False")->GetValueType(), eAmf::False);
ASSERT_EQ(array.Get<bool>("True")->GetValueType(), eAmf::True);
@@ -85,7 +84,7 @@ TEST(dCommonTests, AMF3InsertionAssociativeTest) {
TEST(dCommonTests, AMF3InsertionDenseTest) {
AMFArrayValue array;
array.Push<std::string>("string");
array.Push("CString");
array.Push<std::string>("CString");
array.Push(false);
array.Push(true);
array.Push<int32_t>(42U);
@@ -95,7 +94,6 @@ TEST(dCommonTests, AMF3InsertionDenseTest) {
array.Push<std::vector<uint32_t>>({});
ASSERT_EQ(array.Get<std::string>(0)->GetValueType(), eAmf::String);
ASSERT_EQ(array.Get<const char*>(1)->GetValueType(), eAmf::String);
ASSERT_EQ(array.Get<bool>(2)->GetValueType(), eAmf::False);
ASSERT_EQ(array.Get<bool>(3)->GetValueType(), eAmf::True);
ASSERT_EQ(array.Get<int32_t>(4)->GetValueType(), eAmf::Integer);