Revision 4263e0cf

View differences:

som/Tests/chunkidset_test.c
7 7
#include <stdint.h>
8 8
#include <stdlib.h>
9 9
#include <stdio.h>
10
#include <string.h>
10 11
#include "chunkidset.h"
11 12
#include "trade_sig_la.h"
12 13

  
......
90 91
  free(cset1);
91 92
}
92 93

  
94
static void metadata_test(void)
95
{
96
  struct chunkID_set *cset;
97
  static uint8_t buff[2048];
98
  int res, meta_len;
99
  void *meta;
100

  
101
  meta = strdup("This is a test");
102
  res = encodeChunkSignaling(NULL, meta, strlen(meta) + 1, buff, sizeof(buff));
103
  printf("Encoding Result: %d\n", res);
104
  free(meta);
105
  
106
  cset = decodeChunkSignaling(&meta, &meta_len, buff, res);
107
  printf("Decoded MetaData: %s (%d)\n", (char *)meta, meta_len);
108

  
109
  if (cset) {
110
    chunkID_set_clear(cset, 0);
111
    free(cset);
112
  }
113

  
114
  free(meta);
115
}
116

  
93 117
int main(int argc, char *argv[])
94 118
{
95 119
  simple_test();
96 120
  encoding_test(priority);
97 121
  encoding_test(bitmap);
122
  metadata_test();
98 123

  
99 124
  return 0;
100 125
}

Also available in: Unified diff