sb: extract tests

This commit is contained in:
Boris Faure 2020-05-24 19:00:24 +02:00
parent 745b93e95b
commit eba80af2ea
Signed by untrusted user who does not match committer: borisfaure
GPG Key ID: 35C0410516166BE8
3 changed files with 12 additions and 17 deletions

View File

@ -174,7 +174,7 @@ ty_sb_free(struct ty_sb *sb)
}
#if defined(BINARY_TYTEST)
static int
int
tytest_sb_skip(void)
{
struct ty_sb sb = {};
@ -229,7 +229,7 @@ tytest_sb_skip(void)
return 0;
}
static int
int
tytest_sb_trim(void)
{
struct ty_sb sb = {};
@ -253,7 +253,7 @@ tytest_sb_trim(void)
return 0;
}
static int
int
tytest_sb_gap(void)
{
struct ty_sb sb = {};
@ -286,7 +286,7 @@ tytest_sb_gap(void)
return 0;
}
static int
int
tytest_sb_steal(void)
{
struct ty_sb sb = {};
@ -307,15 +307,4 @@ tytest_sb_steal(void)
ty_sb_free(&sb);
return 0;
}
int
tytest_sb(void)
{
assert(tytest_sb_skip() == 0);
assert(tytest_sb_trim() == 0);
assert(tytest_sb_gap() == 0);
assert(tytest_sb_steal() == 0);
return 0;
}
#endif

View File

@ -29,7 +29,10 @@ static struct {
tytest_func func;
} _tytests[] = {
{ "dummy", tytest_dummy },
{ "sb", tytest_sb},
{ "sb_skip", tytest_sb_skip},
{ "sb_trim", tytest_sb_trim},
{ "sb_gap", tytest_sb_gap},
{ "sb_steal", tytest_sb_steal},
{ NULL, NULL},
};

View File

@ -6,6 +6,9 @@ typedef int (*tytest_func)(void);
/* list of tests */
int tytest_dummy(void);
int tytest_sb(void);
int tytest_sb_skip(void);
int tytest_sb_trim(void);
int tytest_sb_gap(void);
int tytest_sb_steal(void);
#endif