Bläddra i källkod

test: share as much as possible

Michele Caini 3 år sedan
förälder
incheckning
831054bff1

+ 10 - 0
test/lib/dispatcher/common/types.h

@@ -0,0 +1,10 @@
+#ifndef ENTT_LIB_DISPATCHER_COMMON_TYPES_H
+#define ENTT_LIB_DISPATCHER_COMMON_TYPES_H
+
+struct message {
+    int payload;
+};
+
+struct event {};
+
+#endif

+ 1 - 1
test/lib/dispatcher/plugin/main.cpp

@@ -4,7 +4,7 @@
 #include <cr.h>
 #include <entt/signal/dispatcher.hpp>
 #include <entt/signal/sigh.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 struct listener {
     void on(message msg) {

+ 1 - 1
test/lib/dispatcher/plugin/plugin.cpp

@@ -1,6 +1,6 @@
 #include <cr.h>
 #include <entt/signal/dispatcher.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
     switch(operation) {

+ 0 - 10
test/lib/dispatcher/plugin/types.h

@@ -1,10 +0,0 @@
-#ifndef ENTT_LIB_DISPATCHER_PLUGIN_TYPES_H
-#define ENTT_LIB_DISPATCHER_PLUGIN_TYPES_H
-
-struct message {
-    int payload;
-};
-
-struct event {};
-
-#endif

+ 1 - 1
test/lib/dispatcher/shared/lib.cpp

@@ -1,6 +1,6 @@
 #include <entt/core/attribute.h>
 #include <entt/signal/dispatcher.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void trigger(entt::dispatcher &dispatcher) {
     dispatcher.trigger<event>();

+ 1 - 1
test/lib/dispatcher/shared/main.cpp

@@ -3,7 +3,7 @@
 #include <entt/core/utility.hpp>
 #include <entt/signal/dispatcher.hpp>
 #include <entt/signal/sigh.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void trigger(entt::dispatcher &);
 

+ 0 - 10
test/lib/dispatcher/shared/types.h

@@ -1,10 +0,0 @@
-#ifndef ENTT_LIB_DISPATCHER_TYPES_H
-#define ENTT_LIB_DISPATCHER_TYPES_H
-
-struct message {
-    int payload;
-};
-
-struct event {};
-
-#endif

+ 2 - 2
test/lib/emitter/plugin/types.h → test/lib/emitter/common/types.h

@@ -1,5 +1,5 @@
-#ifndef ENTT_LIB_EMITTER_PLUGIN_TYPES_H
-#define ENTT_LIB_EMITTER_PLUGIN_TYPES_H
+#ifndef ENTT_LIB_EMITTER_COMMON_TYPES_H
+#define ENTT_LIB_EMITTER_COMMON_TYPES_H
 
 #include <entt/signal/emitter.hpp>
 

+ 1 - 1
test/lib/emitter/plugin/main.cpp

@@ -2,7 +2,7 @@
 
 #include <gtest/gtest.h>
 #include <cr.h>
-#include "types.h"
+#include "../common/types.h"
 
 TEST(Lib, Emitter) {
     test_emitter emitter;

+ 1 - 1
test/lib/emitter/plugin/plugin.cpp

@@ -1,5 +1,5 @@
 #include <cr.h>
-#include "types.h"
+#include "../common/types.h"
 
 CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
     switch(operation) {

+ 1 - 1
test/lib/emitter/shared/lib.cpp

@@ -1,5 +1,5 @@
 #include <entt/core/attribute.h>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void emit(test_emitter &emitter) {
     emitter.publish(event{});

+ 1 - 1
test/lib/emitter/shared/main.cpp

@@ -1,6 +1,6 @@
 #include <gtest/gtest.h>
 #include <entt/core/attribute.h>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void emit(test_emitter &);
 

+ 0 - 15
test/lib/emitter/shared/types.h

@@ -1,15 +0,0 @@
-#ifndef ENTT_LIB_EMITTER_TYPES_H
-#define ENTT_LIB_EMITTER_TYPES_H
-
-#include <entt/signal/emitter.hpp>
-
-struct test_emitter
-    : entt::emitter<test_emitter> {};
-
-struct message {
-    int payload;
-};
-
-struct event {};
-
-#endif

+ 8 - 0
test/lib/locator/common/types.h

@@ -0,0 +1,8 @@
+#ifndef ENTT_LIB_LOCATOR_COMMON_TYPES_H
+#define ENTT_LIB_LOCATOR_COMMON_TYPES_H
+
+struct service {
+    int value;
+};
+
+#endif

+ 1 - 0
test/lib/locator/plugin/main.cpp

@@ -3,6 +3,7 @@
 #include <gtest/gtest.h>
 #include <cr.h>
 #include <entt/locator/locator.hpp>
+#include "../common/types.h"
 #include "types.h"
 
 TEST(Lib, Locator) {

+ 1 - 0
test/lib/locator/plugin/plugin.cpp

@@ -1,5 +1,6 @@
 #include <cr.h>
 #include <entt/locator/locator.hpp>
+#include "../common/types.h"
 #include "types.h"
 
 CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {

+ 0 - 4
test/lib/locator/plugin/types.h

@@ -3,10 +3,6 @@
 
 #include <entt/locator/locator.hpp>
 
-struct service {
-    int value;
-};
-
 struct userdata {
     typename entt::locator<service>::node_type handle;
     int value;

+ 1 - 1
test/lib/locator/shared/lib.cpp

@@ -1,6 +1,6 @@
 #include <entt/core/attribute.h>
 #include <entt/locator/locator.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void set_up(const entt::locator<service>::node_type &handle) {
     entt::locator<service>::reset(handle);

+ 1 - 1
test/lib/locator/shared/main.cpp

@@ -1,7 +1,7 @@
 #include <gtest/gtest.h>
 #include <entt/core/attribute.h>
 #include <entt/locator/locator.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void set_up(const entt::locator<service>::node_type &);
 ENTT_API void use_service(int);

+ 0 - 8
test/lib/locator/shared/types.h

@@ -1,8 +0,0 @@
-#ifndef ENTT_LIB_LOCATOR_TYPES_H
-#define ENTT_LIB_LOCATOR_TYPES_H
-
-struct service {
-    int value;
-};
-
-#endif

+ 2 - 2
test/lib/registry/shared/types.h → test/lib/meta/common/types.h

@@ -1,5 +1,5 @@
-#ifndef ENTT_LIB_REGISTRY_TYPES_H
-#define ENTT_LIB_REGISTRY_TYPES_H
+#ifndef ENTT_LIB_META_COMMON_TYPES_H
+#define ENTT_LIB_META_COMMON_TYPES_H
 
 struct position {
     int x;

+ 1 - 0
test/lib/meta/plugin/plugin.cpp

@@ -4,6 +4,7 @@
 #include <entt/meta/context.hpp>
 #include <entt/meta/factory.hpp>
 #include <entt/meta/meta.hpp>
+#include "../common/types.h"
 #include "types.h"
 
 position create_position(int x, int y) {

+ 0 - 10
test/lib/meta/plugin/types.h

@@ -4,16 +4,6 @@
 #include <entt/locator/locator.hpp>
 #include <entt/meta/meta.hpp>
 
-struct position {
-    int x;
-    int y;
-};
-
-struct velocity {
-    double dx;
-    double dy;
-};
-
 struct userdata {
     entt::locator<entt::meta_ctx>::node_type ctx;
     entt::meta_any any;

+ 1 - 0
test/lib/meta/plugin_std/plugin.cpp

@@ -3,6 +3,7 @@
 #include <entt/meta/context.hpp>
 #include <entt/meta/factory.hpp>
 #include <entt/meta/meta.hpp>
+#include "../common/types.h"
 #include "types.h"
 
 position create_position(int x, int y) {

+ 4 - 11
test/lib/meta/plugin_std/types.h

@@ -1,5 +1,5 @@
-#ifndef ENTT_LIB_META_PLUGIN_TYPES_STD_H
-#define ENTT_LIB_META_PLUGIN_TYPES_STD_H
+#ifndef ENTT_LIB_META_PLUGIN_STD_TYPES_H
+#define ENTT_LIB_META_PLUGIN_STD_TYPES_H
 
 #include <type_traits>
 #include <entt/core/hashed_string.hpp>
@@ -17,15 +17,8 @@ struct custom_type_hash;
         } \
     }
 
-struct position {
-    int x;
-    int y;
-};
-
-struct velocity {
-    double dx;
-    double dy;
-};
+struct position;
+struct velocity;
 
 struct userdata {
     entt::locator<entt::meta_ctx>::node_type ctx;

+ 1 - 1
test/lib/meta/shared/lib.cpp

@@ -2,7 +2,7 @@
 #include <entt/core/hashed_string.hpp>
 #include <entt/meta/factory.hpp>
 #include <entt/meta/meta.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 position create_position(int x, int y) {
     return position{x, y};

+ 1 - 1
test/lib/meta/shared/main.cpp

@@ -4,7 +4,7 @@
 #include <entt/meta/factory.hpp>
 #include <entt/meta/meta.hpp>
 #include <entt/meta/resolve.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void share(entt::locator<entt::meta_ctx>::node_type);
 ENTT_API void set_up();

+ 0 - 14
test/lib/meta/shared/types.h

@@ -1,14 +0,0 @@
-#ifndef ENTT_LIB_META_TYPES_H
-#define ENTT_LIB_META_TYPES_H
-
-struct position {
-    int x;
-    int y;
-};
-
-struct velocity {
-    double dx;
-    double dy;
-};
-
-#endif

+ 2 - 2
test/lib/registry/plugin/types.h → test/lib/registry/common/types.h

@@ -1,5 +1,5 @@
-#ifndef ENTT_LIB_REGISTRY_PLUGIN_TYPES_H
-#define ENTT_LIB_REGISTRY_PLUGIN_TYPES_H
+#ifndef ENTT_LIB_REGISTRY_COMMON_TYPES_H
+#define ENTT_LIB_REGISTRY_COMMON_TYPES_H
 
 struct position {
     int x;

+ 1 - 1
test/lib/registry/plugin/main.cpp

@@ -3,7 +3,7 @@
 #include <gtest/gtest.h>
 #include <cr.h>
 #include <entt/entity/registry.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 TEST(Lib, Registry) {
     entt::registry registry;

+ 1 - 1
test/lib/registry/plugin/plugin.cpp

@@ -1,6 +1,6 @@
 #include <cr.h>
 #include <entt/entity/registry.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
     switch(operation) {

+ 1 - 1
test/lib/registry/shared/lib.cpp

@@ -1,6 +1,6 @@
 #include <entt/core/attribute.h>
 #include <entt/entity/registry.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void update_position(entt::registry &registry) {
     registry.view<position, velocity>().each([](auto &pos, auto &vel) {

+ 1 - 1
test/lib/registry/shared/main.cpp

@@ -2,7 +2,7 @@
 #include <entt/core/attribute.h>
 #include <entt/entity/entity.hpp>
 #include <entt/entity/registry.hpp>
-#include "types.h"
+#include "../common/types.h"
 
 ENTT_API void update_position(entt::registry &);
 ENTT_API void emplace_velocity(entt::registry &);