12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #include <support/check.h>
- #include <support/support.h>
- #include <string.h>
- #include <stdlib.h>
- static int
- do_test (void)
- {
-
- char *p = support_quote_blob ("", 0);
- TEST_COMPARE (strlen (p), 0);
- free (p);
- p = support_quote_blob ("X", 0);
- TEST_COMPARE (strlen (p), 0);
- free (p);
-
- p = support_quote_blob ("$()*?`@[]{}~\'\"X", 14);
- TEST_COMPARE (strcmp (p, "$()*?`@[]{}~\\'\\\""), 0);
- free (p);
-
- #define LETTERS_AND_DIGTS \
- "abcdefghijklmnopqrstuvwxyz" \
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
- "0123456789"
- p = support_quote_blob (LETTERS_AND_DIGTS "@", 2 * 26 + 10);
- TEST_COMPARE (strcmp (p, LETTERS_AND_DIGTS), 0);
- free (p);
-
- p = support_quote_blob ("\r\n\t\a\b\f\v\1\177\200\377\0@", 14);
- TEST_COMPARE (strcmp (p, "\\r\\n\\t\\a\\b\\f\\v\\001"
- "\\177\\200\\377\\000@\\000"), 0);
- free (p);
- return 0;
- }
- #include <support/test-driver.c>
|