diff options
Diffstat (limited to 'tests/auto/corelib/tools/qpair/tst_qpair.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qpair/tst_qpair.cpp | 67 |
1 files changed, 21 insertions, 46 deletions
diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index 464477d5d1..0c9d87bb01 100644 --- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -1,32 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** 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$ -** -****************************************************************************/ - -#include <QtTest/QtTest> +// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QTest> #include <QPair> #include <QSize> @@ -43,12 +18,12 @@ private Q_SLOTS: void testDeductionRules(); }; -class C { C() {} Q_DECL_UNUSED_MEMBER char _[4]; }; +class C { C() {} ~C() {} Q_DECL_UNUSED_MEMBER char _[4]; }; class M { M() {} Q_DECL_UNUSED_MEMBER char _[4]; }; class P { Q_DECL_UNUSED_MEMBER char _[4]; }; QT_BEGIN_NAMESPACE -Q_DECLARE_TYPEINFO(M, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(M, Q_RELOCATABLE_TYPE); Q_DECLARE_TYPEINFO(P, Q_PRIMITIVE_TYPE); QT_END_NAMESPACE @@ -64,33 +39,33 @@ typedef QPair<P,M> QPairPM; typedef QPair<P,P> QPairPP; static_assert( QTypeInfo<QPairCC>::isComplex); -static_assert( QTypeInfo<QPairCC>::isStatic ); +static_assert( !QTypeInfo<QPairCC>::isRelocatable ); static_assert( QTypeInfo<QPairCM>::isComplex); -static_assert( QTypeInfo<QPairCM>::isStatic ); +static_assert( !QTypeInfo<QPairCM>::isRelocatable ); static_assert( QTypeInfo<QPairCP>::isComplex); -static_assert( QTypeInfo<QPairCP>::isStatic ); +static_assert( !QTypeInfo<QPairCP>::isRelocatable ); static_assert( QTypeInfo<QPairMC>::isComplex); -static_assert( QTypeInfo<QPairMC>::isStatic ); +static_assert( !QTypeInfo<QPairMC>::isRelocatable ); static_assert( QTypeInfo<QPairMM>::isComplex); -static_assert(!QTypeInfo<QPairMM>::isStatic ); +static_assert( QTypeInfo<QPairMM>::isRelocatable ); static_assert( QTypeInfo<QPairMP>::isComplex); -static_assert(!QTypeInfo<QPairMP>::isStatic ); +static_assert( QTypeInfo<QPairMP>::isRelocatable ); static_assert( QTypeInfo<QPairPC>::isComplex); -static_assert( QTypeInfo<QPairPC>::isStatic ); +static_assert( !QTypeInfo<QPairPC>::isRelocatable ); static_assert( QTypeInfo<QPairPM>::isComplex); -static_assert(!QTypeInfo<QPairPM>::isStatic ); +static_assert( QTypeInfo<QPairPM>::isRelocatable ); static_assert(!QTypeInfo<QPairPP>::isComplex); -static_assert(!QTypeInfo<QPairPP>::isStatic ); +static_assert( QTypeInfo<QPairPP>::isRelocatable ); -static_assert(!QTypeInfo<QPairPP>::isPointer); +static_assert(!std::is_pointer_v<QPairPP>); void tst_QPair::pairOfReferences() @@ -174,15 +149,15 @@ void tst_QPair::structuredBindings() void tst_QPair::testConstexpr() { - Q_CONSTEXPR QPair<int, double> pID = qMakePair(0, 0.0); + constexpr QPair<int, double> pID = qMakePair(0, 0.0); Q_UNUSED(pID); - Q_CONSTEXPR QPair<double, double> pDD = qMakePair(0.0, 0.0); - Q_CONSTEXPR QPair<double, double> pDD2 = qMakePair(0, 0.0); // involes (rvalue) conversion ctor - Q_CONSTEXPR bool equal = pDD2 == pDD; + constexpr QPair<double, double> pDD = qMakePair(0.0, 0.0); + constexpr QPair<double, double> pDD2 = qMakePair(0, 0.0); // involes (rvalue) conversion ctor + constexpr bool equal = pDD2 == pDD; QVERIFY(equal); - Q_CONSTEXPR QPair<QSize, int> pSI = qMakePair(QSize(4, 5), 6); + constexpr QPair<QSize, int> pSI = qMakePair(QSize(4, 5), 6); Q_UNUSED(pSI); } |