Mostly empty unit tests -- added mgos_mock to be able to run unit tests on x86_64

This commit is contained in:
Pim van Pelt
2017-11-26 10:43:44 +01:00
parent efa9b1bf68
commit 705c65c6c9
13 changed files with 1854 additions and 0 deletions

30
unittest/mgos_mock.c Normal file
View File

@ -0,0 +1,30 @@
/* Some functions mocked from MGOS, so we can run unit tests standalone.
*/
#include "mgos_mock.h"
int log_print_prefix(enum cs_log_level l, const char *func, const char *file) {
char ll_str[8];
switch(l) {
case LL_ERROR:
strncpy(ll_str, "ERROR", sizeof(ll_str));
break;
case LL_WARN:
strncpy(ll_str, "WARN", sizeof(ll_str));
break;
case LL_INFO:
strncpy(ll_str, "INFO", sizeof(ll_str));
break;
case LL_DEBUG:
strncpy(ll_str, "DEBUG", sizeof(ll_str));
break;
case LL_VERBOSE_DEBUG:
strncpy(ll_str, "VERB", sizeof(ll_str));
break;
default: // LL_NONE
return 0;
}
printf ("%-5s %-10s %-15s| ", ll_str, file, func);
return 1;
}