diff options
Diffstat (limited to 'tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp')
-rw-r--r-- | tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index 43e25743d7..b6f6d2a7f3 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -147,7 +142,7 @@ void tst_QSharedMemory::init() { existingSharedMemory = new QSharedMemory(EXISTING_SHARE); if (!existingSharedMemory->create(EXISTING_SIZE)) { - QVERIFY(existingSharedMemory->error() == QSharedMemory::AlreadyExists); + QCOMPARE(existingSharedMemory->error(), QSharedMemory::AlreadyExists); } } @@ -246,10 +241,10 @@ void tst_QSharedMemory::constructor() QSharedMemory sm; QCOMPARE(sm.key(), QString()); QVERIFY(!sm.isAttached()); - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); QCOMPARE(sm.size(), 0); QCOMPARE(sm.error(), QSharedMemory::NoError); - QVERIFY(sm.errorString() == QString()); + QCOMPARE(sm.errorString(), QString()); } void tst_QSharedMemory::key_data() @@ -290,8 +285,8 @@ void tst_QSharedMemory::key() QCOMPARE(sm.isAttached(), false); QCOMPARE(sm.error(), QSharedMemory::NoError); - QVERIFY(sm.errorString() == QString()); - QVERIFY(sm.data() == 0); + QCOMPARE(sm.errorString(), QString()); + QVERIFY(!sm.data()); QCOMPARE(sm.size(), 0); QCOMPARE(sm.detach(), false); @@ -330,11 +325,11 @@ void tst_QSharedMemory::create() qDebug() << sm.errorString(); QCOMPARE(sm.key(), key); if (canCreate) { - QVERIFY(sm.errorString() == QString()); + QCOMPARE(sm.errorString(), QString()); QVERIFY(sm.data() != 0); QVERIFY(sm.size() != 0); } else { - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); QVERIFY(sm.errorString() != QString()); } } @@ -379,10 +374,10 @@ void tst_QSharedMemory::attach() QVERIFY(sm.size() != 0); QVERIFY(sm.detach()); QCOMPARE(sm.size(), 0); - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); } else { - QVERIFY(sm.data() == 0); - QVERIFY(sm.size() == 0); + QVERIFY(!sm.data()); + QCOMPARE(sm.size(), 0); QVERIFY(sm.errorString() != QString()); QVERIFY(!sm.detach()); } @@ -483,7 +478,7 @@ void tst_QSharedMemory::useTooMuchMemory() bool success = true; int count = 0; while (success) { - QString key = QString("maxmemorytest_%1").arg(count++); + QString key = QLatin1String("maxmemorytest_") + QString::number(count++); QSharedMemory *sm = new QSharedMemory(rememberKey(key)); QVERIFY(sm); jail.append(sm); @@ -500,7 +495,7 @@ void tst_QSharedMemory::useTooMuchMemory() QVERIFY(!sm->isAttached()); QCOMPARE(sm->key(), key); QCOMPARE(sm->size(), 0); - QVERIFY(sm->data() == 0); + QVERIFY(!sm->data()); if (sm->error() != QSharedMemory::OutOfResources) qDebug() << sm->error() << sm->errorString(); // ### Linux won't return OutOfResources if there are not enough semaphores to use. @@ -537,7 +532,7 @@ void tst_QSharedMemory::attachTooMuch() QVERIFY(!war->isAttached()); QCOMPARE(war->key(), government.key()); QCOMPARE(war->size(), 0); - QVERIFY(war->data() == 0); + QVERIFY(!war->data()); QCOMPARE(war->error(), QSharedMemory::OutOfResources); QVERIFY(war->errorString() != QString()); QVERIFY(!war->detach()); |