zpp
Zephyr C++20 Framework
main.cpp File Reference
#include <zephyr/ztest.h>
#include <zephyr/kernel.h>
#include <zpp/mem_slab.hpp>
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

 ZTEST_SUITE (zpp_mem_slab_tests, NULL, NULL, NULL, NULL, NULL)
 
 ZTEST (zpp_mem_slab_tests, test_mem_slab)
 

Function Documentation

◆ ZTEST()

ZTEST ( zpp_mem_slab_tests  ,
test_mem_slab   
)

Definition at line 22 of file main.cpp.

23 {
24  const auto total = g_mem_slab.total_block_count();
25 
26  zassert_equal(g_mem_slab.free_block_count(), total, "");
27  zassert_equal(g_mem_slab.used_block_count(), 0, "");
28 
29  auto p = g_mem_slab.allocate();
30 
31  zassert_not_null(p, "");
32 
33  zassert_equal(g_mem_slab.free_block_count(), total - 1, "");
34  zassert_equal(g_mem_slab.used_block_count(), 1, "");
35 
36  g_mem_slab.deallocate(p);
37 
38  zassert_equal(g_mem_slab.free_block_count(), total, "");
39  zassert_equal(g_mem_slab.used_block_count(), 0, "");
40 }

◆ ZTEST_SUITE()

ZTEST_SUITE ( zpp_mem_slab_tests  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
NULL   
)