diff options
Diffstat (limited to 'plugins/autotest/unit_test/mixed_atp/tests/auto/bench/tst_benchtest.cpp')
-rw-r--r-- | plugins/autotest/unit_test/mixed_atp/tests/auto/bench/tst_benchtest.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/tst_benchtest.cpp b/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/tst_benchtest.cpp new file mode 100644 index 0000000000..1d968a0147 --- /dev/null +++ b/plugins/autotest/unit_test/mixed_atp/tests/auto/bench/tst_benchtest.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Creator Enterprise Auto Test Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ +#include <QString> +#include <QtTest> + +class BenchTest : public QObject +{ + Q_OBJECT + +public: + BenchTest(); + +private Q_SLOTS: + void testCase1(); + void testCase1_data(); +}; + +BenchTest::BenchTest() +{ +} + +void BenchTest::testCase1() +{ + QFETCH(bool, localAware); + + QString str1 = QLatin1String("Hello World"); + QString str2 = QLatin1String("Hallo Welt"); + if (!localAware) { + QBENCHMARK { + str1 == str2; + } + } else { + QBENCHMARK { + str1.localeAwareCompare(str2) == 0; + } + } +} + +void BenchTest::testCase1_data() +{ + QTest::addColumn<bool>("localAware"); + QTest::newRow("localAware") << true; + QTest::newRow("simple") << false; +} + +QTEST_MAIN(BenchTest) + +#include "tst_benchtest.moc" |