Exemplo n.º 1
0
void checkHexRepresentation(const Sid::String& test, const Sid::String& expected)
{
    const char* origData = test.data();
    Sid::String res = test.getHexRepresentation();
    CPPUNIT_ASSERT_PRINTF(res == expected,
                            "getHexRepresentation() yielded unexpected result for value "
                            "\"%s\", should have been \"%s\", instead got \"%s\"\n",
                            test.isNull() ? "(NULL)" : test.data(),
                            expected.isNull() ? "(NULL)" : expected.data(),
                            res.isNull() ? "(NULL)" : res.data());    
    CPPUNIT_ASSERT_MESSAGE("getHexRepresentation() causes object to relinquish its reference!",
                            origData == test.data());
}
Exemplo n.º 2
0
void checkToBinary(const Sid::String& test, const char* expected, size_t expectedSize, const Sid::String& hex)
{
    const char* origData = test.data();
    checkToBinary(test, expected, expectedSize);
    Sid::String expHex(hex);
    Sid::String resHex = test.getHexRepresentation();
    CPPUNIT_ASSERT_PRINTF(expHex == resHex,
                            "getHexRepresentation() yielded unexpected "
                            "result:\n"
                            "\"%s\" (expected)\n"
                            "\"%s\" (result)\n",
                            expHex.isNull() ? "(NULL)" : expHex.data(),
                            resHex.isNull() ? "(NULL)" : resHex.data());

    CPPUNIT_ASSERT_MESSAGE("toBinary() causes object to relinquish its reference!",
                            origData == test.data());
}