You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
3 years ago
|
#ifndef UTIL_TEST
|
||
|
#define UTIL_TEST
|
||
|
|
||
|
|
||
|
#include "munit/munit.h"
|
||
|
|
||
|
#include "../src/util.h"
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
MunitResult testStrPos(const MunitParameter params[],
|
||
|
void* user_data_or_fixture){
|
||
|
munit_assert_int( strpos( "thisisatest", "test" ), ==, 7 );
|
||
|
munit_assert_int( strpos( "testthisisatest", "test" ), ==, 0 );
|
||
|
munit_assert_int( strpos( "blar", "test" ), ==, -1 );
|
||
|
return MUNIT_OK;
|
||
|
}
|
||
|
|
||
|
|
||
|
static MunitTest util_tests[] = {
|
||
|
{
|
||
|
"/util/versions", /* name */
|
||
|
testStrPos, /* test */
|
||
|
NULL, /* setup */
|
||
|
NULL, /* tear_down */
|
||
|
MUNIT_TEST_OPTION_NONE, /* options */
|
||
|
NULL /* parameters */
|
||
|
},
|
||
|
/* Mark the end of the array with an entry where the test
|
||
|
* function is NULL */
|
||
|
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
|
||
|
};
|
||
|
|
||
|
MunitSuite util_test_suite = {
|
||
|
"/request", /* name */
|
||
|
util_tests, /* tests */
|
||
|
NULL, /* suites */
|
||
|
1, /* iterations */
|
||
|
MUNIT_SUITE_OPTION_NONE /* options */
|
||
|
};
|
||
|
|
||
|
#ifndef MAINTEST
|
||
|
#define MAINTEST
|
||
|
|
||
|
int main (int argc, char* argv[]) {
|
||
|
return munit_suite_main(&util_test_suite, NULL, argc, argv);
|
||
|
}
|
||
|
|
||
|
#endif /* ifndef MAINTEST */
|
||
|
#endif /* ifndef REQUEST_TEST */
|