Files
mars-nwe/tests/tui/test_nwtui.c
Mario Fetka 9c54b4b6cf
All checks were successful
Source release / source-package (push) Successful in 1m30s
0458 test: add core ini log and nwtui unit tests
2026-06-13 09:38:07 +02:00

28 lines
870 B
C

#include "nwtui.h"
#include <stdio.h>
#include <string.h>
#define CHECK(expr) \
do { \
if (!(expr)) { \
fprintf(stderr, "CHECK failed at %s:%d: %s\n", __FILE__, __LINE__, #expr); \
return 1; \
} \
} while (0)
int main(void)
{
CHECK(strcmp(nwtui_style_name(NWTUI_STYLE_NORMAL), "normal") == 0);
CHECK(strcmp(nwtui_style_name(NWTUI_STYLE_HEADER), "header") == 0);
CHECK(strcmp(nwtui_style_name(NWTUI_STYLE_MENU_SELECTED), "menu-selected") == 0);
CHECK(strcmp(nwtui_style_name(NWTUI_STYLE_STATUS), "status") == 0);
CHECK(strcmp(nwtui_style_name(NWTUI_STYLE_ERROR), "error") == 0);
CHECK(strcmp(nwtui_style_name((NwTuiStyle)999), "unknown") == 0);
/* These calls must be harmless before terminal initialization. */
nwtui_puts(0, 0, NWTUI_STYLE_NORMAL, NULL);
nwtui_box(0, 0, 1, 1, NWTUI_STYLE_PANEL, "too-small");
return 0;
}