forked from github/server
do not call a function test_* that is not a test (I got confused and broke it when trying to make a change)
This commit is contained in:
parent
c16beeef08
commit
65902ca97f
|
@ -313,22 +313,17 @@ static void setup_spell_fixture(spell_fixture * spf) {
|
||||||
spf->sp = test_create_spell();
|
spf->sp = test_create_spell();
|
||||||
spellbook_add(spf->spb, spf->sp, 1);
|
spellbook_add(spf->spb, spf->sp, 1);
|
||||||
spf->sbe = spellbook_get(spf->spb, spf->sp);
|
spf->sbe = spellbook_get(spf->spb, spf->sp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_spell_syntax(CuTest *tc, char *msg, spell_fixture *spell, char *syntax) {
|
static void check_spell_syntax(CuTest *tc, char *msg, spell_fixture *spell, char *syntax) {
|
||||||
stream strm;
|
stream strm;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *linestart, *newline;
|
char *linestart, *newline;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
mstream_init(&strm);
|
mstream_init(&strm);
|
||||||
|
|
||||||
|
|
||||||
nr_spell_syntax(&strm, spell->sbe, spell->lang);
|
nr_spell_syntax(&strm, spell->sbe, spell->lang);
|
||||||
|
|
||||||
strm.api->rewind(strm.handle);
|
strm.api->rewind(strm.handle);
|
||||||
|
|
||||||
len = strm.api->read(strm.handle, buf, sizeof(buf));
|
len = strm.api->read(strm.handle, buf, sizeof(buf));
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
@ -360,41 +355,41 @@ static void test_write_spell_syntax(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
setup_spell_fixture(&spell);
|
setup_spell_fixture(&spell);
|
||||||
|
|
||||||
test_spell_syntax(tc, "vanilla", &spell, " ZAUBERE \"Testzauber\"");
|
check_spell_syntax(tc, "vanilla", &spell, " ZAUBERE \"Testzauber\"");
|
||||||
|
|
||||||
spell.sp->sptyp |= FARCASTING;
|
spell.sp->sptyp |= FARCASTING;
|
||||||
test_spell_syntax(tc, "far", &spell, " ZAUBERE [REGION x y] \"Testzauber\"");
|
check_spell_syntax(tc, "far", &spell, " ZAUBERE [REGION x y] \"Testzauber\"");
|
||||||
|
|
||||||
spell.sp->sptyp |= SPELLLEVEL;
|
spell.sp->sptyp |= SPELLLEVEL;
|
||||||
test_spell_syntax(tc, "farlevel", &spell, " ZAUBERE [REGION x y] [STUFE n] \"Testzauber\"");
|
check_spell_syntax(tc, "farlevel", &spell, " ZAUBERE [REGION x y] [STUFE n] \"Testzauber\"");
|
||||||
spell.sp->sptyp = 0;
|
spell.sp->sptyp = 0;
|
||||||
|
|
||||||
set_parameter(spell, "kc");
|
set_parameter(spell, "kc");
|
||||||
test_spell_syntax(tc, "kc", &spell, " ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> | SCHIFF <snr> | BURG <bnr> )");
|
check_spell_syntax(tc, "kc", &spell, " ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> | SCHIFF <snr> | BURG <bnr> )");
|
||||||
|
|
||||||
spell.sp->sptyp |= BUILDINGSPELL;
|
spell.sp->sptyp |= BUILDINGSPELL;
|
||||||
test_spell_syntax(tc, "kc typed", &spell, " ZAUBERE \"Testzauber\" BURG <bnr>");
|
check_spell_syntax(tc, "kc typed", &spell, " ZAUBERE \"Testzauber\" BURG <bnr>");
|
||||||
spell.sp->sptyp = 0;
|
spell.sp->sptyp = 0;
|
||||||
|
|
||||||
set_parameter(spell, "b");
|
set_parameter(spell, "b");
|
||||||
test_spell_syntax(tc, "b", &spell, " ZAUBERE \"Testzauber\" <bnr>");
|
check_spell_syntax(tc, "b", &spell, " ZAUBERE \"Testzauber\" <bnr>");
|
||||||
|
|
||||||
set_parameter(spell, "s");
|
set_parameter(spell, "s");
|
||||||
test_spell_syntax(tc, "s", &spell, " ZAUBERE \"Testzauber\" <snr>");
|
check_spell_syntax(tc, "s", &spell, " ZAUBERE \"Testzauber\" <snr>");
|
||||||
|
|
||||||
set_parameter(spell, "s+");
|
set_parameter(spell, "s+");
|
||||||
test_spell_syntax(tc, "s+", &spell, " ZAUBERE \"Testzauber\" <snr> [<snr> ...]");
|
check_spell_syntax(tc, "s+", &spell, " ZAUBERE \"Testzauber\" <snr> [<snr> ...]");
|
||||||
|
|
||||||
set_parameter(spell, "u");
|
set_parameter(spell, "u");
|
||||||
test_spell_syntax(tc, "u", &spell, " ZAUBERE \"Testzauber\" <enr>");
|
check_spell_syntax(tc, "u", &spell, " ZAUBERE \"Testzauber\" <enr>");
|
||||||
|
|
||||||
set_parameter(spell, "r");
|
set_parameter(spell, "r");
|
||||||
test_spell_syntax(tc, "r", &spell, " ZAUBERE \"Testzauber\" <x> <y>");
|
check_spell_syntax(tc, "r", &spell, " ZAUBERE \"Testzauber\" <x> <y>");
|
||||||
|
|
||||||
set_parameter(spell, "bc");
|
set_parameter(spell, "bc");
|
||||||
free(spell.sp->syntax);
|
free(spell.sp->syntax);
|
||||||
spell.sp->syntax = _strdup("hodor");
|
spell.sp->syntax = _strdup("hodor");
|
||||||
test_spell_syntax(tc, "bc hodor", &spell, " ZAUBERE \"Testzauber\" <bnr> <Hodor>");
|
check_spell_syntax(tc, "bc hodor", &spell, " ZAUBERE \"Testzauber\" <bnr> <Hodor>");
|
||||||
free(spell.sp->syntax);
|
free(spell.sp->syntax);
|
||||||
spell.sp->syntax = 0;
|
spell.sp->syntax = 0;
|
||||||
|
|
||||||
|
@ -402,13 +397,13 @@ static void test_write_spell_syntax(CuTest *tc) {
|
||||||
set_parameter(spell, "c?");
|
set_parameter(spell, "c?");
|
||||||
free(spell.sp->syntax);
|
free(spell.sp->syntax);
|
||||||
spell.sp->syntax = _strdup("hodor");
|
spell.sp->syntax = _strdup("hodor");
|
||||||
test_spell_syntax(tc, "c?", &spell, " ZAUBERE \"Testzauber\" [<Hodor>]");
|
check_spell_syntax(tc, "c?", &spell, " ZAUBERE \"Testzauber\" [<Hodor>]");
|
||||||
free(spell.sp->syntax);
|
free(spell.sp->syntax);
|
||||||
spell.sp->syntax = 0;
|
spell.sp->syntax = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_parameter(spell, "kc+");
|
set_parameter(spell, "kc+");
|
||||||
test_spell_syntax(tc, "kc+", &spell,
|
check_spell_syntax(tc, "kc+", &spell,
|
||||||
" ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> [<enr> ...] | SCHIFF <snr>\n [<snr> ...] | BURG <bnr> [<bnr> ...] )");
|
" ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> [<enr> ...] | SCHIFF <snr>\n [<snr> ...] | BURG <bnr> [<bnr> ...] )");
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
Loading…
Reference in New Issue