예제 #1
0
    void RunTestNulToNulBuf(const TextBuf &input,
                            const TextBuf &expected,
                            size_t bufsize,
                            ib_status_t expected_rc)
    {
        char buf[bufsize];
        size_t len;
        ib_status_t rc;
        ib_flags_t result;

        rc = ExecNulToNulBuf(input.GetBuf(),
                             buf, bufsize, len,
                             result);
        if (rc == IB_ENOTIMPL) {
            return;
        }
        const char *name = TestName(IB_STROP_BUF, TYPE_NUL);
        ASSERT_EQ(expected_rc, rc) << name;

        TextBuf output(buf);
        CheckResult(name, input,
                    expected,
                    IB_STRFLAG_NONE,
                    IB_STRFLAG_MODIFIED,
                    rc, result, output);
    }
예제 #2
0
 bool operator == (const TextBuf &other) const
 {
     if (IsNull() || other.IsNull() ) {
         return false;
     }
     if (IsByteStr() || other.IsByteStr()) {
         if (GetLen() != other.GetLen()) {
             return false;
         }
         else if (GetLen() == 0) {
             return true;
         }
         else {
             return (memcmp(GetBuf(), other.GetBuf(), GetLen()) == 0);
         }
     }
     else {
         return (strcmp(GetBuf(), other.GetBuf()) == 0);
     }
 };
예제 #3
0
    void RunTestInplaceEx(const TextBuf &input, const TextBuf &expected)
    {
        size_t len = input.GetLen();
        uint8_t buf[len];
        ib_status_t rc;
        size_t outlen;
        ib_flags_t result;

        memcpy(buf, input.GetBuf(), len);

        rc = ExecInplaceEx(buf, len, outlen, result);
        if (rc == IB_ENOTIMPL) {
            return;
        }
        const char *name = TestName(IB_STROP_INPLACE, TYPE_EX);
        ASSERT_EQ(IB_OK, rc) << name;

        TextBuf output(buf, outlen);
        CheckResult(name, input,
                    expected,
                    IB_STRFLAG_ALIAS,
                    (IB_STRFLAG_ALIAS | IB_STRFLAG_MODIFIED),
                    rc, result, output);
    }