Add unit tests for buttons / relays; and a bunch of mocks :)

This commit is contained in:
Pim van Pelt
2017-12-20 17:32:28 +01:00
parent 1cbd2130db
commit 4b4642416f
12 changed files with 6304 additions and 3 deletions

View File

@ -7,6 +7,9 @@ uint32_t mqtt_sub_count=0;
static sub_handler_t s_handler;
static void *s_handler_ud;
static mg_event_handler_t s_global_handler;
static void *s_global_handler_ud;
void mgos_mqtt_pub(char *t, char *m, int m_len, int flags, bool persist) {
LOG(LL_INFO, ("Sending topic='%s' msg='%s' persist=%s", t, m, persist?"ON":"OFF"));
mqtt_pub_count++;
@ -24,3 +27,9 @@ void mgos_mqtt_inject(char *topic, char *msg) {
if (s_handler)
s_handler(NULL, topic, strlen(topic), msg, strlen(msg), s_handler_ud);
}
void mgos_mqtt_add_global_handler(mqtt_event_handler_t handler, void *ud) {
s_global_handler = handler;
s_global_handler_ud = ud;
}