diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2017-02-19 13:57:38 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2017-02-19 13:57:38 +0200 |
| commit | e6e625ed6c1300e382a36b9ebef48336a55550e9 (patch) | |
| tree | 1f1a8264cdb6b7451d29ba36a3a46edcf84e3c17 /test | |
| parent | 54d697e8970ffd397a96f6c6e4e2df7a82f8c168 (diff) | |
| download | mqtt-e6e625ed6c1300e382a36b9ebef48336a55550e9.tar.gz mqtt-e6e625ed6c1300e382a36b9ebef48336a55550e9.zip | |
Add interop test: dollar_topics_test
Diffstat (limited to 'test')
| -rw-r--r-- | test/interop/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | test/interop/dollar_topics_test.c | 38 |
2 files changed, 39 insertions, 0 deletions
diff --git a/test/interop/CMakeLists.txt b/test/interop/CMakeLists.txt index f35ca04..e907776 100644 --- a/test/interop/CMakeLists.txt +++ b/test/interop/CMakeLists.txt @@ -16,3 +16,4 @@ ADD_INTEROP_TEST(overlapping_subscriptions_test) ADD_INTEROP_TEST(keepalive_test) ADD_INTEROP_TEST(redelivery_on_reconnect_test) ADD_INTEROP_TEST(subscribe_failure_test) +ADD_INTEROP_TEST(dollar_topics_test) diff --git a/test/interop/dollar_topics_test.c b/test/interop/dollar_topics_test.c new file mode 100644 index 0000000..d7cb130 --- /dev/null +++ b/test/interop/dollar_topics_test.c @@ -0,0 +1,38 @@ +#include "greatest.h" +#include "testclient.h" +#include "cleanup.c" +#include "topics.c" +#include <bstrlib/bstrlib.h> + +TEST dollar_topics_test() +{ + TestClient *client; + bstring topic; + + topic = bfromcstr("$"); + bcatcstr(topic, topics[1]); + + client = TestClientNew("clientb"); + ASSERT(TestClientConnect(client, "localhost", 1883, 60, 0)); + ASSERT(TestClientSubscribe(client, wildtopics[5], 2)); + ASSERT(TestClientWait(client, 1000)); + ASSERT(TestClientPublish(client, 1, 0, bdata(topic), "")); + ASSERT(TestClientWait(client, 2000)); + TestClientDisconnect(client); + ASSERT_EQ(0, TestClientMessageCount(client)); + TestClientFree(client); + + bdestroy(topic); + + PASS(); +} + +GREATEST_MAIN_DEFS(); + +int main(int argc, char **argv) +{ + GREATEST_MAIN_BEGIN(); + cleanup(); + RUN_TEST(dollar_topics_test); + GREATEST_MAIN_END(); +} |
