4 #include "lwip/stats.h"
6 #if !LWIP_STATS || !MEM_STATS
7 #error "This tests needs MEM-statistics enabled"
10 #error "This test needs DNS turned off (as it mallocs on init)"
13 /* Setups/teardown functions */
28 /** Call mem_malloc, mem_free and mem_trim and check stats */
29 START_TEST(test_mem_one)
39 fail("This test needs DNS turned off (as it mallocs on init)");
42 fail_unless(lwip_stats.mem.used == 0);
44 p1 = mem_malloc(SIZE1);
45 fail_unless(p1 != NULL);
46 fail_unless(lwip_stats.mem.used >= SIZE1);
47 s1 = lwip_stats.mem.used;
49 p2 = mem_malloc(SIZE2);
50 fail_unless(p2 != NULL);
51 fail_unless(lwip_stats.mem.used >= SIZE2 + s1);
52 s2 = lwip_stats.mem.used;
54 mem_trim(p1, SIZE1_2);
57 fail_unless(lwip_stats.mem.used <= s2 - SIZE2);
60 fail_unless(lwip_stats.mem.used == 0);
65 /** Create the suite including all tests for this module */
72 return create_suite("MEM", tests, sizeof(tests)/sizeof(TFun), mem_setup, mem_teardown);