From 2797cbced4b524543b4732041cee03a1b80d0047 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Mon, 18 Dec 2017 14:10:08 +0100 Subject: [PATCH] coarse test --- src/blobs.cpp | 8 ------- tst/app/MasterTest.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++ tst/app/MasterTest.hpp | 32 ++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 8 deletions(-) create mode 100644 tst/app/MasterTest.cpp create mode 100644 tst/app/MasterTest.hpp diff --git a/src/blobs.cpp b/src/blobs.cpp index 9562f84..5163a3e 100644 --- a/src/blobs.cpp +++ b/src/blobs.cpp @@ -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 -#include using namespace blobs; diff --git a/tst/app/MasterTest.cpp b/tst/app/MasterTest.cpp new file mode 100644 index 0000000..c9ab2d9 --- /dev/null +++ b/tst/app/MasterTest.cpp @@ -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 index 0000000..14df37d --- /dev/null +++ b/tst/app/MasterTest.hpp @@ -0,0 +1,32 @@ +#ifndef BLOBS_TEST_APP_MASTERTEST_HPP_ +#define BLOBS_TEST_APP_MASTERTEST_HPP_ + +#include + + +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 -- 2.39.2