Advertisement
Guest User

utils.c

a guest
May 30th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. /*
  2.  * utils.c
  3.  *
  4.  *  Created on: 30 May 2015
  5.  *      Author: supermaja
  6.  */
  7.  
  8.  
  9. #include <stdio.h>
  10. #include <stdarg.h>
  11. #include <setjmp.h>
  12. #include <wctype.h>
  13. #include <wchar.h>
  14. #include <string.h>
  15. #include "cmocka.h"
  16.  
  17. int example_test_fprintf(FILE* const file, const char *format, ...) CMOCKA_PRINTF_ATTRIBUTE(2, 3);
  18. //int example_test_printf(const char *format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
  19.  
  20. static char temporary_buffer[256];
  21.  
  22. /* A mock fprintf function that checks the value of strings printed to the
  23.  * standard error stream. */
  24. int example_test_fprintf(FILE* const file, const char *format, ...) {
  25.     int return_value;
  26.     va_list args;
  27.     assert_true(file == stderr);
  28.     va_start(args, format);
  29. //    assert_true(1 == 0);
  30.     return_value = vsnprintf(temporary_buffer, sizeof(temporary_buffer), format, args);
  31.     printf("%d", return_value);
  32.     check_expected_ptr(temporary_buffer);
  33. //    check_expected_ptr(temporary_buffer);
  34.     va_end(args);
  35.     memset(temporary_buffer, 0, 256);
  36.     return return_value;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement