|
1 | 1 | #include "test_module.h" |
2 | 2 | #include <module/module.h> |
| 3 | +#include <module/modules.h> |
3 | 4 | #include <unistd.h> |
4 | 5 | #include <sys/stat.h> |
5 | 6 | #include <fcntl.h> |
@@ -352,7 +353,7 @@ void test_module_tell_wrong_size(void **state) { |
352 | 353 | void test_module_tell(void **state) { |
353 | 354 | (void) state; /* unused */ |
354 | 355 |
|
355 | | - module_ret_code ret = module_tell(self, testSelf, "hi!", strlen("hi!")); |
| 356 | + module_ret_code ret = module_tell(self, testSelf, "hi1!", strlen("hi!")); |
356 | 357 | assert_true(ret == MOD_OK); |
357 | 358 | } |
358 | 359 |
|
@@ -394,7 +395,7 @@ void test_module_publish_wrong_size(void **state) { |
394 | 395 | void test_module_publish(void **state) { |
395 | 396 | (void) state; /* unused */ |
396 | 397 |
|
397 | | - module_ret_code ret = module_publish(self, "topic", "hi!", strlen("hi!")); |
| 398 | + module_ret_code ret = module_publish(self, "topic", "hi2!", strlen("hi!")); |
398 | 399 | assert_true(ret == MOD_OK); |
399 | 400 | } |
400 | 401 |
|
@@ -422,7 +423,7 @@ void test_module_broadcast_wrong_size(void **state) { |
422 | 423 | void test_module_broadcast(void **state) { |
423 | 424 | (void) state; /* unused */ |
424 | 425 |
|
425 | | - module_ret_code ret = module_broadcast(self, "hi!", strlen("hi!")); |
| 426 | + module_ret_code ret = module_broadcast(self, "hi3!", strlen("hi!")); |
426 | 427 | assert_true(ret == MOD_OK); |
427 | 428 | } |
428 | 429 |
|
@@ -479,7 +480,13 @@ static bool evaluate(void) { |
479 | 480 | } |
480 | 481 |
|
481 | 482 | static void recv(const msg_t *msg, const void *userdata) { |
482 | | - |
| 483 | + static int ctr = 0; |
| 484 | + if (msg->is_pubsub && msg->pubsub_msg->type == USER) { |
| 485 | + ctr++; |
| 486 | + if (!strcmp((char *)msg->pubsub_msg->message, "hi3!")) { |
| 487 | + modules_ctx_quit(CTX, ctr); |
| 488 | + } |
| 489 | + } |
483 | 490 | } |
484 | 491 |
|
485 | 492 | static void destroy(void) { |
|
0 commit comments