Working on unit tests for class world

This commit is contained in:
2021-08-03 11:25:12 -04:00
parent 91d7e1c15d
commit 202c5a24ba
13 changed files with 240 additions and 103 deletions

View File

@@ -84,9 +84,7 @@ public:
// Constructor.
//
// The constructor also calls 'lua_open' to create a new
// lua interpreter for this world model. The lua interpreter
// is stored in world::lua_state_. A significant amount of
// initial setup is done by this constructor.
// lua interpreter for this world model.
//
World(util::WorldType wt);
@@ -136,7 +134,7 @@ public:
// Delete the specified tangible.
//
void tangible_delete(lua_State *L, int64_t id);
// Create a login actor.
//
// Creates a tangible of class 'login' and returns its ID.
@@ -160,6 +158,14 @@ public:
//
void invoke(const Invocation &inv);
// Update the source database from disk.
//
void update_source() { source_db_.update(); source_db_.rebuild(); }
// Run all unit tests.
//
void run_unittests() { source_db_.run_unittests(); }
// fetch_global_pointer
//
// Given a lua state, fetch the world model associated with
@@ -190,8 +196,26 @@ public:
// Note that difference_transmit applies the differences to the server
// synchronous model, so this is only used by the client synchronous model.
//
void apply_differences(int64_t actor, StreamBuffer *sb);
void apply_differences(StreamBuffer *sb);
public:
////////////////////////////////////////////////////////////////////////////
//
// TESTING SUPPORT
//
// The following functions are not designed to be useful for production
// code, they're designed to be helpful for unit testing.
//
////////////////////////////////////////////////////////////////////////////
// Add a 'walkto' animation to the specified tangible.
//
void tangible_walkto(int64_t id, int64_t animid, float x, float y);
// Get a list of all existing tangibles as a comma-separated string.
//
std::string tangible_ids_debug_string() const;
private:
// Run any threads which according to the scheduler queue are ready.
//