Skip to content

Commit

Permalink
PROBLEM: test publishes to one topic only
Browse files Browse the repository at this point in the history
SOLUTION: Alternate and check

Signed-off-by: Karol Hrdina <[email protected]>
  • Loading branch information
karolhrdina committed Feb 13, 2017
1 parent c5f9eb3 commit 1a6108a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/zmosq_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ zmosq_server_test (bool verbose)
int i = 0;

for (i = 0; i < 20; i++) {
zstr_sendx (zmosq_pub, "PUBLISH", "TOPIC", "0", "false", "HELLO, FRAME", NULL);
zstr_sendx (zmosq_pub, "PUBLISH", (i % 2 == 0) ? "TOPIC" : "TEST", "0", "false", "HELLO, FRAME", NULL);
}
zclock_sleep (500);

Expand All @@ -485,7 +485,10 @@ zmosq_server_test (bool verbose)
char *topic, *body;
topic = zmsg_popstr (msg);
body = zmsg_popstr (msg);
assert (streq (topic, "TOPIC"));
if (i % 2 == 0)
assert (streq (topic, "TOPIC"));
else
assert (streq (topic, "TEST"));
assert (streq (body, "HELLO, FRAME"));
zstr_free (&topic);
zstr_free (&body);
Expand Down

0 comments on commit 1a6108a

Please sign in to comment.