Browse Source

fixed and added more tests for prototype

Michele Caini 7 years ago
parent
commit
2a34a3ebb6
2 changed files with 4 additions and 3 deletions
  1. 1 1
      src/entt/entity/prototype.hpp
  2. 3 2
      test/entt/entity/prototype.cpp

+ 1 - 1
src/entt/entity/prototype.hpp

@@ -95,7 +95,7 @@ public:
             it->component = std::move(component);
             it->component = std::move(component);
         }
         }
 
 
-        return *static_cast<Component *>(component.get());
+        return get<Component>();
     }
     }
 
 
     /**
     /**

+ 3 - 2
test/entt/entity/prototype.cpp

@@ -10,8 +10,9 @@ TEST(Prototype, Functionalities) {
     ASSERT_FALSE((prototype.has<int, char>()));
     ASSERT_FALSE((prototype.has<int, char>()));
     ASSERT_TRUE(registry.empty());
     ASSERT_TRUE(registry.empty());
 
 
-    prototype.set<int>(3);
-    prototype.set<char>('c');
+    ASSERT_EQ(prototype.set<int>(2), 2);
+    ASSERT_EQ(prototype.set<int>(3), 3);
+    ASSERT_EQ(prototype.set<char>('c'), 'c');
 
 
     ASSERT_EQ(prototype.get<int>(), 3);
     ASSERT_EQ(prototype.get<int>(), 3);
     ASSERT_EQ(cprototype.get<char>(), 'c');
     ASSERT_EQ(cprototype.get<char>(), 'c');