test-conf.c 688 B

12345678910111213141516171819202122232425
  1. /* vim: tabstop=4 shiftwidth=4 noexpandtab
  2. * This file is part of ToaruOS and is released under the terms
  3. * of the NCSA / University of Illinois License - see LICENSE.md
  4. * Copyright (C) 2018 K. Lange
  5. *
  6. * test-conf - simple test app for confreader
  7. */
  8. #include <assert.h>
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <toaru/confreader.h>
  12. int main(int argc, char * argv[]) {
  13. confreader_t * conf = confreader_load("/etc/demo.conf");
  14. fprintf(stderr, "test 1\n");
  15. assert(confreader_get(conf, "", "test") != NULL);
  16. assert(!strcmp(confreader_get(conf, "", "test"),"hello"));
  17. fprintf(stderr, "test 2\n");
  18. assert(!strcmp(confreader_get(conf,"sec","tion"),"test"));
  19. return 0;
  20. }