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 }; static critbit_tree cb_equipments = { 0 };
#define EQNAMELEN 16 #define EQNAMELEN 16
typedef struct eq_entry { typedef struct eq_entry {
char key[EQNAMELEN]; char key[EQNAMELEN];
equipment *value; equipment *value;

View File

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