test_buffer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_BUFFER_H_
  23. #define _TEST_BUFFER_H_
  24. void test_buffer()
  25. {
  26. tsk_buffer_t *buffer = tsk_buffer_create_null();
  27. tsk_buffer_append(buffer, "Diop", strlen("Diop"));
  28. tsk_buffer_append(buffer, " ", strlen(" "));
  29. tsk_buffer_append(buffer, "Mamadou", strlen("Mamadou"));
  30. tsk_buffer_append(buffer, "\r\n", strlen("\r\n"));
  31. printf("1. Buffer=%s", TSK_BUFFER_TO_STRING(buffer));
  32. tsk_buffer_append_2(buffer, "val1=[%s] and val2=[%d]r\n", "value1", 12);
  33. tsk_buffer_append_2(buffer, "val3=[%s] and val4=[%s]r\n", "458888554778555LL", "1254852");
  34. printf("2. Buffer=%s", TSK_BUFFER_TO_STRING(buffer));
  35. TSK_OBJECT_SAFE_FREE(buffer);
  36. }
  37. #endif /* _TEST_BUFFER_H_ */