test_options.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2009 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. #ifndef _TEST_OPTIONS_H_
  23. #define _TEST_OPTIONS_H_
  24. typedef enum options_e {
  25. o_project,
  26. o_license,
  27. o_contact,
  28. o_version,
  29. o_date
  30. }
  31. options_t;
  32. void test_options()
  33. {
  34. tsk_options_L_t *options = tsk_list_create();
  35. tsk_bool_t b;
  36. int i;
  37. const char* string;
  38. const tsk_option_t* o;
  39. tsk_options_add_option(&options, o_project, "doubango");
  40. tsk_options_add_option(&options, o_project, "doubangooo");
  41. tsk_options_add_option(&options, o_license, "GPLv3");
  42. tsk_options_add_option(&options, o_contact, "Mamadou Diop <diopmamadou(at)doubango.org>");
  43. tsk_options_add_option(&options, o_version, "10");
  44. b = tsk_options_have_option(options, o_project);
  45. b = tsk_options_have_option(options, o_date);
  46. tsk_options_remove_option(options, o_project);
  47. b = tsk_options_have_option(options, o_project);
  48. i = tsk_options_get_option_value_as_int(options, o_version);
  49. string = tsk_options_get_option_value(options, o_version);
  50. o = tsk_options_get_option_by_id(options, o_contact);
  51. TSK_OBJECT_SAFE_FREE(options);
  52. }
  53. #endif /*_TEST_OPTIONS_H_ */