aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_configuration.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-03-16 18:36:11 +0000
committerChristian Grothoff <christian@grothoff.org>2010-03-16 18:36:11 +0000
commitf2e9dfa6d34c5f213b4ee4d4d38c59104d37a74b (patch)
tree26290a2e537fe90c7640900a44a1ca47f3627895 /src/util/test_configuration.c
parent2b2d741c2e8115f18d89b2efbc80abc70ea70905 (diff)
downloadgnunet-f2e9dfa6d34c5f213b4ee4d4d38c59104d37a74b.tar.gz
gnunet-f2e9dfa6d34c5f213b4ee4d4d38c59104d37a74b.zip
fix
Diffstat (limited to 'src/util/test_configuration.c')
-rw-r--r--src/util/test_configuration.c89
1 files changed, 65 insertions, 24 deletions
diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c
index 7c17ecf21..992c32e6c 100644
--- a/src/util/test_configuration.c
+++ b/src/util/test_configuration.c
@@ -222,6 +222,7 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option)
222 GNUNET_DISK_mktemp ("gnunet-test-configurations-diffs.conf"); 222 GNUNET_DISK_mktemp ("gnunet-test-configurations-diffs.conf");
223 if (diffsFileName == NULL) 223 if (diffsFileName == NULL)
224 { 224 {
225 GNUNET_break (0);
225 GNUNET_CONFIGURATION_destroy (cfg); 226 GNUNET_CONFIGURATION_destroy (cfg);
226 GNUNET_CONFIGURATION_destroy (cfgDiffs); 227 GNUNET_CONFIGURATION_destroy (cfgDiffs);
227 return 1; 228 return 1;
@@ -283,26 +284,42 @@ testConfig ()
283 GNUNET_free (c); 284 GNUNET_free (c);
284 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, 285 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
285 "test", "five", &l)) 286 "test", "five", &l))
286 return 3; 287 {
288 GNUNET_break (0);
289 return 3;
290 }
287 if (5 != l) 291 if (5 != l)
288 return 4; 292 {
293 GNUNET_break (0);
294 return 4;
295 }
289 GNUNET_CONFIGURATION_set_value_string (cfg, "more", "c", "YES"); 296 GNUNET_CONFIGURATION_set_value_string (cfg, "more", "c", "YES");
290 if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_yesno (cfg, "more", "c")) 297 if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_yesno (cfg, "more", "c"))
291 return 5; 298 {
299 GNUNET_break (0);
300 return 5;
301 }
292 GNUNET_CONFIGURATION_set_value_number (cfg, "NUMBERS", "TEN", 10); 302 GNUNET_CONFIGURATION_set_value_number (cfg, "NUMBERS", "TEN", 10);
293 if (GNUNET_OK != 303 if (GNUNET_OK !=
294 GNUNET_CONFIGURATION_get_value_string (cfg, "NUMBERS", "TEN", &c)) 304 GNUNET_CONFIGURATION_get_value_string (cfg, "NUMBERS", "TEN", &c))
295 return 6; 305 {
306 GNUNET_break (0);
307 return 6;
308 }
296 if (0 != strcmp (c, "10")) 309 if (0 != strcmp (c, "10"))
297 { 310 {
298 GNUNET_free (c); 311 GNUNET_free (c);
312 GNUNET_break (0);
299 return 7; 313 return 7;
300 } 314 }
301 GNUNET_free (c); 315 GNUNET_free (c);
302 316
303 if (GNUNET_OK != 317 if (GNUNET_OK !=
304 GNUNET_CONFIGURATION_get_value_filename (cfg, "last", "test", &c)) 318 GNUNET_CONFIGURATION_get_value_filename (cfg, "last", "test", &c))
305 return 8; 319 {
320 GNUNET_break (0);
321 return 8;
322 }
306#ifndef MINGW 323#ifndef MINGW
307 if (0 != strcmp (c, "/hello/world")) 324 if (0 != strcmp (c, "/hello/world"))
308#else 325#else
@@ -310,6 +327,7 @@ testConfig ()
310 if (strstr (c, HI) != c + strlen (c) - strlen (HI)) 327 if (strstr (c, HI) != c + strlen (c) - strlen (HI))
311#endif 328#endif
312 { 329 {
330 GNUNET_break (0);
313 GNUNET_free (c); 331 GNUNET_free (c);
314 return 9; 332 return 9;
315 } 333 }
@@ -336,6 +354,7 @@ check (void *data, const char *fn)
336 (*idx)++; 354 (*idx)++;
337 return GNUNET_OK; 355 return GNUNET_OK;
338 } 356 }
357 GNUNET_break (0);
339 return GNUNET_SYSERR; 358 return GNUNET_SYSERR;
340} 359}
341 360
@@ -349,48 +368,72 @@ testConfigFilenames ()
349 "FILENAMES", 368 "FILENAMES",
350 "test", 369 "test",
351 &check, &idx)) 370 &check, &idx))
352 return 8; 371 {
372 GNUNET_break (0);
373 return 8;
374 }
353 if (idx != 3) 375 if (idx != 3)
354 return 16; 376 return 16;
355 if (GNUNET_OK != 377 if (GNUNET_OK !=
356 GNUNET_CONFIGURATION_remove_value_filename (cfg, 378 GNUNET_CONFIGURATION_remove_value_filename (cfg,
357 "FILENAMES", 379 "FILENAMES",
358 "test", "/File Name")) 380 "test", "/File Name"))
359 return 24; 381 {
382 GNUNET_break (0);
383 return 24;
384 }
360 385
361 if (GNUNET_NO != 386 if (GNUNET_NO !=
362 GNUNET_CONFIGURATION_remove_value_filename (cfg, 387 GNUNET_CONFIGURATION_remove_value_filename (cfg,
363 "FILENAMES", 388 "FILENAMES",
364 "test", "/File Name")) 389 "test", "/File Name"))
365 return 32; 390 {
391 GNUNET_break (0);
392 return 32;
393 }
366 if (GNUNET_NO != 394 if (GNUNET_NO !=
367 GNUNET_CONFIGURATION_remove_value_filename (cfg, 395 GNUNET_CONFIGURATION_remove_value_filename (cfg,
368 "FILENAMES", 396 "FILENAMES",
369 "test", "Stuff")) 397 "test", "Stuff"))
370 return 40; 398 {
399 GNUNET_break (0);
400 return 40;
401 }
371 402
372 if (GNUNET_NO != 403 if (GNUNET_NO !=
373 GNUNET_CONFIGURATION_append_value_filename (cfg, 404 GNUNET_CONFIGURATION_append_value_filename (cfg,
374 "FILENAMES", 405 "FILENAMES",
375 "test", "/Hello")) 406 "test", "/Hello"))
376 return 48; 407 {
408 GNUNET_break (0);
409 return 48;
410 }
377 if (GNUNET_NO != 411 if (GNUNET_NO !=
378 GNUNET_CONFIGURATION_append_value_filename (cfg, 412 GNUNET_CONFIGURATION_append_value_filename (cfg,
379 "FILENAMES", 413 "FILENAMES",
380 "test", "/World")) 414 "test", "/World"))
381 return 56; 415 {
416 GNUNET_break (0);
417 return 56;
418 }
382 419
383 if (GNUNET_YES != 420 if (GNUNET_YES !=
384 GNUNET_CONFIGURATION_append_value_filename (cfg, 421 GNUNET_CONFIGURATION_append_value_filename (cfg,
385 "FILENAMES", 422 "FILENAMES",
386 "test", "/File 1")) 423 "test", "/File 1"))
387 return 64; 424 {
425 GNUNET_break (0);
426 return 64;
427 }
388 428
389 if (GNUNET_YES != 429 if (GNUNET_YES !=
390 GNUNET_CONFIGURATION_append_value_filename (cfg, 430 GNUNET_CONFIGURATION_append_value_filename (cfg,
391 "FILENAMES", 431 "FILENAMES",
392 "test", "/File 2")) 432 "test", "/File 2"))
393 return 72; 433 {
434 GNUNET_break (0);
435 return 72;
436 }
394 437
395 idx = 0; 438 idx = 0;
396 want[1] = "/World"; 439 want[1] = "/World";
@@ -400,9 +443,15 @@ testConfigFilenames ()
400 "FILENAMES", 443 "FILENAMES",
401 "test", 444 "test",
402 &check, &idx)) 445 &check, &idx))
403 return 80; 446 {
447 GNUNET_break (0);
448 return 80;
449 }
404 if (idx != 4) 450 if (idx != 4)
405 return 88; 451 {
452 GNUNET_break (0);
453 return 88;
454 }
406 return 0; 455 return 0;
407} 456}
408 457
@@ -448,15 +497,7 @@ main (int argc, char *argv[])
448 &c)) 497 &c))
449 || (0 != strcmp (c, "YES"))) 498 || (0 != strcmp (c, "YES")))
450 { 499 {
451 GNUNET_CONFIGURATION_destroy (cfg); 500 GNUNET_break (0);
452 return 1;
453 }
454 GNUNET_free (c);
455 if ((GNUNET_OK !=
456 GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME",
457 &c))
458 || (0 != strcmp (c, "/var/lib/gnunet/")))
459 {
460 GNUNET_CONFIGURATION_destroy (cfg); 501 GNUNET_CONFIGURATION_destroy (cfg);
461 return 1; 502 return 1;
462 } 503 }