| 2990 | } |
| 2991 | |
| 2992 | void |
| 2993 | test_parse_url (void) |
| 2994 | { |
| 2995 | struct http_parser_url u; |
| 2996 | const struct url_test *test; |
| 2997 | unsigned int i; |
| 2998 | int rv; |
| 2999 | |
| 3000 | for (i = 0; i < (sizeof(url_tests) / sizeof(url_tests[0])); i++) { |
| 3001 | test = &url_tests[i]; |
| 3002 | memset(&u, 0, sizeof(u)); |
| 3003 | |
| 3004 | rv = http_parser_parse_url(test->url, |
| 3005 | strlen(test->url), |
| 3006 | test->is_connect, |
| 3007 | &u); |
| 3008 | |
| 3009 | if (test->rv == 0) { |
| 3010 | if (rv != 0) { |
| 3011 | printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, " |
| 3012 | "unexpected rv %d ***\n\n", test->url, test->name, rv); |
| 3013 | abort(); |
| 3014 | } |
| 3015 | |
| 3016 | if (memcmp(&u, &test->u, sizeof(u)) != 0) { |
| 3017 | printf("\n*** http_parser_parse_url(\"%s\") \"%s\" failed ***\n", |
| 3018 | test->url, test->name); |
| 3019 | |
| 3020 | printf("target http_parser_url:\n"); |
| 3021 | dump_url(test->url, &test->u); |
| 3022 | printf("result http_parser_url:\n"); |
| 3023 | dump_url(test->url, &u); |
| 3024 | |
| 3025 | abort(); |
| 3026 | } |
| 3027 | } else { |
| 3028 | /* test->rv != 0 */ |
| 3029 | if (rv == 0) { |
| 3030 | printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, " |
| 3031 | "unexpected rv %d ***\n\n", test->url, test->name, rv); |
| 3032 | abort(); |
| 3033 | } |
| 3034 | } |
| 3035 | } |
| 3036 | } |
| 3037 | |
| 3038 | void |
| 3039 | test_method_str (void) |
no test coverage detected