1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

tests: added some more unit tests

This commit is contained in:
Steffen Vogel 2018-08-13 15:23:14 +02:00
parent fa9e239816
commit b938c939cd
2 changed files with 25 additions and 0 deletions

View file

@ -87,4 +87,16 @@ Test(kernel, module, .disabled = true)
cr_assert_neq(ret, 0);
}
Test(kernel, frequency)
{
int ret;
uint64_t freq;
ret = kernel_get_cpu_frequency(&freq);
cr_assert_eq(ret, 0);
/* Check for plausability only */
cr_assert(freq > 1e9 && freq < 5e9);
}
#endif /* __linux__ */

View file

@ -129,6 +129,19 @@ Test(utils, is_pow2)
cr_assert(!IS_POW2(-1));
}
Test(utils, strf)
{
char *buf = NULL;
buf = strf("Hallo %s", "Steffen.");
cr_assert_str_eq(buf, "Hallo Steffen.");
strcatf(&buf, " Its Monday %uth %s %u.", 13, "August", 2018);
cr_assert_str_eq(buf, "Hallo Steffen. Its Monday 13th August 2018.");
free(buf);
}
struct version_param {
const char *v1, *v2;
int result;