MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / testDistinctionHelper

Function testDistinctionHelper

3rd/uriparser/test/test.cpp:69–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67
68namespace {
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

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected