summaryrefslogtreecommitdiff
path: root/tests/piece-table-insert.c
blob: 90a97a2203c3e44a1174cf49d3273099b642165f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <string.h>
#include "../src/piece-table.h"

int
main()
{
  piece_table *pt = piece_table_create("1234567890");
  piece_table_insert(pt, 10, "abcdefgh", 8);
  piece_table_insert(pt, 18, "abcdefgh", 8);
  if (strcmp(piece_table_to_string(pt), "1234567890abcdefghabcdefgh"))
    return 1;
  /* TODO: must have two pieces if optimized properly
     1234567890
     abcdefghabcdefgh

     TODO: check other things too */
  piece_table_destroy(pt);
  return 0;
}