static void test_unquote_single(void) {
        const char *string = "'fo\"obar'";
        char buf[strlen(string)];
        const char *in = string;
        size_t n_in = strlen(string);
        char *out;
        size_t n_out;
        int r;

        out = NULL;
        n_out = 0;
        r = c_shquote_unquote_single(&out, &n_out, &in, &n_in);
        c_assert(r == C_SHQUOTE_E_NO_SPACE);
        c_assert(in == string);
        c_assert(n_in == strlen(string));

        out = buf;
        n_out = sizeof(buf);
        n_in = strlen(string) - 1;
        r = c_shquote_unquote_single(&out, &n_out, &in, &n_in);
        c_assert(r == C_SHQUOTE_E_BAD_QUOTING);
        c_assert(in == string);
        c_assert(n_in == strlen(string) - 1);

        n_in = strlen(string);
        r = c_shquote_unquote_single(&out, &n_out, &in, &n_in);
        c_assert(!r);
        c_assert(in == string + strlen(string));
        c_assert(!n_in);
        c_assert(out == buf + sizeof(buf) - 2);
        c_assert(n_out == 2);
        c_assert(!memcmp(buf, string + 1, strlen(string) - 2));
}
static void test_unquote_single(void) {
        const char *string = "'fo\"obar'";
        char buf[strlen(string)];
        const char *in = string;
        size_t n_in = strlen(string);
        char *out;
        size_t n_out;
        int r;

        out = NULL;
        n_out = 0;
        r = c_shquote_unquote_single(&out, &n_out, &in, &n_in);
        c_assert(r == C_SHQUOTE_E_NO_SPACE);
        c_assert(in == string);
        c_assert(n_in == strlen(string));

        out = buf;
        n_out = sizeof(buf);
        n_in = strlen(string) - 1;
        r = c_shquote_unquote_single(&out, &n_out, &in, &n_in);
        c_assert(r == C_SHQUOTE_E_BAD_QUOTING);
        c_assert(in == string);
        c_assert(n_in == strlen(string) - 1);

        n_in = strlen(string);
        r = c_shquote_unquote_single(&out, &n_out, &in, &n_in);
        c_assert(!r);
        c_assert(in == string + strlen(string));
        c_assert(!n_in);
        c_assert(out == buf + sizeof(buf) - 2);
        c_assert(n_out == 2);
        c_assert(!memcmp(buf, string + 1, strlen(string) - 2));
}