Exemplo n.º 1
0
void HeadersTest::caseInsensitivity()
{
    QFETCH(QByteArray, qbytearray1);
    QFETCH(QByteArray, qbytearray2);

    const IByteArray ibytearray1 = IByteArray{qbytearray1.constData()};
    const IByteArray ibytearray2 = qbytearray2;

    Headers headers;
    headers.insert(ibytearray1, qbytearray2);
    headers.insert(ibytearray2, qbytearray2);

    QCOMPARE(headers.count(ibytearray1), 2);
    QCOMPARE(headers.count(ibytearray2), 2);

    QVERIFY(headers.values(ibytearray1)[0] == headers.values(ibytearray2)[1]);

    /* ====================================================================== */

    headers.clear();
    headers.insert(ibytearray1, qbytearray2);
    headers.replace(ibytearray1, qbytearray1);
    headers.insert(ibytearray2, qbytearray2);

    QCOMPARE(headers.count(ibytearray1), 2);
    QCOMPARE(headers.count(ibytearray2), 2);

    QVERIFY(headers.values(ibytearray1)[0] != headers.values(ibytearray2)[1]);
}