diff options
Diffstat (limited to 'entityx/Components_test.cc')
-rw-r--r-- | entityx/Components_test.cc | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/entityx/Components_test.cc b/entityx/Components_test.cc deleted file mode 100644 index d9a0ecd..0000000 --- a/entityx/Components_test.cc +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (C) 2012 Alec Thomas <alec@swapoff.org> - * All rights reserved. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. - * - * Author: Alec Thomas <alec@swapoff.org> - */ - -#include <gtest/gtest.h> -#include "entityx/Components.h" - -using namespace std; -using namespace boost; -using namespace entityx; - - -struct Position : public Component<Position> {}; - - -template <typename T> -int size(const T &t) { - int n = 0; - for (auto i : t) { - ++n; - (void)i; // Unused on purpose, suppress warning - } - return n; -} - - -TEST(TagsComponentTest, TestVariadicConstruction) { - auto tags = TagsComponent("player", "indestructible"); - unordered_set<string> expected; - expected.insert("player"); - expected.insert("indestructible"); - ASSERT_TRUE(expected == tags.tags); -} - -TEST(TagsComponentTest, TestEntitiesWithTag) { - EventManager ev; - EntityManager en(ev); - Entity a = en.create(); - a.assign<Position>(); - for (int i = 0; i < 99; ++i) { - auto e = en.create(); - e.assign<Position>(); - e.assign<TagsComponent>("positionable"); - } - a.assign<TagsComponent>("player", "indestructible"); - auto entities = en.entities_with_components<Position>(); - ASSERT_EQ(100, size(entities)); - ASSERT_EQ(1, size(TagsComponent::view(entities, "player"))); -} |