aboutsummaryrefslogtreecommitdiffstats
path: root/test/rspamd_mem_pool_test.c
blob: 5b2bf3721d068627eb8db0b948304f67b4e1a013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "../mem_pool.h"
#include "tests.h"

#include <stdio.h>
#include <glib.h>

#define TEST_BUF "test bufffer"
#define TEST2_BUF "test bufffertest bufffer"

void
rspamd_mem_pool_test_func ()
{
	memory_pool_t *pool;
	char *tmp, *tmp2;

	pool = memory_pool_new (sizeof (TEST_BUF));
	tmp = memory_pool_alloc (pool, sizeof (TEST_BUF));
	tmp2 = memory_pool_alloc (pool, sizeof (TEST_BUF) * 2);

	snprintf (tmp, sizeof (TEST_BUF), "%s", TEST_BUF);
	snprintf (tmp2, sizeof (TEST_BUF) * 2, "%s", TEST2_BUF);

	g_assert (strncmp (tmp, TEST_BUF, sizeof (TEST_BUF)) == 0);
	g_assert (strncmp (tmp2, TEST2_BUF, sizeof (TEST2_BUF)) == 0);
	
	memory_pool_delete (pool);
}