skip to content
==> tests/build.c <==
1/* Builds and links; the behaviour is tested against the Rust in @ajax/mesh-top-golden. Here: the
2 * key bindings that need no snapshot. */
3#include "mesh/check.h"
4#include "mesh/top_app.h"
5
6#include <stdlib.h>
7
8int main(void) {
9    const char *eps[2] = {"a:1", "b:2"};
10    mt_app app;
11    mt_app_init(&app, eps, 2);
12    mt_action a = mt_app_handle_key(&app, tui_key_char(']'));
13    CHECK(a.kind == MT_ACTION_NONE && app.focus == 1);
14    a = mt_app_handle_key(&app, tui_key_char('9'));
15    CHECK(app.tab == MT_TAB_FLEET);
16    mt_action t[2];
17    CHECK_U(mt_app_tick(&app, 0, t), 1);
18    CHECK(t[0].kind == MT_ACTION_POLL && t[0].machine == 1);
19    CHECK_S(t[0].line, "view fleet");
20    mt_action_free(&t[0]);
21    CHECK_U(mt_app_tick(&app, MT_MS(500), t), 0);
22    tui_key c = tui_key_char('c');
23    c.mods = TUI_MOD_CONTROL;
24    CHECK(mt_app_handle_key(&app, c).kind == MT_ACTION_QUIT);
25    mt_app_free(&app);
26    return mesh_check_done();
27}