suppress those null-reference bugs in another way, maybe?

This commit is contained in:
Enno Rehling 2018-05-19 21:01:10 +02:00
parent 9a481d7e15
commit b3b19e7c83
3 changed files with 7 additions and 5 deletions

View File

@ -93,7 +93,7 @@ static void test_steal_okay(CuTest * tc) {
rc->flags = 0;
setup_steal(&env, ter, rc);
CuAssertPtrEquals(tc, NULL, msg = steal_message(env.u, 0));
msg_release(msg);
assert(!msg);
test_teardown();
}

View File

@ -147,7 +147,7 @@ static void test_give_men(CuTest * tc) {
env.f2 = env.f1 = test_create_faction(NULL);
setup_give(&env);
CuAssertPtrEquals(tc, NULL, msg = give_men(1, env.src, env.dst, NULL));
msg_release(msg);
assert(!msg);
CuAssertIntEquals(tc, 2, env.dst->number);
CuAssertIntEquals(tc, 0, env.src->number);
test_teardown();
@ -233,7 +233,7 @@ static void test_give_men_too_many(CuTest * tc) {
env.f2 = env.f1 = test_create_faction(NULL);
setup_give(&env);
CuAssertPtrEquals(tc, NULL, msg = give_men(2, env.src, env.dst, NULL));
msg_release(msg);
assert(!msg);
CuAssertIntEquals(tc, 2, env.dst->number);
CuAssertIntEquals(tc, 0, env.src->number);
test_teardown();

View File

@ -7,6 +7,8 @@
#include <CuTest.h>
#include <tests.h>
#include <assert.h>
void test_missing_message(CuTest *tc) {
message *msg;
@ -87,9 +89,9 @@ static void test_noerror(CuTest *tc) {
CuAssertIntEquals(tc, K_MOVE | CMD_QUIET | CMD_PERSIST, u->thisorder->command);
CuAssertTrue(tc, !is_persistent(u->thisorder));
CuAssertPtrEquals(tc, NULL, msg = msg_error(u, u->thisorder, 100));
msg_release(msg);
assert(!msg);
CuAssertPtrEquals(tc, NULL, msg = msg_feedback(u, u->thisorder, "error_unit_not_found", NULL));
msg_release(msg);
assert(!msg);
test_teardown();
}