]> git.localhorst.tv Git - blobs.git/commitdiff
coarse test
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 18 Dec 2017 13:10:08 +0000 (14:10 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 18 Dec 2017 13:10:08 +0000 (14:10 +0100)
src/blobs.cpp
tst/app/MasterTest.cpp [new file with mode: 0644]
tst/app/MasterTest.hpp [new file with mode: 0644]

index 9562f84cde5740a5f3c820293c2f01a11eade3f2..5163a3ea8f3cf91d6bf1a2bbdd4d8e869e3bc19e 100644 (file)
@@ -3,15 +3,7 @@
 #include "app/init.hpp"
 #include "app/MasterState.hpp"
 #include "creature/Creature.hpp"
-#include "math/const.hpp"
-#include "world/Planet.hpp"
-#include "world/Set.hpp"
 #include "world/Simulation.hpp"
-#include "world/Sun.hpp"
-#include "world/TileType.hpp"
-
-#include <cstdint>
-#include <iostream>
 
 using namespace blobs;
 
diff --git a/tst/app/MasterTest.cpp b/tst/app/MasterTest.cpp
new file mode 100644 (file)
index 0000000..c9ab2d9
--- /dev/null
@@ -0,0 +1,52 @@
+#include "MasterTest.hpp"
+
+#include "app/Application.hpp"
+#include "app/Assets.hpp"
+#include "app/init.hpp"
+#include "app/MasterState.hpp"
+#include "creature/Creature.hpp"
+#include "world/Simulation.hpp"
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(blobs::app::test::MasterTest, "headed");
+
+
+namespace blobs {
+namespace app {
+namespace test {
+
+void MasterTest::setUp() {
+}
+
+void MasterTest::tearDown() {
+}
+
+
+void MasterTest::testOneSecond() {
+       Init init(false, 1);
+       Assets assets;
+
+       world::Simulation sim(assets);
+       assets.LoadUniverse("universe", sim);
+
+       auto blob = new creature::Creature(sim);
+       blob->Name(assets.name.Sequential());
+       Spawn(*blob, sim.PlanetByName("Planet"));
+       // decrease chances of ur-blob dying without splitting
+       blob->GetProperties().Fertility() = 1.0;
+       blob->BuildVAO();
+
+       app::MasterState state(assets, sim);
+       state.Show(*blob);
+
+       app::Application app(init.window, init.viewport);
+       app.PushState(&state);
+
+       // just run it for one second and check if anything segfaults or throws
+       for (int t = 0; t < 1000; t += 17) {
+               app.Loop(17);
+       }
+}
+
+}
+}
+}
diff --git a/tst/app/MasterTest.hpp b/tst/app/MasterTest.hpp
new file mode 100644 (file)
index 0000000..14df37d
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef BLOBS_TEST_APP_MASTERTEST_HPP_
+#define BLOBS_TEST_APP_MASTERTEST_HPP_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+
+namespace blobs {
+namespace app {
+namespace test {
+
+class MasterTest
+: public CppUnit::TestFixture {
+
+CPPUNIT_TEST_SUITE(MasterTest);
+
+CPPUNIT_TEST(testOneSecond);
+
+CPPUNIT_TEST_SUITE_END();
+
+public:
+       void setUp();
+       void tearDown();
+
+       void testOneSecond();
+
+};
+
+}
+}
+}
+
+#endif