rlc: Add a simple test for the RLC data structure for the init

This commit is contained in:
Holger Hans Peter Freyther 2013-11-21 21:42:20 +01:00
parent 6058220d2a
commit c6382ddd6e
2 changed files with 16 additions and 1 deletions

View File

@ -90,7 +90,7 @@ struct gprs_rlc_data {
/* block history */
uint8_t block[RLC_MAX_LEN];
/* block len of history */
/* block len of history */
uint8_t len;
};

View File

@ -75,10 +75,25 @@ static void test_llc(void)
}
}
static void test_rlc()
{
{
struct gprs_rlc_data rlc = { 0, };
memset(rlc.block, 0x23, RLC_MAX_LEN);
uint8_t *p = rlc.prepare(20);
OSMO_ASSERT(p == rlc.block);
for (int i = 0; i < 20; ++i)
OSMO_ASSERT(p[i] == 0x2B);
for (int i = 20; i < RLC_MAX_LEN; ++i)
OSMO_ASSERT(p[i] == 0x0);
}
}
int main(int argc, char **argv)
{
printf("Making some basic type testing.\n");
test_llc();
test_rlc();
return EXIT_SUCCESS;
}