#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include "cmocka.h"
#include "blink_pool.h"
#include <string.h>
static int setup_pool(void **user)
{
static uint8_t heap[128U];
return 0;
}
static void test_BLINK_Pool_init(void **user)
{
}
static void test_BLINK_Pool_calloc_zeroSize(void **user)
{
assert_true(ptr == NULL);
}
static void test_BLINK_Pool_calloc_all(void **user)
{
assert_true(first != NULL);
assert_true(second == NULL);
}
static void test_BLINK_Pool_calloc_multi(void **user)
{
assert_true(first != NULL);
assert_true(((long)first % sizeof(long)) == 0);
assert_true(second != NULL);
assert_true(((long)second % sizeof(long)) == 0);
assert_ptr_not_equal(first, second);
assert_true(third != NULL);
assert_true(((long)third % sizeof(long)) == 0);
assert_ptr_not_equal(first, third);
assert_ptr_not_equal(second, third);
}
static void test_BLINK_Pool_getFreeSpace(void **user)
{
assert_true(allSpace > 0);
}
int main(void)
{
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_BLINK_Pool_init),
cmocka_unit_test_setup(test_BLINK_Pool_calloc_all, setup_pool),
cmocka_unit_test_setup(test_BLINK_Pool_calloc_zeroSize, setup_pool),
cmocka_unit_test_setup(test_BLINK_Pool_calloc_multi, setup_pool),
cmocka_unit_test_setup(test_BLINK_Pool_getFreeSpace, setup_pool),
};
return cmocka_run_group_tests(tests, NULL, NULL);
}