Statistics
| Branch: | Revision:

grapes / som / Tests / config_test.c @ 8ae83f37

History | View | Annotate | Download (771 Bytes)

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

    
7
#include <stdlib.h>
8
#include <stdio.h>
9
#include "../ChunkBuffer/config.h"
10

    
11
int main(int argc, char *argv[])
12
{
13
  struct tag *cfg_tags;
14
  int size, len, dummy, res;
15
  
16
  cfg_tags = config_parse("size=10");
17
  res = config_value_int(cfg_tags, "size", &size);
18
  printf("%d: Is %d = %d?\n", res, size, 10);
19
  free(cfg_tags);
20

    
21
  cfg_tags = config_parse("len=5,size=10");
22
  res = config_value_int(cfg_tags, "size", &size);
23
  res = config_value_int(cfg_tags, "len", &len);
24
  printf("%d: Is %d = %d?\n", res, size, 10);
25
  printf("%d: Is %d = %d?\n", res, len, 5);
26
  res = config_value_int(cfg_tags, "blah", &dummy);
27
  printf("%d: Is %d = ...?\n", res, dummy);
28
  free(cfg_tags);
29

    
30
  return 0;
31
}