void tst_QSourceLocation::equalnessOperator_data() const
{
    QTest::addColumn<QSourceLocation>("v1");
    QTest::addColumn<QSourceLocation>("v2");
    QTest::addColumn<bool>("True");

    {
        QTest::newRow("Default constructed values")
                << QSourceLocation()
                << QSourceLocation()
                << true;
    }

    {
        QSourceLocation modified;
        modified.setColumn(4);

        QTest::newRow("Default constructed, against column-modified")
            << QSourceLocation()
            << modified
            << false;
    }

    {
        QSourceLocation modified;
        modified.setLine(5);

        QTest::newRow("Default constructed, against line-modified")
            << QSourceLocation()
            << modified
            << false;
    }

    {
        QSourceLocation modified;
        modified.setUri(QUrl(QLatin1String("http://example.com/")));

        QTest::newRow("Default constructed, against line-modified")
            << QSourceLocation()
            << modified
            << false;
    }

    {
        QSourceLocation modified;
        modified.setUri(QUrl(QLatin1String("http://example.com/")));
        modified.setLine(5);
        modified.setColumn(4);

        QTest::newRow("Default constructed, against all-modified")
            << QSourceLocation()
            << modified
            << false;
    }
}
void tst_QSourceLocation::assignmentOperator() const
{
    /* Assign to self. */
    {
        QSourceLocation def;

        def = def;

        QVERIFY(def.isNull());
        QCOMPARE(def.line(), qint64(-1));
        QCOMPARE(def.column(), qint64(-1));
        QCOMPARE(def.uri(), QUrl());
    }

    /* Assign to default constructed object. */
    {
        QSourceLocation val;
        val.setLine(3);
        val.setColumn(4);
        val.setUri(QUrl(QLatin1String("http://example.com/2")));

        QSourceLocation assigned;
        assigned = val;

        QCOMPARE(assigned.line(), qint64(3));
        QCOMPARE(assigned.column(), qint64(4));
        QCOMPARE(assigned.uri(), QUrl(QLatin1String("http://example.com/2")));
    }

    /* Assign to modified object. */
    {
        QSourceLocation val;
        val.setLine(3);
        val.setColumn(4);
        val.setUri(QUrl(QLatin1String("http://example.com/2")));

        QSourceLocation assigned;
        assigned.setLine(700);
        assigned.setColumn(4000);
        assigned.setUri(QUrl(QLatin1String("http://example.com/3")));

        assigned = val;

        QCOMPARE(assigned.line(), qint64(3));
        QCOMPARE(assigned.column(), qint64(4));
        QCOMPARE(assigned.uri(), QUrl(QLatin1String("http://example.com/2")));
    }
}
void tst_QSourceLocation::copyConstructor() const
{
    {
        QSourceLocation def;
        QSourceLocation copy(def);

        QCOMPARE(def.line(), qint64(-1));
        QCOMPARE(def.column(), qint64(-1));
        QCOMPARE(def.uri(), QUrl());
    }

    {
        QSourceLocation val;
        val.setLine(5);
        val.setColumn(600);
        val.setUri(QUrl(QLatin1String("http://example.com/")));

        QSourceLocation copy(val);
        QCOMPARE(copy.line(), qint64(5));
        QCOMPARE(copy.column(), qint64(600));
        QCOMPARE(copy.uri(), QUrl(QLatin1String("http://example.com/")));
    }

    {
        /* Construct from a const object. */
        const QSourceLocation val;
        const QSourceLocation val2(val);
        QCOMPARE(val, val2);
    }
}
void tst_QSourceLocation::setUri() const
{
    QSourceLocation sl;
    sl.setUri(QUrl(QLatin1String("http://example.com/")));
    QCOMPARE(sl.uri(), QUrl(QLatin1String("http://example.com/")));
}