aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2017-02-19 13:44:25 +0200
committerOskari Timperi <oskari.timperi@iki.fi>2017-02-19 13:44:25 +0200
commit54d697e8970ffd397a96f6c6e4e2df7a82f8c168 (patch)
tree08cfd10bec21deeb7a851beb0c408c881dba42cd /test
parente44167e4ec483ae6b169bdc8104bedee731e071c (diff)
downloadmqtt-54d697e8970ffd397a96f6c6e4e2df7a82f8c168.tar.gz
mqtt-54d697e8970ffd397a96f6c6e4e2df7a82f8c168.zip
Add interop test: subscribe_failure_test
Diffstat (limited to 'test')
-rw-r--r--test/interop/CMakeLists.txt1
-rw-r--r--test/interop/subscribe_failure_test.c28
-rw-r--r--test/interop/topics.c5
3 files changed, 34 insertions, 0 deletions
diff --git a/test/interop/CMakeLists.txt b/test/interop/CMakeLists.txt
index 7b3e7bc..f35ca04 100644
--- a/test/interop/CMakeLists.txt
+++ b/test/interop/CMakeLists.txt
@@ -15,3 +15,4 @@ ADD_INTEROP_TEST(offline_message_queueing_test)
ADD_INTEROP_TEST(overlapping_subscriptions_test)
ADD_INTEROP_TEST(keepalive_test)
ADD_INTEROP_TEST(redelivery_on_reconnect_test)
+ADD_INTEROP_TEST(subscribe_failure_test)
diff --git a/test/interop/subscribe_failure_test.c b/test/interop/subscribe_failure_test.c
new file mode 100644
index 0000000..84d3ebc
--- /dev/null
+++ b/test/interop/subscribe_failure_test.c
@@ -0,0 +1,28 @@
+#include "greatest.h"
+#include "testclient.h"
+#include "cleanup.c"
+#include "topics.c"
+
+TEST subscribe_failure_test()
+{
+ TestClient *client;
+
+ client = TestClientNew("clienta");
+ ASSERT(TestClientConnect(client, "localhost", 1883, 60, 1));
+ ASSERT_FALSE(TestClientSubscribe(client, nosubscribe_topics[0], 2));
+ ASSERT_EQ(MqttSubscriptionFailure, client->subStatus);
+ TestClientDisconnect(client);
+ TestClientFree(client);
+
+ PASS();
+}
+
+GREATEST_MAIN_DEFS();
+
+int main(int argc, char **argv)
+{
+ GREATEST_MAIN_BEGIN();
+ cleanup();
+ RUN_TEST(subscribe_failure_test);
+ GREATEST_MAIN_END();
+}
diff --git a/test/interop/topics.c b/test/interop/topics.c
index 3c75e92..dcab1d6 100644
--- a/test/interop/topics.c
+++ b/test/interop/topics.c
@@ -7,3 +7,8 @@ const char *wildtopics[] =
{
"TopicA/+", "+/C", "#", "/#", "/+", "+/+", "TopicA/#"
};
+
+const char *nosubscribe_topics[] =
+{
+ "test/nosubscribe"
+};