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

Function testQueryListPairHelper

3rd/uriparser/test/test.cpp:1756–1776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1754
1755namespace {
1756 void testQueryListPairHelper(const char * pair, const char * unescapedKey,
1757 const char * unescapedValue, const char * fixed = NULL) {
1758 int res;
1759 UriQueryListA * queryList;
1760 int itemCount;
1761
1762 res = uriDissectQueryMallocA(&queryList, &itemCount, pair, pair + strlen(pair));
1763 ASSERT_TRUE(res == URI_SUCCESS);
1764 ASSERT_TRUE(queryList != NULL);
1765 ASSERT_TRUE(itemCount == 1);
1766 ASSERT_TRUE(!strcmp(queryList->key, unescapedKey));
1767 ASSERT_TRUE(!strcmp(queryList->value, unescapedValue));
1768
1769 char * recomposed;
1770 res = uriComposeQueryMallocA(&recomposed, queryList);
1771 ASSERT_TRUE(res == URI_SUCCESS);
1772 ASSERT_TRUE(recomposed != NULL);
1773 ASSERT_TRUE(!strcmp(recomposed, (fixed != NULL) ? fixed : pair));
1774 free(recomposed);
1775 uriFreeQueryListA(queryList);
1776 }
1777} // namespace
1778
1779TEST(UriSuite, TestQueryListPair) {

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected