2017-12-29 06:13:28 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#include <platform.h>
|
|
|
|
#endif
|
|
|
|
|
2015-09-12 12:24:10 +02:00
|
|
|
#include "prefix.h"
|
|
|
|
|
2015-09-12 12:41:04 +02:00
|
|
|
#include <tests.h>
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2015-09-12 12:24:10 +02:00
|
|
|
#include <CuTest.h>
|
|
|
|
|
2015-09-12 12:41:04 +02:00
|
|
|
static void test_add_prefix(CuTest *tc) {
|
2016-08-29 15:21:28 +02:00
|
|
|
test_setup();
|
2018-10-14 11:48:21 +02:00
|
|
|
CuAssertPtrEquals(tc, NULL, race_prefixes);
|
2016-11-23 18:56:40 +01:00
|
|
|
CuAssertIntEquals(tc, 0, add_raceprefix("sea"));
|
2015-09-12 12:41:04 +02:00
|
|
|
CuAssertPtrNotNull(tc, race_prefixes);
|
|
|
|
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
2018-10-14 11:48:21 +02:00
|
|
|
CuAssertPtrEquals(tc, NULL, race_prefixes[1]);
|
2016-11-23 18:56:40 +01:00
|
|
|
CuAssertIntEquals(tc, 0, add_raceprefix("moon"));
|
2015-09-12 12:41:04 +02:00
|
|
|
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
|
|
|
CuAssertStrEquals(tc, "moon", race_prefixes[1]);
|
2018-10-14 11:48:21 +02:00
|
|
|
CuAssertPtrEquals(tc, NULL, race_prefixes[2]);
|
2015-09-12 12:41:04 +02:00
|
|
|
free_prefixes();
|
2018-10-14 11:48:21 +02:00
|
|
|
CuAssertPtrEquals(tc, NULL, race_prefixes);
|
2017-12-27 19:58:39 +01:00
|
|
|
test_teardown();
|
2015-09-12 12:41:04 +02:00
|
|
|
}
|
|
|
|
|
2015-09-12 12:24:10 +02:00
|
|
|
CuSuite *get_prefix_suite(void)
|
|
|
|
{
|
|
|
|
CuSuite *suite = CuSuiteNew();
|
2015-09-12 12:41:04 +02:00
|
|
|
SUITE_ADD_TEST(suite, test_add_prefix);
|
2015-09-12 12:24:10 +02:00
|
|
|
return suite;
|
2016-08-29 15:21:28 +02:00
|
|
|
}
|