test: cleanup
This commit is contained in:
3
TODO
3
TODO
@@ -24,9 +24,6 @@ Next:
|
||||
* review multi component views to reduce instantiations once empty types are gone...
|
||||
* move signals down to the storage class?
|
||||
|
||||
* WIP:
|
||||
- update tests for fast/std paths
|
||||
|
||||
* WIP:
|
||||
- introduce the component iterators for non-contiguous collections of entities (multi component views, observers, user defined collections)
|
||||
- deprecate snapshot, loader, ...
|
||||
|
||||
@@ -115,8 +115,6 @@ if(BUILD_LIB)
|
||||
SETUP_LIB_TEST(meta)
|
||||
SETUP_LIB_TEST(registry)
|
||||
|
||||
SETUP_LIB_TEST(meta_std ENTT_STANDARD_CPP)
|
||||
|
||||
SETUP_PLUGIN_TEST(dispatcher_plugin)
|
||||
SETUP_PLUGIN_TEST(emitter_plugin)
|
||||
SETUP_PLUGIN_TEST(meta_plugin)
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include <entt/core/attribute.h>
|
||||
#include <entt/core/hashed_string.hpp>
|
||||
#include <entt/meta/factory.hpp>
|
||||
#include <entt/meta/meta.hpp>
|
||||
#include "types.h"
|
||||
|
||||
position create_position(int x, int y) {
|
||||
return position{x, y};
|
||||
}
|
||||
|
||||
ENTT_API void set_up(entt::meta_ctx ctx) {
|
||||
entt::meta_ctx::bind(ctx);
|
||||
|
||||
entt::meta<position>()
|
||||
.alias("position"_hs)
|
||||
.ctor<&create_position>()
|
||||
.data<&position::x>("x"_hs)
|
||||
.data<&position::y>("y"_hs);
|
||||
|
||||
entt::meta<velocity>()
|
||||
.alias("velocity"_hs)
|
||||
.ctor<>()
|
||||
.data<&velocity::dx>("dx"_hs)
|
||||
.data<&velocity::dy>("dy"_hs);
|
||||
}
|
||||
|
||||
ENTT_API void tear_down() {
|
||||
entt::meta<position>().reset();
|
||||
entt::meta<velocity>().reset();
|
||||
}
|
||||
|
||||
ENTT_API entt::meta_any wrap_int(int value) {
|
||||
return value;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <entt/core/attribute.h>
|
||||
#include <entt/meta/factory.hpp>
|
||||
#include <entt/meta/meta.hpp>
|
||||
#include "types.h"
|
||||
|
||||
ENTT_API void set_up(entt::meta_ctx);
|
||||
ENTT_API void tear_down();
|
||||
ENTT_API entt::meta_any wrap_int(int);
|
||||
|
||||
TEST(Lib, Meta) {
|
||||
ASSERT_FALSE(entt::resolve("position"_hs));
|
||||
|
||||
set_up(entt::meta_ctx{});
|
||||
entt::meta<double>().conv<int>();
|
||||
|
||||
ASSERT_TRUE(entt::resolve("position"_hs));
|
||||
ASSERT_TRUE(entt::resolve("velocity"_hs));
|
||||
|
||||
auto pos = entt::resolve("position"_hs).construct(42., 3.);
|
||||
auto vel = entt::resolve("velocity"_hs).ctor().invoke();
|
||||
|
||||
ASSERT_TRUE(pos && vel);
|
||||
|
||||
ASSERT_EQ(pos.type().data("x"_hs).type(), entt::resolve<int>());
|
||||
ASSERT_TRUE(pos.type().data("y"_hs).get(*pos).try_cast<int>());
|
||||
ASSERT_EQ(pos.type().data("x"_hs).get(*pos).cast<int>(), 42);
|
||||
ASSERT_EQ(pos.type().data("y"_hs).get(*pos).cast<int>(), 3);
|
||||
|
||||
ASSERT_EQ(vel.type().data("dx"_hs).type(), entt::resolve<double>());
|
||||
ASSERT_TRUE(vel.type().data("dy"_hs).get(*vel).convert<double>());
|
||||
ASSERT_EQ(vel.type().data("dx"_hs).get(*vel).cast<double>(), 0.);
|
||||
ASSERT_EQ(vel.type().data("dy"_hs).get(*vel).cast<double>(), 0.);
|
||||
|
||||
ASSERT_EQ(wrap_int(42).type(), entt::resolve<int>());
|
||||
ASSERT_EQ(wrap_int(42).cast<int>(), 42);
|
||||
|
||||
tear_down();
|
||||
|
||||
ASSERT_FALSE(entt::resolve("position"_hs));
|
||||
ASSERT_FALSE(entt::resolve("velocity"_hs));
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef ENTT_LIB_META_STD_TYPES_H
|
||||
#define ENTT_LIB_META_STD_TYPES_H
|
||||
|
||||
struct position {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct velocity {
|
||||
double dx;
|
||||
double dy;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user