test_params.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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_PARAMS_H_
  23. #define _TEST_PARAMS_H_
  24. void test_params()
  25. {
  26. tsk_buffer_t *buffer = tsk_buffer_create_null();
  27. tsk_params_L_t *params = tsk_list_create();
  28. //
  29. //
  30. //
  31. tsk_param_t *param1 = tsk_params_parse_param("mamadou=diop", strlen("mamadou=diop"));
  32. tsk_param_t *param2 = tsk_params_parse_param("project=doubango", strlen("project=doubango"));
  33. tsk_param_t *param3 = tsk_params_parse_param("license=gpl", strlen("license=gpl"));
  34. tsk_list_push_back_data(params, (void**)&param1);
  35. tsk_list_push_back_data(params, (void**)&param2);
  36. tsk_list_push_back_data(params, (void**)&param3);
  37. tsk_params_tostring(params, ',', buffer);
  38. TSK_DEBUG_INFO("Buffer=[%s]", TSK_BUFFER_TO_STRING(buffer));
  39. tsk_buffer_cleanup(buffer);
  40. TSK_OBJECT_SAFE_FREE(params);
  41. //
  42. //
  43. //
  44. params = tsk_params_fromstring("octet-align=1; mode-set=0,1,2,3,4,5,6,7; mode-change-period=1; mode-change-capability=2; mode-change-neighbor=0", ';', tsk_true);
  45. tsk_params_tostring(params, ';', buffer);
  46. TSK_DEBUG_INFO("Buffer=[%s]", TSK_BUFFER_TO_STRING(buffer));
  47. tsk_buffer_cleanup(buffer);
  48. TSK_OBJECT_SAFE_FREE(params);
  49. params = tsk_params_fromstring("QCIF=1;CIF=2;MaxBR=4200", ';', tsk_true);
  50. tsk_params_tostring(params, ';', buffer);
  51. TSK_DEBUG_INFO("Buffer=[%s]", TSK_BUFFER_TO_STRING(buffer));
  52. tsk_buffer_cleanup(buffer);
  53. TSK_OBJECT_SAFE_FREE(params);
  54. TSK_OBJECT_SAFE_FREE(buffer);
  55. }
  56. #endif /*_TEST_PARAMS_H_ */