diff --git a/src/kernel/command.test.c b/src/kernel/command.test.c index 25e75fdc3..8fd7374bf 100644 --- a/src/kernel/command.test.c +++ b/src/kernel/command.test.c @@ -32,7 +32,7 @@ static void test_command(CuTest * tc) { struct locale * loc; unit *u; - test_cleanup(); + test_setup(); loc = test_create_locale(); st = stree_create(); CuAssertPtrNotNull(tc, st); diff --git a/src/kernel/db.test.c b/src/kernel/db.test.c index 5ec81b568..81f6f51c4 100644 --- a/src/kernel/db.test.c +++ b/src/kernel/db.test.c @@ -14,7 +14,7 @@ static void test_save_load_order(CuTest *tc) { int id; const char * s = "GIB enno 1 Hodor"; - db_open(); + test_setup(); odata_create(&od, strlen(s) + 1, s); CuAssertTrue(tc, od->_refcount >= 1); @@ -28,7 +28,7 @@ static void test_save_load_order(CuTest *tc) { CuAssertStrEquals(tc, s, od->_str); odata_release(od); - db_close(); + test_cleanup(); } CuSuite *get_db_suite(void) diff --git a/src/kernel/dbtrie.c b/src/kernel/dbtrie.c index 78ffaee61..3cca71af8 100644 --- a/src/kernel/dbtrie.c +++ b/src/kernel/dbtrie.c @@ -6,11 +6,12 @@ #include +#include #include #include static critbit_tree cb_orders = { 0 }; -static int auto_id = 0; +static int auto_id = -1; struct cb_entry { int id; @@ -50,15 +51,13 @@ static int free_data_cb(const void *match, const void *key, size_t keylen, { struct cb_entry * ent = (struct cb_entry *)match; order_data *od = ent->data; - if (od->_refcount > 1) { - log_error("refcount=%d for order %d, %s", od->_refcount, ent->id, od->_str); - } odata_release(od); return 0; } void db_open(void) { + assert(auto_id == -1); auto_id = 0; } @@ -66,4 +65,5 @@ void db_close(void) { cb_foreach(&cb_orders, NULL, 0, free_data_cb, NULL); cb_clear(&cb_orders); + auto_id = -1; } diff --git a/src/kernel/plane.test.c b/src/kernel/plane.test.c index a479a34be..16ec065f7 100644 --- a/src/kernel/plane.test.c +++ b/src/kernel/plane.test.c @@ -9,7 +9,7 @@ static void test_plane(CuTest *tc) { struct region *r; plane *pl; - test_cleanup(); + test_setup(); r = test_create_region(0, 0, 0); CuAssertPtrEquals(tc, 0, findplane(0, 0)); CuAssertPtrEquals(tc, 0, getplane(r)); @@ -38,13 +38,14 @@ static void test_plane(CuTest *tc) { CuAssertIntEquals(tc, 60, plane_center_y(pl)); CuAssertIntEquals(tc, 5, plane_width(pl)); CuAssertIntEquals(tc, 41, plane_height(pl)); + test_cleanup(); } static void test_origin(CuTest *tc) { struct faction *f; int x, y; - test_cleanup(); + test_setup(); f = test_create_faction(0); x = 0; y = 0; diff --git a/src/main.c b/src/main.c index 0c171f219..8b613789d 100644 --- a/src/main.c +++ b/src/main.c @@ -20,6 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include #include #include #include diff --git a/src/test_eressea.c b/src/test_eressea.c index 0bd8a455f..c5ba24abb 100644 --- a/src/test_eressea.c +++ b/src/test_eressea.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include