forked from github/server
these config tests were leaking orders.
convert them to test_setup use, too.
This commit is contained in:
parent
68f60ceb77
commit
270c12b6d8
|
@ -19,10 +19,11 @@ extern "C" {
|
|||
struct locale;
|
||||
struct order;
|
||||
struct unit;
|
||||
struct tnode;
|
||||
|
||||
typedef struct syntaxtree {
|
||||
const struct locale *lang;
|
||||
void *root;
|
||||
struct tnode *root;
|
||||
struct syntaxtree *next;
|
||||
} syntaxtree;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ static void test_read_unitid(CuTest *tc) {
|
|||
struct locale *lang;
|
||||
struct terrain_type *t_plain;
|
||||
|
||||
test_cleanup();
|
||||
test_setup();
|
||||
lang = test_create_locale();
|
||||
/* note that the english order is FIGHT, not COMBAT, so this is a poor example */
|
||||
t_plain = test_create_terrain("plain", LAND_REGION);
|
||||
|
@ -66,7 +66,7 @@ static void test_getunit(CuTest *tc) {
|
|||
struct locale *lang;
|
||||
struct terrain_type *t_plain;
|
||||
|
||||
test_cleanup();
|
||||
test_setup();
|
||||
lang = test_create_locale();
|
||||
/* note that the english order is FIGHT, not COMBAT, so this is a poor example */
|
||||
t_plain = test_create_terrain("plain", LAND_REGION);
|
||||
|
@ -122,7 +122,7 @@ static void test_getunit(CuTest *tc) {
|
|||
static void test_get_set_param(CuTest * tc)
|
||||
{
|
||||
struct param *par = 0;
|
||||
test_cleanup();
|
||||
test_setup();
|
||||
CuAssertStrEquals(tc, 0, get_param(par, "foo"));
|
||||
set_param(&par, "foo", "bar");
|
||||
set_param(&par, "bar", "foo");
|
||||
|
@ -139,7 +139,7 @@ static void test_get_set_param(CuTest * tc)
|
|||
static void test_param_int(CuTest * tc)
|
||||
{
|
||||
struct param *par = 0;
|
||||
test_cleanup();
|
||||
test_setup();
|
||||
CuAssertIntEquals(tc, 13, get_param_int(par, "foo", 13));
|
||||
set_param(&par, "foo", "23");
|
||||
set_param(&par, "bar", "42");
|
||||
|
@ -152,7 +152,7 @@ static void test_param_int(CuTest * tc)
|
|||
static void test_param_flt(CuTest * tc)
|
||||
{
|
||||
struct param *par = 0;
|
||||
test_cleanup();
|
||||
test_setup();
|
||||
CuAssertDblEquals(tc, 13, get_param_flt(par, "foo", 13), 0.01);
|
||||
set_param(&par, "foo", "23.0");
|
||||
set_param(&par, "bar", "42.0");
|
||||
|
@ -176,16 +176,18 @@ static void test_default_order(CuTest *tc) {
|
|||
order *ord;
|
||||
struct locale * loc;
|
||||
|
||||
test_cleanup();
|
||||
test_setup();
|
||||
loc = test_create_locale();
|
||||
ord = default_order(loc);
|
||||
CuAssertPtrEquals(tc, 0, ord);
|
||||
free_order(ord);
|
||||
|
||||
config_set("orders.default", "work");
|
||||
ord = default_order(loc);
|
||||
CuAssertPtrNotNull(tc, ord);
|
||||
CuAssertIntEquals(tc, K_WORK, getkeyword(ord));
|
||||
CuAssertPtrEquals(tc, ord->data, default_order(loc)->data);
|
||||
free_order(ord);
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue