MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_CircularBuffer_free

Function test_CircularBuffer_free

tests/unit/test_circular_buffer.c:120–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void test_CircularBuffer_free(void) {
121 //--------------------------------------------------------------------------
122 // fill a buffer of size 16 with int *
123 //--------------------------------------------------------------------------
124
125 uint cap = 16;
126 CircularBuffer buff = CircularBuffer_New(sizeof(int64_t *), cap);
127 for(int i = 0; i < cap; i++) {
128 int64_t *j = malloc(sizeof(int64_t));
129 CircularBuffer_Add(buff, (void*)&j);
130 }
131
132 //--------------------------------------------------------------------------
133 // free the buffer
134 //--------------------------------------------------------------------------
135
136 for(int i = 0; i < cap; i++) {
137 int64_t *item;
138 CircularBuffer_Read(buff, &item);
139 free(item);
140 }
141
142 CircularBuffer_Free(buff);
143}
144
145void test_CircularBuffer_Reserve(void) {
146

Callers

nothing calls this directly

Calls 4

CircularBuffer_NewFunction · 0.85
CircularBuffer_AddFunction · 0.85
CircularBuffer_ReadFunction · 0.85
CircularBuffer_FreeFunction · 0.85

Tested by

no test coverage detected