test_buffer: add kmscon_symbol_t test
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
39f90a4536
commit
b3ce42bc63
@ -39,6 +39,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "log.h"
|
||||
#include "unicode.h"
|
||||
|
||||
/* print buffer with boundary */
|
||||
static void print_buf(struct kmscon_buffer *buf)
|
||||
@ -112,6 +113,38 @@ static void test1(struct kmscon_buffer *buf)
|
||||
kmscon_char_free(ch);
|
||||
}
|
||||
|
||||
static void test2()
|
||||
{
|
||||
struct kmscon_symbol_table *st;
|
||||
int ret;
|
||||
kmscon_symbol_t sym, sym2, sym3, sym4;
|
||||
const uint32_t *str;
|
||||
size_t len, i;
|
||||
|
||||
log_info("Test2:\n");
|
||||
|
||||
ret = kmscon_symbol_table_new(&st);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
sym = kmscon_symbol_make('a');
|
||||
sym2 = kmscon_symbol_append(st, sym, '^');
|
||||
sym3 = kmscon_symbol_append(st, sym2, '^');
|
||||
sym4 = kmscon_symbol_append(st, sym, '^');
|
||||
|
||||
log_info("equality: %i %i %i\n", sym == sym2, sym2 == sym4,
|
||||
sym3 == sym2);
|
||||
|
||||
str = kmscon_symbol_get(st, &sym3, &len);
|
||||
|
||||
printf("sym3: ");
|
||||
for (i = 0; i < len; ++i)
|
||||
printf("%c", str[i]);
|
||||
printf("\n");
|
||||
|
||||
kmscon_symbol_table_unref(st);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct kmscon_buffer *buf;
|
||||
@ -124,6 +157,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
test1(buf);
|
||||
test2();
|
||||
|
||||
kmscon_buffer_unref(buf);
|
||||
err_out:
|
||||
|
Loading…
x
Reference in New Issue
Block a user