35 lines
965 B
C
35 lines
965 B
C
#pragma once
|
|
#include "mgos.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
extern uint32_t s_test_count_fail, s_test_count_total;
|
|
|
|
#define ASSERT(expr, msg) \
|
|
do { \
|
|
s_test_count_total++; \
|
|
if (!(expr)) { \
|
|
LOG(LL_ERROR, ("TEST FAILURE line=%d expr='%s' msg='%s'", __LINE__, #expr, msg)); \
|
|
s_test_count_fail++; \
|
|
} else { \
|
|
LOG(LL_INFO, ("TEST PASS line=%d expr='%s' msg='%s'", __LINE__, #expr, msg)); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define RUN_TEST(test) \
|
|
do { \
|
|
const char *msg = test(); \
|
|
if (msg) { return msg; } \
|
|
} while (0)
|
|
|
|
void test_init();
|
|
uint32_t test_count_total();
|
|
uint32_t test_count_success();
|
|
uint32_t test_count_fail();
|
|
|
|
// Insert test methods here
|
|
void test_buttons();
|
|
void test_timespec();
|