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
|
#include <string.h>
#include <stdlib.h>
#include "../src/piece-table.h"
int
main()
{
piece_table *pt = piece_table_create_from("0123456789", 10);
char tmp[100];
piece_table_insert(pt, 10, "abcdefgh", 8);
piece_table_to_string(pt, tmp, 99);
if (strcmp(tmp, "0123456789abcdefgh"))
return 1;
piece_table_insert(pt, 18, "abcdefgh", 8);
piece_table_to_string(pt, tmp, 99);
if (strcmp(tmp, "0123456789abcdefghabcdefgh"))
return 2;
piece_table_insert(pt, 4, "abcdefgh", 8);
piece_table_to_string(pt, tmp, 99);
if (strcmp(tmp, "0123abcdefgh456789abcdefghabcdefgh"))
return 3;
piece_table_destroy(pt);
return 0;
}
|