Удалил UType::object_ptr и заменил его на комбинацию из std::shared_ptr и std::weak_ptr из-за ужасной реализации.
This commit is contained in:
@@ -158,14 +158,15 @@ TEST(SaveMapTest, check_load_with_custom_type)
|
||||
EXPECT_EQ(test_vector_string[i], save_map.GetVectorString("TestVectorString")[i]);
|
||||
}
|
||||
|
||||
UType::object_ptr<CustomObject> obj = static_cast<UType::object_ptr<CustomObject>>(save_map.GetObject("CustomObject"));
|
||||
std::shared_ptr obj = std::static_pointer_cast<CustomObject>(save_map.GetObject("CustomObject"));
|
||||
|
||||
CustomObject test_obj;
|
||||
test_obj.num = 123;
|
||||
test_obj.str = "str123";
|
||||
test_obj.dbl = 123.45;
|
||||
EXPECT_EQ(*obj.get(), test_obj);
|
||||
|
||||
std::vector<UType::object_ptr<CustomObject>> vec_obj = reinterpret_cast<std::vector<UType::object_ptr<CustomObject>>&>(save_map.GetVectorObject("CustomObjects"));
|
||||
std::vector<std::shared_ptr<CustomObject>> vec_obj = reinterpret_cast<std::vector<std::shared_ptr<CustomObject>>&>(save_map.GetVectorObject("CustomObjects"));
|
||||
std::vector<CustomObject*> vec_obj_test = {
|
||||
new CustomObject,
|
||||
new CustomObject,
|
||||
@@ -179,7 +180,6 @@ TEST(SaveMapTest, check_load_with_custom_type)
|
||||
for (auto i = 0; i < 2; i++)
|
||||
{
|
||||
EXPECT_EQ(*vec_obj[i].get(), *vec_obj_test[i]);
|
||||
vec_obj[i].destroy();
|
||||
delete vec_obj_test[i];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user