@@ -29,6 +29,8 @@ class Derived : public Base
2929 Derived* sobjectPtr;
3030 PROPERTY (sobjectArr)
3131 std::array<Derived*, 2 > sobjectArr;
32+ PROPERTY (map)
33+ sh::core::SMap<std::string, int > map;
3234};
3335
3436TEST (ReflectionTest, TypeInfoTest)
@@ -56,7 +58,7 @@ TEST(ReflectionTest, PropertyTest)
5658 ASSERT_NE (numbersProperty, nullptr );
5759
5860 EXPECT_EQ (*numberProperty->Get <int >(&derived), 42 );
59- EXPECT_EQ (numbersProperty->GetTypeName () , sh::core::reflection::GetTypeName<std::vector<int >>());
61+ EXPECT_EQ (numbersProperty->type . name , sh::core::reflection::GetTypeName<std::vector<int >>());
6062
6163 auto begin = numbersProperty->Begin (&derived);
6264 auto end = numbersProperty->End (&derived);
@@ -94,6 +96,24 @@ TEST(ReflectionTest, PropertyTest)
9496 auto arrIterator = prop->Begin (&derived);
9597 EXPECT_FALSE (arrIterator.IsConst ());
9698 }
99+ // map 요소 변경 테스트
100+ {
101+ derived.map .insert ({ " test0" , 0 });
102+ derived.map .insert ({ " test1" , 1 });
103+ auto prop = derived.GetType ().GetProperty (" map" );
104+ EXPECT_TRUE (prop->isContainer );
105+ for (auto it = prop->Begin (&derived); it != prop->End (&derived); ++it)
106+ {
107+ EXPECT_TRUE (it.IsPair ());
108+ EXPECT_TRUE (it.GetPairType ()->first .isConst );
109+ EXPECT_TRUE (it.GetPairType ()->first == sh::core::reflection::GetType<std::string>());
110+ EXPECT_TRUE (it.GetPairType ()->second == sh::core::reflection::GetType<int >());
111+ auto pair = it.Get <std::pair<const std::string, int >>();
112+ pair->second ++;
113+ }
114+ EXPECT_EQ (derived.map [" test0" ], 1 );
115+ EXPECT_EQ (derived.map [" test1" ], 2 );
116+ }
97117}
98118
99119TEST (ReflectionTest, SafePropertyTest)
0 commit comments