| 1754 | |
| 1755 | namespace { |
| 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 | |
| 1779 | TEST(UriSuite, TestQueryListPair) { |