fail get_equipment test when name is exactly 16 bytes long.

This commit is contained in:
Enno Rehling 2017-09-18 17:32:39 +02:00
parent 5605510351
commit 4cab65d233
2 changed files with 5 additions and 4 deletions

View File

@ -204,6 +204,7 @@ void free_ls(void *arg) {
static critbit_tree cb_equipments = { 0 };
#define EQNAMELEN 16
typedef struct eq_entry {
char key[EQNAMELEN];
equipment *value;

View File

@ -51,12 +51,12 @@ static void test_get_equipment(CuTest * tc)
equipment * eq;
test_setup();
eq = create_equipment("catapultammo");
eq = create_equipment("catapultammo1234");
CuAssertPtrNotNull(tc, eq);
CuAssertStrEquals(tc, "catapultammo", eq->name);
eq = get_equipment("catapultammo");
CuAssertStrEquals(tc, "catapultammo1234", eq->name);
eq = get_equipment("catapultammo1234");
CuAssertPtrNotNull(tc, eq);
CuAssertStrEquals(tc, "catapultammo", eq->name);
CuAssertStrEquals(tc, "catapultammo1234", eq->name);
eq = get_equipment("catapult");
CuAssertPtrEquals(tc, NULL, eq);
eq = create_equipment("catapult");