mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-18 09:31:45 +01:00
Add munit for unit testing.
Main method extracted to separate file to make it easier to test the _rest_ of the code. munit is added as a submodule by running `cd src; git submodule add https://github.com/nemequ/munit.git` . Unit testing has so far only been tested on ubuntu.
This commit is contained in:
23
src/test/testrunner.c
Normal file
23
src/test/testrunner.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "testrunner.h"
|
||||
#include "test_handler.h"
|
||||
|
||||
static MunitSuite suites[] = {
|
||||
{ "/handler.c", handler_c_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE },
|
||||
{ NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE }
|
||||
};
|
||||
|
||||
static const MunitSuite test_suite = {
|
||||
(char*) "",
|
||||
/* The first parameter is the array of test suites. */
|
||||
NULL,
|
||||
/* The second an array of suites to trigger from this one */
|
||||
suites,
|
||||
MUNIT_SUITE_OPTION_NONE
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[MUNIT_ARRAY_PARAM(argc + 1)]) {
|
||||
/* Finally, we'll actually run our test suite! That second argument
|
||||
* is the user_data parameter which will be passed either to the
|
||||
* test or (if provided) the fixture setup function. */
|
||||
return munit_suite_main(&test_suite, (void*) "µnit", argc, argv);
|
||||
}
|
||||
Reference in New Issue
Block a user