Revision 8ae83f37

View differences:

som/Tests/Makefile
1 1
BASE = ../..
2
TESTS = topology_test chunk_encoding_test chunk_sending_test chunkidset_test
2
TESTS = topology_test chunk_encoding_test chunk_sending_test chunkidset_test config_test
3 3

  
4 4
CFLAGS = -Wall
5 5
CFLAGS += -Wdeclaration-after-statement
......
32 32
chunk_sending_test: ../net_helper.o
33 33
chunk_sending_test: LDLIBS += -ltrading
34 34

  
35
config_test: config_test.o ../ChunkBuffer/config.o
36

  
35 37
libtopman:
36 38
	make -C ../TopologyManager
37 39
libtrading:
som/Tests/config_test.c
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
}

Also available in: Unified diff