Added a termkey_is_started() accessor; unit test it a bit
This commit is contained in:
parent
43a83e6e96
commit
cb00476f09
11
t/01base.c
11
t/01base.c
|
@ -6,13 +6,22 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
TermKey *tk;
|
TermKey *tk;
|
||||||
|
|
||||||
plan_tests(3);
|
plan_tests(6);
|
||||||
|
|
||||||
tk = termkey_new_abstract("vt100", 0);
|
tk = termkey_new_abstract("vt100", 0);
|
||||||
|
|
||||||
ok(!!tk, "termkey_new_abstract");
|
ok(!!tk, "termkey_new_abstract");
|
||||||
|
|
||||||
is_int(termkey_get_buffer_size(tk), 256, "termkey_get_buffer_size");
|
is_int(termkey_get_buffer_size(tk), 256, "termkey_get_buffer_size");
|
||||||
|
ok(termkey_is_started(tk), "termkey_is_started true after construction");
|
||||||
|
|
||||||
|
termkey_stop(tk);
|
||||||
|
|
||||||
|
ok(!termkey_is_started(tk), "termkey_is_started false after termkey_stop()");
|
||||||
|
|
||||||
|
termkey_start(tk);
|
||||||
|
|
||||||
|
ok(termkey_is_started(tk), "termkey_is_started true after termkey_start()");
|
||||||
|
|
||||||
termkey_destroy(tk);
|
termkey_destroy(tk);
|
||||||
|
|
||||||
|
|
|
@ -446,6 +446,11 @@ int termkey_stop(TermKey *tk)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int termkey_is_started(TermKey *tk)
|
||||||
|
{
|
||||||
|
return tk->is_started;
|
||||||
|
}
|
||||||
|
|
||||||
int termkey_get_fd(TermKey *tk)
|
int termkey_get_fd(TermKey *tk)
|
||||||
{
|
{
|
||||||
return tk->fd;
|
return tk->fd;
|
||||||
|
|
|
@ -163,6 +163,7 @@ void termkey_destroy(TermKey *tk);
|
||||||
|
|
||||||
int termkey_start(TermKey *tk);
|
int termkey_start(TermKey *tk);
|
||||||
int termkey_stop(TermKey *tk);
|
int termkey_stop(TermKey *tk);
|
||||||
|
int termkey_is_started(TermKey *tk);
|
||||||
|
|
||||||
int termkey_get_fd(TermKey *tk);
|
int termkey_get_fd(TermKey *tk);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue