Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * utils.c
- *
- * Created on: 30 May 2015
- * Author: supermaja
- */
- #include <stdio.h>
- #include <stdarg.h>
- #include <setjmp.h>
- #include <wctype.h>
- #include <wchar.h>
- #include <string.h>
- #include "cmocka.h"
- int example_test_fprintf(FILE* const file, const char *format, ...) CMOCKA_PRINTF_ATTRIBUTE(2, 3);
- //int example_test_printf(const char *format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
- static char temporary_buffer[256];
- /* A mock fprintf function that checks the value of strings printed to the
- * standard error stream. */
- int example_test_fprintf(FILE* const file, const char *format, ...) {
- int return_value;
- va_list args;
- assert_true(file == stderr);
- va_start(args, format);
- // assert_true(1 == 0);
- return_value = vsnprintf(temporary_buffer, sizeof(temporary_buffer), format, args);
- printf("%d", return_value);
- check_expected_ptr(temporary_buffer);
- // check_expected_ptr(temporary_buffer);
- va_end(args);
- memset(temporary_buffer, 0, 256);
- return return_value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement