2012-02-14 00:40:42 +01:00
|
|
|
#include <stdio.h>
|
2014-10-14 00:24:47 +02:00
|
|
|
#include "../termo.h"
|
2012-02-14 00:40:42 +01:00
|
|
|
#include "taplib.h"
|
|
|
|
|
2021-10-30 02:53:18 +02:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2012-02-14 00:40:42 +01:00
|
|
|
{
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_t *tk;
|
|
|
|
termo_key_t key;
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-09-28 05:56:13 +02:00
|
|
|
plan_tests (9);
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
tk = termo_new_abstract ("vt100", NULL, 0);
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_get_buffer_remaining (tk), 256,
|
2014-09-28 05:56:13 +02:00
|
|
|
"buffer free initially 256");
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_get_buffer_size (tk), 256,
|
2014-09-28 05:56:13 +02:00
|
|
|
"buffer size initially 256");
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_push_bytes (tk, "h", 1), 1, "push_bytes returns 1");
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_get_buffer_remaining (tk), 255,
|
2014-09-28 05:56:13 +02:00
|
|
|
"buffer free 255 after push_bytes");
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_get_buffer_size (tk), 256,
|
2014-09-28 05:56:13 +02:00
|
|
|
"buffer size 256 after push_bytes");
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
ok (!!termo_set_buffer_size (tk, 512), "buffer set size OK");
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_get_buffer_remaining (tk), 511,
|
2014-09-28 05:56:13 +02:00
|
|
|
"buffer free 511 after push_bytes");
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_get_buffer_size (tk), 512,
|
2014-09-28 05:56:13 +02:00
|
|
|
"buffer size 512 after push_bytes");
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
|
2014-09-28 05:56:13 +02:00
|
|
|
"buffered key still useable after resize");
|
2012-02-14 00:40:42 +01:00
|
|
|
|
2014-10-14 00:24:47 +02:00
|
|
|
termo_destroy (tk);
|
2014-09-28 05:56:13 +02:00
|
|
|
return exit_status ();
|
2012-02-14 00:40:42 +01:00
|
|
|
}
|