add focused unit and map checks

This commit is contained in:
2026-08-11 19:35:11 +09:00
parent 9dc116a035
commit 42823420ab
18 changed files with 1326 additions and 9 deletions

60
tests/ko_test.c Normal file
View File

@@ -0,0 +1,60 @@
#include "test.h"
void
korean_sequences(struct ct *t)
{
static const struct { char *keys, *want; } cases[] = {
{ "r", "" },
{ "rk", "" },
{ "rkr", "" },
{ "rkrk", "가가" },
{ "rkrtk", "각사" },
{ "rhk", "" },
{ "rr", "ㄱㄱ" },
{ "Rk", "" },
{ "rk1", "가1" },
};
Emit e;
Im state;
Str out;
Rune key;
char *p;
int i;
for(i = 0; i < nelem(cases); i++){
memset(&state, 0, sizeof state);
state.l = getlang(LangKO);
sclear(&out);
for(p = cases[i].keys; *p != '\0'; p++){
key = (uchar)*p;
e = transko(&state, key);
sappend(&out, &e.s);
state.pre = e.next;
if(!e.eat)
sputr(&out, key);
}
sappend(&out, &state.pre);
checkstr(t, cases[i].keys, cases[i].want, &out);
}
}
void
korean_backspace(struct ct *t)
{
static const struct { char *before, *after; } cases[] = {
{ "", "" },
{ "", "" },
{ "", "" },
{ "", "" },
{ "", "" },
};
Im state;
int i;
memset(&state, 0, sizeof state);
for(i = 0; i < nelem(cases); i++){
state.pre = mkstr(cases[i].before);
backko(&state);
checkstr(t, cases[i].before, cases[i].after, &state.pre);
}
}