Statistics
| Branch: | Revision:

grapes / som / Tests / chunkidset_test_bug.c @ 438e6c03

History | View | Annotate | Download (1.02 KB)

1
/*
2
 *  Copyright (c) 2009 Luca Abeni
3
 *
4
 *  This is free software; see gpl-3.0.txt
5
 */
6

    
7
#include <inttypes.h>
8
#include <stdint.h>
9
#include <stdlib.h>
10
#include <stdio.h>
11
#include <string.h>
12

    
13
#include "chunkidset.h"
14

    
15
#include "chunkid_set_h.h"
16

    
17
static void display_cset(struct chunkID_set *cset)
18
{
19
  printf("Chunk ID Set initialised: size is %d\n", chunkID_set_size(cset));
20
  printChunkID_set(cset);
21
  printf("Earliest chunk %"PRIu32"\n", chunkID_set_get_earliest(cset));
22
  check_chunk(cset, 0);
23
  printf("Latest chunk %"PRIu32"\n", chunkID_set_get_latest(cset));
24
  check_chunk(cset, 0);
25
}
26

    
27
static void simple_test(void)
28
{
29
  struct chunkID_set *cset;
30
  char config[32];
31

    
32
  sprintf(config, "size=%d", 10);
33
  cset = chunkID_set_init(config);
34
  if(!cset) {
35
    fprintf(stderr, "Unable to allocate memory for rcset\n");
36

    
37
    return;
38
  }
39

    
40
  display_cset(cset);
41
  chunkID_set_add_chunk(cset, 7);
42
  chunkID_set_add_chunk(cset, 2);
43
  display_cset(cset);
44

    
45
  chunkID_set_free(cset);
46
}
47

    
48
int main(int argc, char *argv[])
49
{
50
  simple_test();
51

    
52
  return 0;
53
}