summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-09-09 16:56:36 +0200
committerTycho <work.tycho+git@gmail.com>2014-09-09 17:03:45 +0200
commite3afeae72795ce2dd80ec2740f1e622e073f1020 (patch)
tree2b25da8ec44604f8b2a48a226ebcdabf1879d597
parentAdded a couple of basic tests (diff)
downloadcuberite-e3afeae72795ce2dd80ec2740f1e622e073f1020.tar
cuberite-e3afeae72795ce2dd80ec2740f1e622e073f1020.tar.gz
cuberite-e3afeae72795ce2dd80ec2740f1e622e073f1020.tar.bz2
cuberite-e3afeae72795ce2dd80ec2740f1e622e073f1020.tar.lz
cuberite-e3afeae72795ce2dd80ec2740f1e622e073f1020.tar.xz
cuberite-e3afeae72795ce2dd80ec2740f1e622e073f1020.tar.zst
cuberite-e3afeae72795ce2dd80ec2740f1e622e073f1020.zip
-rw-r--r--tests/Components/Tick.cpp57
-rw-r--r--tests/Components/creatable.cpp5
2 files changed, 32 insertions, 30 deletions
diff --git a/tests/Components/Tick.cpp b/tests/Components/Tick.cpp
index fac47489b..8d1fe8628 100644
--- a/tests/Components/Tick.cpp
+++ b/tests/Components/Tick.cpp
@@ -1,37 +1,38 @@
#include "Globals.h"
#include "Mobs/Components/BurningComponent.h"
+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;
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);
diff --git a/tests/Components/creatable.cpp b/tests/Components/creatable.cpp
index bf96720c6..9041fd427 100644
--- a/tests/Components/creatable.cpp
+++ b/tests/Components/creatable.cpp
@@ -2,10 +2,11 @@
#include "Globals.h"
#include "Mobs/Components/BurningComponent.h"
+class cMockEntity {} Entity;
+class cMockChunk {};
int main(int argc, char** argv)
{
- class cMockEntity {} Entity;
- class cMockChunk {};
+
cBurningComponent<cMockEntity, cMockChunk> component(Entity);
return 0;
}