diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qcoapclient/tst_qcoapclient.cpp | 51 | ||||
-rw-r--r-- | tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp | 16 | ||||
-rw-r--r-- | tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp | 22 | ||||
-rw-r--r-- | tests/auto/qcoapmessage/tst_qcoapmessage.cpp | 26 | ||||
-rw-r--r-- | tests/auto/qcoaprequest/tst_qcoaprequest.cpp | 4 |
5 files changed, 59 insertions, 60 deletions
diff --git a/tests/auto/qcoapclient/tst_qcoapclient.cpp b/tests/auto/qcoapclient/tst_qcoapclient.cpp index b06fa21..c7fce74 100644 --- a/tests/auto/qcoapclient/tst_qcoapclient.cpp +++ b/tests/auto/qcoapclient/tst_qcoapclient.cpp @@ -498,7 +498,7 @@ void tst_QCoapClient::timeout() QElapsedTimer timeoutTimer; timeoutTimer.start(); QScopedPointer<QCoapReply> reply( - client.get(QCoapRequest(url, QCoapMessage::MessageType::Confirmable))); + client.get(QCoapRequest(url, QCoapMessage::Type::Confirmable))); QSignalSpy spyClientError(&client, &QCoapClient::error); QSignalSpy spyReplyError(reply.data(), &QCoapReply::error); QSignalSpy spyReplyAborted(reply.data(), &QCoapReply::aborted); @@ -555,7 +555,7 @@ void tst_QCoapClient::abort() void tst_QCoapClient::blockwiseReply_data() { QTest::addColumn<QUrl>("url"); - QTest::addColumn<QCoapMessage::MessageType>("type"); + QTest::addColumn<QCoapMessage::Type>("type"); QTest::addColumn<QByteArray>("replyData"); QByteArray data; @@ -582,34 +582,34 @@ void tst_QCoapClient::blockwiseReply_data() QTest::newRow("get_large") << QUrl(testServerUrl() + "/large") - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << data; QTest::newRow("get_large_separate") << QUrl(testServerUrl() + "/large-separate") - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << data; QTest::newRow("get_large_confirmable") << QUrl(testServerUrl() + "/large") - << QCoapMessage::MessageType::Confirmable + << QCoapMessage::Type::Confirmable << data; QTest::newRow("get_large_separate_confirmable") << QUrl(testServerUrl() + "/large-separate") - << QCoapMessage::MessageType::Confirmable + << QCoapMessage::Type::Confirmable << data; QTest::newRow("get_large_16bits") << QUrl(testServerUrl() + "/large") - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << data; QTest::newRow("get_large_16bits_confirmable") << QUrl(testServerUrl() + "/large") - << QCoapMessage::MessageType::Confirmable + << QCoapMessage::Type::Confirmable << data; } void tst_QCoapClient::blockwiseReply() { QFETCH(QUrl, url); - QFETCH(QCoapMessage::MessageType, type); + QFETCH(QCoapMessage::Type, type); QFETCH(QByteArray, replyData); QCoapClient client; @@ -633,7 +633,7 @@ void tst_QCoapClient::blockwiseReply() void tst_QCoapClient::blockwiseRequest_data() { QTest::addColumn<QUrl>("url"); - QTest::addColumn<QCoapMessage::MessageType>("type"); + QTest::addColumn<QCoapMessage::Type>("type"); QTest::addColumn<QByteArray>("requestData"); QTest::addColumn<QtCoap::ResponseCode>("responseCode"); QTest::addColumn<QByteArray>("replyData"); @@ -644,12 +644,12 @@ void tst_QCoapClient::blockwiseRequest_data() data.append(alphabet); QTest::newRow("large_post_empty_reply") << QUrl(testServerUrl() + "/query") - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << data << QtCoap::ResponseCode::MethodNotAllowed << QByteArray(); QTest::newRow("large_post_large_reply") << QUrl(testServerUrl() + "/large-post") - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << data << QtCoap::ResponseCode::Changed << data.toUpper(); @@ -658,7 +658,7 @@ void tst_QCoapClient::blockwiseRequest_data() void tst_QCoapClient::blockwiseRequest() { QFETCH(QUrl, url); - QFETCH(QCoapMessage::MessageType, type); + QFETCH(QCoapMessage::Type, type); QFETCH(QByteArray, requestData); QFETCH(QtCoap::ResponseCode, responseCode); QFETCH(QByteArray, replyData); @@ -716,49 +716,49 @@ void tst_QCoapClient::observe_data() { QWARN("Observe tests may take some time, don't forget to raise Tests timeout in settings."); QTest::addColumn<QUrl>("url"); - QTest::addColumn<QCoapMessage::MessageType>("type"); + QTest::addColumn<QCoapMessage::Type>("type"); QTest::newRow("observe") << QUrl(testServerUrl() + "/obs") - << QCoapMessage::MessageType::NonConfirmable; + << QCoapMessage::Type::NonConfirmable; QTest::newRow("observe_no_scheme_no_port") << QUrl(testServerHost() + "/obs") - << QCoapMessage::MessageType::NonConfirmable; + << QCoapMessage::Type::NonConfirmable; QTest::newRow("observe_confirmable") << QUrl(testServerUrl() + "/obs") - << QCoapMessage::MessageType::Confirmable; + << QCoapMessage::Type::Confirmable; QTest::newRow("observe_receive") << QUrl(testServerUrl() + "/obs-non") - << QCoapMessage::MessageType::NonConfirmable; + << QCoapMessage::Type::NonConfirmable; QTest::newRow("observe_receive_confirmable") << QUrl(testServerUrl() + "/obs-non") - << QCoapMessage::MessageType::Confirmable; + << QCoapMessage::Type::Confirmable; QTest::newRow("observe_large") << QUrl(testServerUrl() + "/obs-large") - << QCoapMessage::MessageType::NonConfirmable; + << QCoapMessage::Type::NonConfirmable; QTest::newRow("observe_large_confirmable") << QUrl(testServerUrl() + "/obs-large") - << QCoapMessage::MessageType::Confirmable; + << QCoapMessage::Type::Confirmable; QTest::newRow("observe_pumping") << QUrl(testServerUrl() + "/obs-pumping") - << QCoapMessage::MessageType::NonConfirmable; + << QCoapMessage::Type::NonConfirmable; QTest::newRow("observe_pumping_confirmable") << QUrl(testServerUrl() + "/obs-pumping") - << QCoapMessage::MessageType::Confirmable; + << QCoapMessage::Type::Confirmable; } void tst_QCoapClient::observe() { QFETCH(QUrl, url); - QFETCH(QCoapMessage::MessageType, type); + QFETCH(QCoapMessage::Type, type); QCoapClient client; QCoapRequest request(url); @@ -788,8 +788,7 @@ void tst_QCoapClient::observe() void tst_QCoapClient::confirmableMulticast() { QCoapClient client; - const auto reply = client.get(QCoapRequest("224.0.1.187", - QCoapMessage::MessageType::Confirmable)); + const auto reply = client.get(QCoapRequest("224.0.1.187", QCoapMessage::Type::Confirmable)); QVERIFY2(!reply, "Confirmable multicast request didn't fail as expected."); } diff --git a/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp b/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp index da2531b..61a3dbc 100644 --- a/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp +++ b/tests/auto/qcoapinternalreply/tst_qcoapinternalreply.cpp @@ -52,7 +52,7 @@ private Q_SLOTS: void tst_QCoapInternalReply::parseReplyPdu_data() { QTest::addColumn<QtCoap::ResponseCode>("responseCode"); - QTest::addColumn<QCoapMessage::MessageType>("type"); + QTest::addColumn<QCoapMessage::Type>("type"); QTest::addColumn<quint16>("messageId"); QTest::addColumn<QByteArray>("token"); QTest::addColumn<quint8>("tokenLength"); @@ -73,7 +73,7 @@ void tst_QCoapInternalReply::parseReplyPdu_data() QTest::newRow("reply_with_options_and_payload") << QtCoap::ResponseCode::Content - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << quint16(64463) << QByteArray("4647f09b") << quint8(4) @@ -87,7 +87,7 @@ void tst_QCoapInternalReply::parseReplyPdu_data() QTest::newRow("reply_with_payload") << QtCoap::ResponseCode::Content - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << quint16(64463) << QByteArray("4647f09b") << quint8(4) @@ -100,7 +100,7 @@ void tst_QCoapInternalReply::parseReplyPdu_data() QTest::newRow("reply_with_options") << QtCoap::ResponseCode::Content - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << quint16(64463) << QByteArray("4647f09b") << quint8(4) @@ -112,7 +112,7 @@ void tst_QCoapInternalReply::parseReplyPdu_data() QTest::newRow("reply_only") << QtCoap::ResponseCode::Content - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << quint16(64463) << QByteArray("4647f09b") << quint8(4) @@ -124,7 +124,7 @@ void tst_QCoapInternalReply::parseReplyPdu_data() QTest::newRow("reply_with_big_option") << QtCoap::ResponseCode::Content - << QCoapMessage::MessageType::NonConfirmable + << QCoapMessage::Type::NonConfirmable << quint16(64463) << QByteArray("4647f09b") << quint8(4) @@ -139,7 +139,7 @@ void tst_QCoapInternalReply::parseReplyPdu_data() void tst_QCoapInternalReply::parseReplyPdu() { QFETCH(QtCoap::ResponseCode, responseCode); - QFETCH(QCoapMessage::MessageType, type); + QFETCH(QCoapMessage::Type, type); QFETCH(quint16, messageId); QFETCH(QByteArray, token); QFETCH(quint8, tokenLength); @@ -159,7 +159,7 @@ void tst_QCoapInternalReply::parseReplyPdu() QCOMPARE(reply->message()->token().toHex(), token); QCOMPARE(reply->message()->optionCount(), optionsNames.count()); for (int i = 0; i < reply->message()->optionCount(); ++i) { - QCoapOption option = reply->message()->option(i); + QCoapOption option = reply->message()->optionAt(i); QCOMPARE(option.name(), optionsNames.at(i)); QCOMPARE(option.length(), optionsLengths.at(i)); QCOMPARE(option.value(), optionsValues.at(i)); diff --git a/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp b/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp index 6a61eb1..1e5c732 100644 --- a/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp +++ b/tests/auto/qcoapinternalrequest/tst_qcoapinternalrequest.cpp @@ -63,7 +63,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() { QTest::addColumn<QUrl>("url"); QTest::addColumn<QtCoap::Method>("method"); - QTest::addColumn<QCoapMessage::MessageType>("type"); + QTest::addColumn<QCoapMessage::Type>("type"); QTest::addColumn<quint16>("messageId"); QTest::addColumn<QByteArray>("token"); QTest::addColumn<QString>("pduHeader"); @@ -72,7 +72,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_with_option_and_payload") << QUrl("coap://10.20.30.40:5683/test") << QtCoap::Method::Get - << QCoapRequest::MessageType::NonConfirmable + << QCoapRequest::Type::NonConfirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "5401dc504647f09bb474657374ff" @@ -81,7 +81,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_domain") << QUrl("coap://domain.com:5683/test") << QtCoap::Method::Get - << QCoapRequest::MessageType::NonConfirmable + << QCoapRequest::Type::NonConfirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "5401dc504647f09b3a646f6d61696e2e636f6d8474657374ff" @@ -90,7 +90,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_ipv6") << QUrl("coap://[::ffff:ac11:3]:5683/test") << QtCoap::Method::Get - << QCoapRequest::MessageType::NonConfirmable + << QCoapRequest::Type::NonConfirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "5401dc504647f09bb474657374ff" @@ -99,7 +99,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_without_payload") << QUrl("coap://10.20.30.40:5683/test") << QtCoap::Method::Get - << QCoapRequest::MessageType::NonConfirmable + << QCoapRequest::Type::NonConfirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "5401dc504647f09bb474657374" @@ -108,7 +108,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_without_option") << QUrl("coap://10.20.30.40:5683/") << QtCoap::Method::Put - << QCoapRequest::MessageType::Confirmable + << QCoapRequest::Type::Confirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "4403dc504647f09bff" @@ -117,7 +117,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_only") << QUrl("coap://10.20.30.40:5683/") << QtCoap::Method::Get - << QCoapRequest::MessageType::NonConfirmable + << QCoapRequest::Type::NonConfirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "5401dc504647f09b" @@ -126,7 +126,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_with_multiple_options") << QUrl("coap://10.20.30.40:5683/test/oui") << QtCoap::Method::Get - << QCoapRequest::MessageType::NonConfirmable + << QCoapRequest::Type::NonConfirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "5401dc504647f09bb474657374036f7569" @@ -135,7 +135,7 @@ void tst_QCoapInternalRequest::requestToFrame_data() QTest::newRow("request_with_big_option_number") << QUrl("coap://10.20.30.40:5683/test") << QtCoap::Method::Get - << QCoapRequest::MessageType::NonConfirmable + << QCoapRequest::Type::NonConfirmable << quint16(56400) << QByteArray::fromHex("4647f09b") << "5401dc504647f09bb474657374dd240d6162636465666768696a6b6c6d6e6f70" @@ -147,7 +147,7 @@ void tst_QCoapInternalRequest::requestToFrame() { QFETCH(QUrl, url); QFETCH(QtCoap::Method, method); - QFETCH(QCoapMessage::MessageType, type); + QFETCH(QCoapMessage::Type, type); QFETCH(quint16, messageId); QFETCH(QByteArray, token); QFETCH(QString, pduHeader); @@ -218,7 +218,7 @@ void tst_QCoapInternalRequest::parseUri() QFETCH(QUrl, proxyUri); QFETCH(QVector<QCoapOption>, options); - QCoapRequest request(uri, QCoapMessage::MessageType::NonConfirmable, proxyUri); + QCoapRequest request(uri, QCoapMessage::Type::NonConfirmable, proxyUri); QCoapInternalRequest internalRequest(request); for (QCoapOption opt : options) diff --git a/tests/auto/qcoapmessage/tst_qcoapmessage.cpp b/tests/auto/qcoapmessage/tst_qcoapmessage.cpp index 8801ed0..e13281e 100644 --- a/tests/auto/qcoapmessage/tst_qcoapmessage.cpp +++ b/tests/auto/qcoapmessage/tst_qcoapmessage.cpp @@ -39,8 +39,8 @@ class tst_QCoapMessage : public QObject private Q_SLOTS: void copyAndDetach(); - void setMessageType_data(); - void setMessageType(); + void setType_data(); + void setType(); void addOption(); void addOption_string_data(); void addOption_string(); @@ -59,7 +59,7 @@ void tst_QCoapMessage::copyAndDetach() a.setMessageId(3); a.setPayload("payload"); a.setToken("token"); - a.setType(QCoapMessage::MessageType::Acknowledgment); + a.setType(QCoapMessage::Type::Acknowledgment); a.setVersion(5); // Test the copy @@ -67,7 +67,7 @@ void tst_QCoapMessage::copyAndDetach() QVERIFY2(b.messageId() == 3, "Message not copied correctly"); QVERIFY2(b.payload() == "payload", "Message not copied correctly"); QVERIFY2(b.token() == "token", "Message not copied correctly"); - QVERIFY2(b.type() == QCoapMessage::MessageType::Acknowledgment, "Message not copied correctly"); + QVERIFY2(b.type() == QCoapMessage::Type::Acknowledgment, "Message not copied correctly"); QVERIFY2(b.version() == 5, "Message not copied correctly"); // Detach @@ -76,19 +76,19 @@ void tst_QCoapMessage::copyAndDetach() QCOMPARE(a.messageId(), 3); } -void tst_QCoapMessage::setMessageType_data() +void tst_QCoapMessage::setType_data() { - QTest::addColumn<QCoapMessage::MessageType>("type"); + QTest::addColumn<QCoapMessage::Type>("type"); - QTest::newRow("acknowledgment") << QCoapMessage::MessageType::Acknowledgment; - QTest::newRow("confirmable") << QCoapMessage::MessageType::Confirmable; - QTest::newRow("non-confirmable") << QCoapMessage::MessageType::NonConfirmable; - QTest::newRow("reset") << QCoapMessage::MessageType::Reset; + QTest::newRow("acknowledgment") << QCoapMessage::Type::Acknowledgment; + QTest::newRow("confirmable") << QCoapMessage::Type::Confirmable; + QTest::newRow("non-confirmable") << QCoapMessage::Type::NonConfirmable; + QTest::newRow("reset") << QCoapMessage::Type::Reset; } -void tst_QCoapMessage::setMessageType() +void tst_QCoapMessage::setType() { - QFETCH(QCoapMessage::MessageType, type); + QFETCH(QCoapMessage::Type, type); QCoapMessage message; message.setType(type); QCOMPARE(message.type(), type); @@ -256,7 +256,7 @@ void tst_QCoapMessage::removeAll() message.addOption(QCoapOption::LocationPath, "path"); message.addOption(QCoapOption::ProxyUri, "proxy1"); message.addOption(QCoapOption::ProxyUri, "proxy2"); - message.removeAllOptions(); + message.clearOptions(); QVERIFY(message.options().isEmpty()); } diff --git a/tests/auto/qcoaprequest/tst_qcoaprequest.cpp b/tests/auto/qcoaprequest/tst_qcoaprequest.cpp index 9f66b98..592d4eb 100644 --- a/tests/auto/qcoaprequest/tst_qcoaprequest.cpp +++ b/tests/auto/qcoaprequest/tst_qcoaprequest.cpp @@ -160,7 +160,7 @@ void tst_QCoapRequest::copyAndDetach() a.setMessageId(3); a.setPayload("payload"); a.setToken("token"); - a.setType(QCoapMessage::MessageType::Acknowledgment); + a.setType(QCoapMessage::Type::Acknowledgment); a.setVersion(5); a.setMethod(QtCoap::Method::Delete); QUrl testUrl("coap://url:500/resource"); @@ -173,7 +173,7 @@ void tst_QCoapRequest::copyAndDetach() QVERIFY2(b.messageId() == 3, "Message not copied correctly"); QVERIFY2(b.payload() == "payload", "Message not copied correctly"); QVERIFY2(b.token() == "token", "Message not copied correctly"); - QVERIFY2(b.type() == QCoapMessage::MessageType::Acknowledgment, "Message not copied correctly"); + QVERIFY2(b.type() == QCoapMessage::Type::Acknowledgment, "Message not copied correctly"); QVERIFY2(b.version() == 5, "Message not copied correctly"); // Test the QCoapRequest copy |