2 * Copyright (C) 2012 Reto Buerki
3 * Copyright (C) 2012 Adrian-Ken Rueegsegger
4 * Hochschule fuer Technik Rapperswil
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 #include "tkm_chunk_map.h"
21 START_TEST(test_chunk_map_creation
)
23 tkm_chunk_map_t
*map
= NULL
;
25 map
= tkm_chunk_map_create();
26 fail_if(map
== NULL
, "Error creating chunk map");
32 START_TEST(test_chunk_map_handling
)
34 tkm_chunk_map_t
*map
= NULL
;
36 chunk_t data
= chunk_from_thing(ref
);
38 map
= tkm_chunk_map_create();
39 fail_if(map
== NULL
, "Error creating chunk map");
41 map
->insert(map
, &data
, 24);
42 fail_if(map
->get_id(map
, &data
) != 24, "Id mismatch");
44 fail_unless(map
->remove(map
, &data
), "Unable to remove mapping");
45 fail_unless(!map
->get_id(map
, &data
), "Error removing mapping");
51 TCase
*make_chunk_map_tests(void)
53 TCase
*tc
= tcase_create("Chunk map tests");
54 tcase_add_test(tc
, test_chunk_map_creation
);
55 tcase_add_test(tc
, test_chunk_map_handling
);