+ else if ((value = cupsGetOption("auth-info", num_options, options)) == NULL ||
+ strcmp(value, "user,pass\\,word\\\\"))
+ {
+ printf("FAIL (auth-info=\"%s\", expected \"user,pass\\,word\\\\\")\n", value);
+ status ++;
+ }
+ else
+ puts("PASS");
+
+ fputs("cupsEncodeOptions2: ", stdout);
+ request = ippNew();
+ ippSetOperation(request, IPP_OP_PRINT_JOB);
+
+ cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
+ for (count = 0, attr = ippFirstAttribute(request); attr; attr = ippNextAttribute(request), count ++);
+ if (count != 6)
+ {
+ printf("FAIL (%d attributes, expected 6)\n", count);
+ status ++;
+ }
+ else if ((attr = ippFindAttribute(request, "foo", IPP_TAG_ZERO)) == NULL)
+ {
+ puts("FAIL (Unable to find attribute \"foo\")");
+ status ++;
+ }
+ else if (ippGetValueTag(attr) != IPP_TAG_NAME)
+ {
+ printf("FAIL (\"foo\" of type %s, expected name)\n", ippTagString(ippGetValueTag(attr)));
+ status ++;
+ }
+ else if (ippGetCount(attr) != 1)
+ {
+ printf("FAIL (\"foo\" has %d values, expected 1)\n", (int)ippGetCount(attr));
+ status ++;
+ }
+ else if (strcmp(ippGetString(attr, 0, NULL), "1234"))
+ {
+ printf("FAIL (\"foo\" has value %s, expected 1234)\n", ippGetString(attr, 0, NULL));
+ status ++;
+ }
+ else if ((attr = ippFindAttribute(request, "auth-info", IPP_TAG_ZERO)) == NULL)
+ {
+ puts("FAIL (Unable to find attribute \"auth-info\")");
+ status ++;
+ }
+ else if (ippGetValueTag(attr) != IPP_TAG_TEXT)
+ {
+ printf("FAIL (\"auth-info\" of type %s, expected text)\n", ippTagString(ippGetValueTag(attr)));
+ status ++;
+ }
+ else if (ippGetCount(attr) != 2)
+ {
+ printf("FAIL (\"auth-info\" has %d values, expected 2)\n", (int)ippGetCount(attr));
+ status ++;
+ }
+ else if (strcmp(ippGetString(attr, 0, NULL), "user"))
+ {
+ printf("FAIL (\"auth-info\"[0] has value \"%s\", expected \"user\")\n", ippGetString(attr, 0, NULL));
+ status ++;
+ }
+ else if (strcmp(ippGetString(attr, 1, NULL), "pass,word\\"))
+ {
+ printf("FAIL (\"auth-info\"[1] has value \"%s\", expected \"pass,word\\\")\n", ippGetString(attr, 1, NULL));
+ status ++;
+ }