chore: started routing tests
This commit is contained in:
parent
386d83ec93
commit
de4e509c9c
3 changed files with 40 additions and 6 deletions
|
|
@ -1,5 +1,21 @@
|
|||
#include "test.h"
|
||||
|
||||
#include "lnm/http/router.h"
|
||||
|
||||
void test_routing_simple() {
|
||||
lnm_http_router *router;
|
||||
lnm_http_router_init(&router);
|
||||
|
||||
lnm_http_router_add(NULL, router, lnm_http_method_get, "/test");
|
||||
lnm_http_router_add(NULL, router, lnm_http_method_get, "/test/test2");
|
||||
|
||||
TEST_CHECK(lnm_http_router_route(NULL, router, lnm_http_method_get, "/test") == lnm_http_route_err_match);
|
||||
TEST_CHECK(lnm_http_router_route(NULL, router, lnm_http_method_get, "/test/te") == lnm_http_route_err_unknown_route);
|
||||
TEST_CHECK(lnm_http_router_route(NULL, router, lnm_http_method_head, "/test/test2") == lnm_http_route_err_unknown_method);
|
||||
TEST_CHECK(lnm_http_router_route(NULL, router, lnm_http_method_get, "/test/test2") == lnm_http_route_err_match);
|
||||
}
|
||||
|
||||
TEST_LIST = {
|
||||
{ "routing simple", test_routing_simple },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue