File: test_blocklen.c

package info (click to toggle)
burp 3.1.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,684 kB
  • sloc: ansic: 50,989; sh: 3,612; cpp: 2,859; makefile: 868
file content (51 lines) | stat: -rw-r--r-- 874 bytes parent folder | download | duplicates (3)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "../test.h"
#include "../../src/server/blocklen.h"

struct end_data
{
	const char *endfile;
	size_t ret_expected;
};

static struct end_data in[] = {
	{ "0", 64 },
	{ "1024", 64 },
	{ "2048", 64 },
	{ "4096", 64 },
	{ "8192", 96 },
	{ "16384", 128 },
	{ "32768", 192 },
	{ "65536", 256 },
	{ "131072", 368 },
	{ "55555555", 7456 },
	{ "555555555", 23584 },
	{ "5555555555", 74544 },
	{ "55555555555", 131072 },
	{ "555555555555", 131072 },
};

START_TEST(test_get_librsync_block_len)
{
	FOREACH(in)
	{
		size_t result=get_librsync_block_len(in[i].endfile);
		fail_unless(result==in[i].ret_expected);
	}
	alloc_check();
}
END_TEST

Suite *suite_server_blocklen(void)
{
	Suite *s;
	TCase *tc_core;

	s=suite_create("server_blocklen");

	tc_core=tcase_create("Core");

	tcase_add_test(tc_core, test_get_librsync_block_len);
	suite_add_tcase(s, tc_core);

	return s;
}