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

Function normalizeAndCompare

3rd/uriparser/test/FourSuite.cpp:565–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563namespace {
564
565bool normalizeAndCompare(const char * uriText,
566 const char * expectedNormalized) {
567 UriParserStateA stateA;
568 int res;
569
570 UriUriA testUri;
571 stateA.uri = &testUri;
572 res = uriParseUriA(&stateA, uriText);
573 if (res != 0) {
574 uriFreeUriMembersA(&testUri);
575 return false;
576 }
577
578 // Expected result
579 UriUriA expectedUri;
580 stateA.uri = &expectedUri;
581 res = uriParseUriA(&stateA, expectedNormalized);
582 if (res != 0) {
583 uriFreeUriMembersA(&testUri);
584 uriFreeUriMembersA(&expectedUri);
585 return false;
586 }
587
588 res = uriNormalizeSyntaxA(&testUri);
589 if (res != 0) {
590 uriFreeUriMembersA(&testUri);
591 uriFreeUriMembersA(&expectedUri);
592 return false;
593 }
594
595 const bool equalAfter = (URI_TRUE == uriEqualsUriA(&testUri, &expectedUri));
596 uriFreeUriMembersA(&testUri);
597 uriFreeUriMembersA(&expectedUri);
598 return equalAfter;
599}
600
601} // namespace
602

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected