sb: extract tests
This commit is contained in:
parent
745b93e95b
commit
eba80af2ea
19
src/bin/sb.c
19
src/bin/sb.c
|
@ -174,7 +174,7 @@ ty_sb_free(struct ty_sb *sb)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BINARY_TYTEST)
|
#if defined(BINARY_TYTEST)
|
||||||
static int
|
int
|
||||||
tytest_sb_skip(void)
|
tytest_sb_skip(void)
|
||||||
{
|
{
|
||||||
struct ty_sb sb = {};
|
struct ty_sb sb = {};
|
||||||
|
@ -229,7 +229,7 @@ tytest_sb_skip(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
tytest_sb_trim(void)
|
tytest_sb_trim(void)
|
||||||
{
|
{
|
||||||
struct ty_sb sb = {};
|
struct ty_sb sb = {};
|
||||||
|
@ -253,7 +253,7 @@ tytest_sb_trim(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
tytest_sb_gap(void)
|
tytest_sb_gap(void)
|
||||||
{
|
{
|
||||||
struct ty_sb sb = {};
|
struct ty_sb sb = {};
|
||||||
|
@ -286,7 +286,7 @@ tytest_sb_gap(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
tytest_sb_steal(void)
|
tytest_sb_steal(void)
|
||||||
{
|
{
|
||||||
struct ty_sb sb = {};
|
struct ty_sb sb = {};
|
||||||
|
@ -307,15 +307,4 @@ tytest_sb_steal(void)
|
||||||
ty_sb_free(&sb);
|
ty_sb_free(&sb);
|
||||||
return 0;
|
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
|
#endif
|
||||||
|
|
|
@ -29,7 +29,10 @@ static struct {
|
||||||
tytest_func func;
|
tytest_func func;
|
||||||
} _tytests[] = {
|
} _tytests[] = {
|
||||||
{ "dummy", tytest_dummy },
|
{ "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},
|
{ NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,9 @@ typedef int (*tytest_func)(void);
|
||||||
|
|
||||||
/* list of tests */
|
/* list of tests */
|
||||||
int tytest_dummy(void);
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue