예제 #1
0
 size_t Set(const TextBuf &other)
 {
     if (other.IsByteStr() ) {
         return SetText(other.GetText(), other.GetLen());
     }
     else {
         return SetStr(other.GetStr());
     }
 }
예제 #2
0
    void RunTestCopyNul(const TextBuf &input, const TextBuf &expected)
    {
        char *out;
        ib_status_t rc;
        ib_flags_t result;

        rc = ExecCopyNul(input.GetStr(), &out, result);
        if (rc == IB_ENOTIMPL) {
            return;
        }
        const char *name = TestName(IB_STROP_COPY, TYPE_NUL);
        ASSERT_EQ(IB_OK, rc) << name;

        TextBuf output(out);
        CheckResult(name, input,
                    expected,
                    IB_STRFLAG_NEWBUF,
                    (IB_STRFLAG_NEWBUF | IB_STRFLAG_MODIFIED),
                    rc, result, output);
    }
예제 #3
0
    void RunTestInplaceNul(const TextBuf &input, const TextBuf &expected)
    {
        size_t len = input.GetLen();
        char buf[len];
        ib_status_t rc;
        ib_flags_t result;

        strcpy(buf, input.GetStr());

        rc = ExecInplaceNul(buf, result);
        if (rc == IB_ENOTIMPL) {
            return;
        }
        const char *name = TestName(IB_STROP_INPLACE, TYPE_NUL);
        ASSERT_EQ(IB_OK, rc) << name;

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