diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-07-22 04:04:05 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-07-22 04:04:44 (GMT) |
commit | 266a64d34d775b2ebcf1bffbf751cfe9437ceafe (patch) | |
tree | 8abf28097f4846355dceb5a03b4a9af05ba24c43 | |
parent | 5dd0dfcd7a079065f99c6149c15b58e69f302729 (diff) | |
download | Qt-266a64d34d775b2ebcf1bffbf751cfe9437ceafe.zip Qt-266a64d34d775b2ebcf1bffbf751cfe9437ceafe.tar.gz Qt-266a64d34d775b2ebcf1bffbf751cfe9437ceafe.tar.bz2 |
Add additional QVariant benchmarks.
-rw-r--r-- | tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp index 82dc7dd..58cec4f 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp @@ -66,6 +66,11 @@ private slots: void floatVariantAssignment(); void rectVariantAssignment(); void stringVariantAssignment(); + + void doubleVariantValue(); + void floatVariantValue(); + void rectVariantValue(); + void stringVariantValue(); }; void tst_qvariant::testBound() @@ -175,6 +180,46 @@ void tst_qvariant::stringVariantAssignment() variantAssignment<QString>(QString()); } +void tst_qvariant::doubleVariantValue() +{ + QVariant v(0.0); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toDouble(); + } + } +} + +void tst_qvariant::floatVariantValue() +{ + QVariant v(0.0f); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toFloat(); + } + } +} + +void tst_qvariant::rectVariantValue() +{ + QVariant v(QRect(1,2,3,4)); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toRect(); + } + } +} + +void tst_qvariant::stringVariantValue() +{ + QVariant v = QString(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toString(); + } + } +} + QTEST_MAIN(tst_qvariant) #include "tst_qvariant.moc" |