forked from github/server
add a test that should have crashed before my fix.
This commit is contained in:
parent
30b3cff657
commit
b2e8c75c02
|
@ -13,6 +13,7 @@
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
#include <CuTest.h>
|
#include <CuTest.h>
|
||||||
#include <tests.h>
|
#include <tests.h>
|
||||||
|
#include <quicklist.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -46,8 +47,10 @@ static void test_remove_empty_factions_alliance(CuTest *tc) {
|
||||||
al = makealliance(0, "Hodor");
|
al = makealliance(0, "Hodor");
|
||||||
setalliance(f, al);
|
setalliance(f, al);
|
||||||
CuAssertPtrEquals(tc, f, alliance_get_leader(al));
|
CuAssertPtrEquals(tc, f, alliance_get_leader(al));
|
||||||
|
CuAssertIntEquals(tc, 1, ql_length(al->members));
|
||||||
remove_empty_factions();
|
remove_empty_factions();
|
||||||
CuAssertPtrEquals(tc, 0, al->_leader);
|
CuAssertPtrEquals(tc, 0, al->_leader);
|
||||||
|
CuAssertIntEquals(tc, 0, ql_length(al->members));
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +64,9 @@ static void test_remove_empty_factions(CuTest *tc) {
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
fno = f->no;
|
fno = f->no;
|
||||||
remove_empty_factions();
|
remove_empty_factions();
|
||||||
|
CuAssertIntEquals(tc, false, f->_alive);
|
||||||
|
CuAssertPtrEquals(tc, fm, factions);
|
||||||
|
CuAssertPtrEquals(tc, NULL, fm->next);
|
||||||
CuAssertPtrEquals(tc, 0, findfaction(fno));
|
CuAssertPtrEquals(tc, 0, findfaction(fno));
|
||||||
CuAssertPtrEquals(tc, fm, get_monsters());
|
CuAssertPtrEquals(tc, fm, get_monsters());
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
Loading…
Reference in New Issue