summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@nokia.com>2011-05-20 12:12:57 (GMT)
committerLiang Qi <liang.qi@nokia.com>2011-05-20 12:12:57 (GMT)
commit4e9286880fd2686e61de2c4be3c317e01f0d9989 (patch)
tree3644c5f147547090ea12d327b3b17e6506e0d59f /tests/benchmarks
parent0ccf01368adcabbb25958a55976083f72116a2d5 (diff)
downloadQt-4e9286880fd2686e61de2c4be3c317e01f0d9989.zip
Qt-4e9286880fd2686e61de2c4be3c317e01f0d9989.tar.gz
Qt-4e9286880fd2686e61de2c4be3c317e01f0d9989.tar.bz2
Add some autotests and benchmarks for QUuid
Missing those functions for optimization. Reviewed-by: joao
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp
index 9e885ee..47a3d3f 100644
--- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp
@@ -53,6 +53,14 @@ public:
private slots:
void createUuid();
+ void fromChar();
+ void toString();
+ void fromString();
+ void toDataStream();
+ void fromDataStream();
+ void isNull();
+ void operatorLess();
+ void operatorMore();
};
void tst_bench_QUuid::createUuid()
@@ -62,5 +70,86 @@ void tst_bench_QUuid::createUuid()
}
}
+void tst_bench_QUuid::fromChar()
+{
+ QBENCHMARK {
+ QUuid uuid("{67C8770B-44F1-410A-AB9A-F9B5446F13EE}");
+ }
+}
+
+void tst_bench_QUuid::toString()
+{
+ QUuid uuid = QUuid::createUuid();
+ QBENCHMARK {
+ uuid.toString();
+ }
+}
+
+void tst_bench_QUuid::fromString()
+{
+ QString string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}";
+ QBENCHMARK {
+ QUuid uuid(string);
+ }
+}
+
+void tst_bench_QUuid::toDataStream()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ QByteArray ar;
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ QBENCHMARK {
+ out << uuid1;
+ }
+ }
+}
+
+void tst_bench_QUuid::fromDataStream()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ QByteArray ar;
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ out << uuid1;
+ }
+ {
+ QDataStream in(&ar,QIODevice::ReadOnly);
+ QBENCHMARK {
+ in >> uuid2;
+ }
+ }
+}
+
+void tst_bench_QUuid::isNull()
+{
+ QUuid uuid = QUuid();
+ QBENCHMARK {
+ uuid.isNull();
+ }
+}
+
+void tst_bench_QUuid::operatorLess()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ uuid2 = QUuid::createUuid();
+ QBENCHMARK {
+ uuid1 < uuid2;
+ }
+}
+
+void tst_bench_QUuid::operatorMore()
+{
+ QUuid uuid1, uuid2;
+ uuid1 = QUuid::createUuid();
+ uuid2 = QUuid::createUuid();
+ QBENCHMARK {
+ uuid1 > uuid2;
+ }
+}
+
QTEST_MAIN(tst_bench_QUuid);
#include "tst_quuid.moc"