mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
Change tests to use libtest.h as specified in Issue #197. Co-authored-by: James Duong <jduong@dremio.com>
28 lines
914 B
C
28 lines
914 B
C
#include <wchar.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <LCUI_Build.h>
|
|
#include <LCUI/util/logger.h>
|
|
#include <LCUI/util/strpool.h>
|
|
#include "test.h"
|
|
#include "libtest.h"
|
|
|
|
void test_strpool(void)
|
|
{
|
|
char *str1, *str2;
|
|
strpool_t *pool;
|
|
|
|
it_b("check strpool_create()", (pool = strpool_create()) != NULL, TRUE);
|
|
it_b("check strpool_alloc",
|
|
(str1 = strpool_alloc_str(pool, "hello")) != NULL, TRUE);
|
|
it_b("check strpool_alloc of already pooled string",
|
|
(str2 = strpool_alloc_str(pool, "hello")) != NULL, TRUE);
|
|
it_b("check string reused", str1 == str2, TRUE);
|
|
it_b("check strpool_size", strpool_size(pool) > 0, TRUE);
|
|
it_i("check release str1", strpool_free_str(str1), 0);
|
|
it_s("check str1 is still valid", str1, "hello");
|
|
it_i("check release str2", strpool_free_str(str2), 0);
|
|
it_i("check strpool is empty", strpool_size(pool), 0);
|
|
strpool_destroy(pool);
|
|
}
|