| 67 | |
| 68 | namespace { |
| 69 | bool testDistinctionHelper(const char * uriText, bool expectedHostSet, |
| 70 | bool expectedAbsPath, bool expectedEmptyTailSegment) { |
| 71 | UriParserStateA state; |
| 72 | UriUriA uri; |
| 73 | state.uri = &uri; |
| 74 | |
| 75 | int res = uriParseUriA(&state, uriText); |
| 76 | if (res != URI_SUCCESS) { |
| 77 | uriFreeUriMembersA(&uri); |
| 78 | return false; |
| 79 | } |
| 80 | |
| 81 | if (expectedHostSet != (uri.hostText.first != NULL)) { |
| 82 | uriFreeUriMembersA(&uri); |
| 83 | return false; |
| 84 | } |
| 85 | |
| 86 | if (expectedAbsPath != (uri.absolutePath == URI_TRUE)) { |
| 87 | uriFreeUriMembersA(&uri); |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | if (expectedEmptyTailSegment != ((uri.pathTail != NULL) |
| 92 | && (uri.pathTail->text.first == uri.pathTail->text.afterLast))) { |
| 93 | uriFreeUriMembersA(&uri); |
| 94 | return false; |
| 95 | } |
| 96 | |
| 97 | uriFreeUriMembersA(&uri); |
| 98 | return true; |
| 99 | } |
| 100 | } // namespace |
| 101 | |
| 102 | |