mirror of
https://github.com/tbamud/tbamud.git
synced 2025-09-22 05:50:48 +02:00
Renamed test files to match pattern from src
Also, started setup for testing do_remove and introduced a bit of shorthand macros.
This commit is contained in:
parent
eb8e200a31
commit
217eac8cb3
6 changed files with 38 additions and 11 deletions
15
src/test/test.act.item.c
Normal file
15
src/test/test.act.item.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "test.act.item.h"
|
||||
|
||||
UNIT_TEST(test_do_remove) {
|
||||
|
||||
|
||||
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MunitTest act_item_c_tests[] = {
|
||||
STD_TEST("/do_remove", test_do_remove),
|
||||
|
||||
// end of array marker
|
||||
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
|
||||
};
|
10
src/test/test.act.item.h
Normal file
10
src/test/test.act.item.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include "testrunner.h"
|
||||
|
||||
#ifndef TEST_ACT_ITEM_H
|
||||
#define TEST_ACT_ITEM_H
|
||||
|
||||
extern MunitTest act_item_c_tests[];
|
||||
|
||||
UNIT_TEST(test_do_remove);
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#include "test_handler.h"
|
||||
#include "test.handler.h"
|
||||
|
||||
static void run_single_get_number_test(const char* input_param, const char *name_result, int number_result);
|
||||
|
||||
|
@ -28,13 +28,6 @@ static void run_single_get_number_test(const char* input_param, const char *name
|
|||
/* Creating a test suite is pretty simple. First, you'll need an
|
||||
* array of tests: */
|
||||
MunitTest handler_c_tests[] = {
|
||||
{
|
||||
(char*) "/get_number",
|
||||
test_get_number,
|
||||
NULL, // setup callback
|
||||
NULL, // cleanup callback
|
||||
MUNIT_TEST_OPTION_NONE,
|
||||
NULL
|
||||
},
|
||||
STD_TEST("/get_number", test_get_number),
|
||||
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
|
||||
};
|
|
@ -1,8 +1,10 @@
|
|||
#include "testrunner.h"
|
||||
#include "test_handler.h"
|
||||
#include "test.handler.h"
|
||||
#include "test.act.item.h"
|
||||
|
||||
static MunitSuite suites[] = {
|
||||
{ "/handler.c", handler_c_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE },
|
||||
{ "/act.item.c", act_item_c_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE },
|
||||
{ NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE }
|
||||
};
|
||||
|
||||
|
|
|
@ -19,8 +19,15 @@
|
|||
#include "../mud_event.h"
|
||||
#include "../munit/munit.h"
|
||||
|
||||
|
||||
/**
|
||||
* Utility macro for defining tests.
|
||||
*/
|
||||
#define UNIT_TEST(test_name) MunitResult (test_name)(const MunitParameter params[], void* data)
|
||||
|
||||
/*
|
||||
* A "standard test" needs no setup or teardown and doesn't take any parameters.
|
||||
* This is a utility macro for the test suite listing.
|
||||
*/
|
||||
#define STD_TEST(test_name, test_fun) { (char *)(test_name), (test_fun), NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue