From e6e625ed6c1300e382a36b9ebef48336a55550e9 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Sun, 19 Feb 2017 13:57:38 +0200 Subject: Add interop test: dollar_topics_test --- src/CMakeLists.txt | 2 +- test/interop/CMakeLists.txt | 1 + test/interop/dollar_topics_test.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 test/interop/dollar_topics_test.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4565556..f51fabb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,7 @@ ENDIF() TARGET_INCLUDE_DIRECTORIES(mqtt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lib ) IF(WIN32) 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 + +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(); +} -- cgit v1.2.3