feat: create firmware skeleton and reproducible build
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#include "maze32_health.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
maze32_health_t health;
|
||||
maze32_health_init(&health, "test-version");
|
||||
|
||||
assert(strcmp(health.version, "test-version") == 0);
|
||||
assert(health.state == MAZE32_HEALTH_BOOTING);
|
||||
assert(strcmp(maze32_health_state_name(health.state), "booting") == 0);
|
||||
assert(maze32_health_is_healthy(&health) == 0);
|
||||
|
||||
maze32_health_set(&health, MAZE32_HEALTH_FILESYSTEM_READY, 0);
|
||||
assert(strcmp(maze32_health_state_name(health.state), "filesystem_ready") == 0);
|
||||
assert(maze32_health_is_healthy(&health) == 0);
|
||||
|
||||
maze32_health_set(&health, MAZE32_HEALTH_SERVING, 0);
|
||||
assert(strcmp(maze32_health_state_name(health.state), "serving") == 0);
|
||||
assert(maze32_health_is_healthy(&health) == 1);
|
||||
|
||||
maze32_health_set(&health, MAZE32_HEALTH_ERROR, 17);
|
||||
assert(strcmp(maze32_health_state_name(health.state), "error") == 0);
|
||||
assert(health.error_code == 17);
|
||||
assert(maze32_health_is_healthy(&health) == 0);
|
||||
assert(strcmp(maze32_health_state_name((maze32_health_state_t)99), "unknown") == 0);
|
||||
|
||||
printf("health state tests: PASS\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user