diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quuid/tst_quuid.cpp | 16 | ||||
-rw-r--r-- | tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp | 18 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp index 1b65abb..bedc397 100644 --- a/tests/auto/quuid/tst_quuid.cpp +++ b/tests/auto/quuid/tst_quuid.cpp @@ -65,6 +65,8 @@ private slots: void fromString(); void toByteArray(); void fromByteArray(); + void toRfc4122(); + void fromRfc4122(); void check_QDataStream(); void isNull(); void equal(); @@ -147,6 +149,20 @@ void tst_QUuid::fromByteArray() QCOMPARE(uuidB, QUuid(QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"))); } +void tst_QUuid::toRfc4122() +{ + QCOMPARE(uuidA.toRfc4122(), QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5")); + + QCOMPARE(uuidB.toRfc4122(), QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b")); +} + +void tst_QUuid::fromRfc4122() +{ + QCOMPARE(uuidA, QUuid::fromRfc4122(QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5"))); + + QCOMPARE(uuidB, QUuid::fromRfc4122(QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b"))); +} + void tst_QUuid::check_QDataStream() { QUuid tmp; diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp index 608423a..77a9920 100644 --- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp @@ -58,6 +58,8 @@ private slots: void fromString(); void toByteArray(); void fromByteArray(); + void toRfc4122(); + void fromRfc4122(); void toDataStream(); void fromDataStream(); void isNull(); @@ -111,6 +113,22 @@ void tst_bench_QUuid::fromByteArray() } } +void tst_bench_QUuid::toRfc4122() +{ + QUuid uuid = QUuid::createUuid(); + QBENCHMARK { + uuid.toRfc4122(); + } +} + +void tst_bench_QUuid::fromRfc4122() +{ + QByteArray string = QByteArray::fromHex("67C8770B44F1410AAB9AF9B5446F13EE"); + QBENCHMARK { + QUuid uuid = QUuid::fromRfc4122(string); + } +} + void tst_bench_QUuid::toDataStream() { QUuid uuid1, uuid2; |