diff options
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/Components/CMakeLists.txt | 13 | ||||
-rw-r--r-- | tests/Components/Tick.cpp | 41 | ||||
-rw-r--r-- | tests/Components/creatable.cpp | 11 |
4 files changed, 66 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1fbd88f04..07d6ab4ab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,3 +5,4 @@ enable_testing() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(ChunkData) +add_subdirectory(Components) diff --git a/tests/Components/CMakeLists.txt b/tests/Components/CMakeLists.txt new file mode 100644 index 000000000..ef46969ad --- /dev/null +++ b/tests/Components/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required (VERSION 2.6) + +enable_testing() + +include_directories(${CMAKE_SOURCE_DIR}/src/) + +add_definitions(-DTEST_GLOBALS=1) + +add_executable(BurningComponent-creatable-exe creatable.cpp) +add_test(NAME creatable-test COMMAND BurningComponent-creatable-exe) + +add_executable(BurningComponent-tick-exe Tick.cpp) +add_test(NAME tick-test COMMAND BurningComponent-tick-exe) diff --git a/tests/Components/Tick.cpp b/tests/Components/Tick.cpp new file mode 100644 index 000000000..fac47489b --- /dev/null +++ b/tests/Components/Tick.cpp @@ -0,0 +1,41 @@ + +#include "Globals.h" +#include "Mobs/Components/BurningComponent.h" + +int main(int argc, char** argv) +{ + class cMockEntity + { + public: + double GetPosX () { return 0;} + double GetPosY () { return 0;} + double GetPosZ () { return 0;} + + int GetChunkX () { return 0; } + int GetChunkZ () { return 0; } + + virtual bool IsOnFire () const { return false; } + void StartBurning(int a_TicksLeftBurning) {} + } Entity; + class cMockChunk + { + class cMockWorld + { + public: + void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = NULL) {} + virtual int GetTimeOfDay(void) const { return 0;} + virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) { return true; } + } mutable m_World; + public: + bool IsLightValid(void) { return true; } + inline NIBBLETYPE GetSkyLight (int a_RelX, int a_RelY, int a_RelZ) const { return 0; } + cMockWorld * GetWorld(void) const { return &m_World; } + BLOCKTYPE GetBlock (int a_BlockX, int a_BlockY, int a_BlockZ) { return 0; } + } chunk; + cBurningComponent<cMockEntity, cMockChunk> component(Entity); + + component.Tick(1.0f/20.0f, chunk); + + + return 0; +} diff --git a/tests/Components/creatable.cpp b/tests/Components/creatable.cpp new file mode 100644 index 000000000..bf96720c6 --- /dev/null +++ b/tests/Components/creatable.cpp @@ -0,0 +1,11 @@ + +#include "Globals.h" +#include "Mobs/Components/BurningComponent.h" + +int main(int argc, char** argv) +{ + class cMockEntity {} Entity; + class cMockChunk {}; + cBurningComponent<cMockEntity, cMockChunk> component(Entity); + return 0; +} |