From: Kevin Day Date: Wed, 8 Jun 2022 01:13:59 +0000 (-0500) Subject: Update: Unit tests in several projects. X-Git-Tag: 0.5.10~59 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=31b790a5a3c95d1b6896392264f98a4aaf73ba69;p=fll Update: Unit tests in several projects. Remove invalid errnor checks. Design some of the mocks to be more consistent across the projects. --- diff --git a/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_print.c b/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_print.c index 417a8c3..ba1928c 100644 --- a/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_print.c +++ b/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_print.c @@ -76,8 +76,8 @@ void test__f_conversion_number_signed_print__works(void **state) { const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1); will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, sizeof(f_char_t)); - will_return(__wrap_ferror_unlocked, 0); + will_return(__wrap_fwrite_unlocked, 1); + will_return(__wrap_ferror_unlocked, false); expect_string(__wrap_fwrite_unlocked, ptr, "1"); @@ -93,7 +93,7 @@ void test__f_conversion_number_signed_print__works_for_zero(void **state) { const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1); will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, true); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); expect_string(__wrap_fwrite_unlocked, ptr, "0"); diff --git a/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_print.c b/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_print.c index 8d2ba3d..fb7396b 100644 --- a/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_print.c +++ b/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_print.c @@ -76,7 +76,7 @@ void test__f_conversion_number_unsigned_print__works(void **state) { const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1); will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, true); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); expect_string(__wrap_fwrite_unlocked, ptr, "1"); @@ -93,7 +93,7 @@ void test__f_conversion_number_unsigned_print__works_for_zero(void **state) { const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1); will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, true); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); expect_string(__wrap_fwrite_unlocked, ptr, "0"); diff --git a/level_0/f_file/tests/unit/c/mock-file.c b/level_0/f_file/tests/unit/c/mock-file.c index 34056e6..5f4ba24 100644 --- a/level_0/f_file/tests/unit/c/mock-file.c +++ b/level_0/f_file/tests/unit/c/mock-file.c @@ -175,27 +175,11 @@ FILE *__wrap_freopen(const char *pathname, const char *mode, FILE *stream) { int __wrap_feof_unlocked(FILE *stream) { - const bool failure = mock_type(bool); - - if (failure) { - errno = mock_type(int); - - return -1; - } - return mock_type(int); } int __wrap_ferror_unlocked(FILE *stream) { - const bool failure = mock_type(bool); - - if (failure) { - errno = mock_type(int); - - return -1; - } - return mock_type(int); } @@ -213,6 +197,7 @@ int __wrap_fflush(FILE *stream) { } int __wrap_fileno(FILE *stream) { + return mock_type(int); } @@ -222,14 +207,6 @@ void __wrap_flockfile(FILE *filehandle) { size_t __wrap_fread_unlocked(void *ptr, size_t size, size_t nmemb, FILE *stream) { - const bool failure = mock_type(bool); - - if (failure) { - errno = mock_type(int); - - return 0; - } - return mock_type(int); } @@ -313,12 +290,10 @@ size_t __wrap_fwrite_unlocked(const void *ptr, size_t size, size_t nmemb, FILE * const bool failure = mock_type(bool); if (failure) { - errno = mock_type(int); - - return 0; + return mock_type(int); } - return mock_type(int); + return mock_type(size_t); } int __wrap_lchown(const char *pathname, uid_t owner, gid_t group) { diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read.c b/level_0/f_file/tests/unit/c/test-file-stream_read.c index 95ca854..72739ba 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_read.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_read.c @@ -7,54 +7,22 @@ extern "C" { void test__f_file_stream_read__fails(void **state) { - int errnos[] = { - EAGAIN, - EBADF, - EFAULT, - EINTR, - EINVAL, - EIO, - EISDIR, - EWOULDBLOCK, - mock_errno_generic, - }; - - f_status_t statuss[] = { - F_block, - F_file_descriptor, - F_buffer, - F_interrupt, - F_parameter, - F_input_output, - F_file_type_directory, - F_block, - F_failure, - }; - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - for (int i = 0; i < 9; ++i) { - + { f_file_t file = f_file_t_initialize; file.size_read = 1; file.stream = F_type_input_d; will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); - - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - - will_return(__wrap_fread_unlocked, true); - will_return(__wrap_fread_unlocked, errnos[i]); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 1); + will_return(__wrap_fread_unlocked, 0); + will_return(__wrap_ferror_unlocked, true); const f_status_t status = f_file_stream_read(file, &buffer); - assert_int_equal(status, F_status_set_error(statuss[i])); - } // for + assert_int_equal(status, F_status_set_error(F_file_read)); + } f_string_dynamic_resize(0, &buffer); } @@ -110,25 +78,13 @@ void test__f_file_stream_read__works(void **state) { file.stream = F_type_input_d; will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - - will_return(__wrap_fread_unlocked, false); will_return(__wrap_fread_unlocked, file.size_read); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); - - will_return(__wrap_fread_unlocked, false); will_return(__wrap_fread_unlocked, 0); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); const f_status_t status = f_file_stream_read(file, &buffer); diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_block.c b/level_0/f_file/tests/unit/c/test-file-stream_read_block.c index fec3f97..d974c81 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_read_block.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_read_block.c @@ -7,54 +7,22 @@ extern "C" { void test__f_file_stream_read_block__fails(void **state) { - int errnos[] = { - EAGAIN, - EBADF, - EFAULT, - EINTR, - EINVAL, - EIO, - EISDIR, - EWOULDBLOCK, - mock_errno_generic, - }; - - f_status_t statuss[] = { - F_block, - F_file_descriptor, - F_buffer, - F_interrupt, - F_parameter, - F_input_output, - F_file_type_directory, - F_block, - F_failure, - }; - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - for (int i = 0; i < 9; ++i) { - + { f_file_t file = f_file_t_initialize; file.size_read = 1; file.stream = F_type_input_d; will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); - - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - - will_return(__wrap_fread_unlocked, true); - will_return(__wrap_fread_unlocked, errnos[i]); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 1); + will_return(__wrap_fread_unlocked, 0); + will_return(__wrap_ferror_unlocked, true); const f_status_t status = f_file_stream_read_block(file, &buffer); - assert_int_equal(status, F_status_set_error(statuss[i])); - } // for + assert_int_equal(status, F_status_set_error(F_file_read)); + } f_string_dynamic_resize(0, &buffer); } @@ -109,19 +77,10 @@ void test__f_file_stream_read_block__works(void **state) { file.stream = F_type_input_d; will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - - will_return(__wrap_fread_unlocked, false); will_return(__wrap_fread_unlocked, file.size_read); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); const f_status_t status = f_file_stream_read_block(file, &buffer); diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_until.c b/level_0/f_file/tests/unit/c/test-file-stream_read_until.c index c7578b4..4b0e0c7 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_read_until.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_read_until.c @@ -7,54 +7,22 @@ extern "C" { void test__f_file_stream_read_until__fails(void **state) { - int errnos[] = { - EAGAIN, - EBADF, - EFAULT, - EINTR, - EINVAL, - EIO, - EISDIR, - EWOULDBLOCK, - mock_errno_generic, - }; - - f_status_t statuss[] = { - F_block, - F_file_descriptor, - F_buffer, - F_interrupt, - F_parameter, - F_input_output, - F_file_type_directory, - F_block, - F_failure, - }; - f_string_dynamic_t buffer = f_string_dynamic_t_initialize; - for (int i = 0; i < 9; ++i) { - + { f_file_t file = f_file_t_initialize; file.size_read = 1; file.stream = F_type_input_d; will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); - - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - - will_return(__wrap_fread_unlocked, true); - will_return(__wrap_fread_unlocked, errnos[i]); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 1); + will_return(__wrap_fread_unlocked, 0); + will_return(__wrap_ferror_unlocked, true); const f_status_t status = f_file_stream_read_until(file, 1, &buffer); - assert_int_equal(status, F_status_set_error(statuss[i])); - } // for + assert_int_equal(status, F_status_set_error(F_file_read)); + } f_string_dynamic_resize(0, &buffer); } @@ -112,19 +80,10 @@ void test__f_file_stream_read_until__works(void **state) { file.stream = F_type_input_d; will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - - will_return(__wrap_fread_unlocked, false); will_return(__wrap_fread_unlocked, file.size_read); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - will_return(__wrap_feof_unlocked, false); - will_return(__wrap_feof_unlocked, 0); const f_status_t status = f_file_stream_read_until(file, 1, &buffer); diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write.c b/level_0/f_file/tests/unit/c/test-file-stream_write.c index 683e1ec..7046bb1 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_write.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_write.c @@ -7,48 +7,21 @@ extern "C" { void test__f_file_stream_write__fails(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); - - int errnos[] = { - EAGAIN, - EBADF, - EFAULT, - EINTR, - EINVAL, - EIO, - EISDIR, - EWOULDBLOCK, - mock_errno_generic, - }; - - f_status_t statuss[] = { - F_block, - F_file_descriptor, - F_buffer, - F_interrupt, - F_parameter, - F_input_output, - F_file_type_directory, - F_block, - F_file_write, - }; - - for (int i = 0; i < 9; ++i) { + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + { f_file_t file = f_file_t_initialize; file.size_read = 1; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, true); - will_return(__wrap_fwrite_unlocked, errnos[i]); - - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 1); + will_return(__wrap_fwrite_unlocked, 0); + will_return(__wrap_ferror_unlocked, true); - const f_status_t status = f_file_stream_write(file, path, 0); + const f_status_t status = f_file_stream_write(file, test, 0); - assert_int_equal(status, F_status_set_error(statuss[i])); - } // for + assert_int_equal(status, F_status_set_error(F_file_write)); + } } void test__f_file_stream_write__parameter_checking(void **state) { @@ -97,20 +70,18 @@ void test__f_file_stream_write__returns_data_not(void **state) { void test__f_file_stream_write__works(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); { f_file_t file = f_file_t_initialize; - file.size_write = path.used; + file.size_write = test.used; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - const f_status_t status = f_file_stream_write(file, path, 0); + const f_status_t status = f_file_stream_write(file, test, 0); assert_int_equal(status, F_none_eos); } diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_block.c b/level_0/f_file/tests/unit/c/test-file-stream_write_block.c index 3716b35..c98e6d6 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_write_block.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_write_block.c @@ -7,48 +7,22 @@ extern "C" { void test__f_file_stream_write_block__fails(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); - - int errnos[] = { - EAGAIN, - EBADF, - EFAULT, - EINTR, - EINVAL, - EIO, - EISDIR, - EWOULDBLOCK, - mock_errno_generic, - }; - - f_status_t statuss[] = { - F_block, - F_file_descriptor, - F_buffer, - F_interrupt, - F_parameter, - F_input_output, - F_file_type_directory, - F_block, - F_file_write, - }; - - for (int i = 0; i < 9; ++i) { + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + + { f_file_t file = f_file_t_initialize; file.size_read = 1; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, true); - will_return(__wrap_fwrite_unlocked, errnos[i]); - - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 1); + will_return(__wrap_fwrite_unlocked, 0); + will_return(__wrap_ferror_unlocked, true); - const f_status_t status = f_file_stream_write_block(file, path, 0); + const f_status_t status = f_file_stream_write_block(file, test, 0); - assert_int_equal(status, F_status_set_error(statuss[i])); - } // for + assert_int_equal(status, F_status_set_error(F_file_write)); + } } void test__f_file_stream_write_block__parameter_checking(void **state) { @@ -97,36 +71,66 @@ void test__f_file_stream_write_block__returns_data_not(void **state) { void test__f_file_stream_write_block__works(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); { + f_array_length_t written = 0; + f_file_t file = f_file_t_initialize; file.size_write = 1; file.stream = F_type_input_d; + // The letter 't'. + will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, file.size_write); + will_return(__wrap_ferror_unlocked, false); + + f_status_t status = f_file_stream_write_block(file, test, &written); + + assert_int_equal(status, F_none_stop); + assert_int_equal(written, file.size_write); + + // The letter 'e'. + will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, file.size_write); + will_return(__wrap_ferror_unlocked, false); + + status = f_file_stream_write_block(file, test, &written); + + assert_int_equal(status, F_none_stop); + assert_int_equal(written, file.size_write); + + // The letter 's'. will_return(__wrap_fwrite_unlocked, false); will_return(__wrap_fwrite_unlocked, file.size_write); + will_return(__wrap_ferror_unlocked, false); + status = f_file_stream_write_block(file, test, &written); + + assert_int_equal(status, F_none_stop); + assert_int_equal(written, file.size_write); + + // The letter 't'. + will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, file.size_write); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - const f_status_t status = f_file_stream_write_block(file, path, 0); + status = f_file_stream_write_block(file, test, &written); assert_int_equal(status, F_none_stop); + assert_int_equal(written, file.size_write); } { f_file_t file = f_file_t_initialize; - file.size_write = path.used; + file.size_write = test.used; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - const f_status_t status = f_file_stream_write_block(file, path, 0); + const f_status_t status = f_file_stream_write_block(file, test, 0); assert_int_equal(status, F_none_eos); } diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_range.c b/level_0/f_file/tests/unit/c/test-file-stream_write_range.c index c00e90d..582d554 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_write_range.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_write_range.c @@ -7,49 +7,23 @@ extern "C" { void test__f_file_stream_write_range__fails(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); const f_string_range_t range = macro_f_string_range_t_initialize(0, 0); - int errnos[] = { - EAGAIN, - EBADF, - EFAULT, - EINTR, - EINVAL, - EIO, - EISDIR, - EWOULDBLOCK, - mock_errno_generic, - }; - - f_status_t statuss[] = { - F_block, - F_file_descriptor, - F_buffer, - F_interrupt, - F_parameter, - F_input_output, - F_file_type_directory, - F_block, - F_file_write, - }; - - for (int i = 0; i < 9; ++i) { + { f_file_t file = f_file_t_initialize; file.size_read = 1; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, true); - will_return(__wrap_fwrite_unlocked, errnos[i]); - - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 1); + will_return(__wrap_fwrite_unlocked, 0); + will_return(__wrap_ferror_unlocked, true); - const f_status_t status = f_file_stream_write_range(file, path, range, 0); + const f_status_t status = f_file_stream_write_range(file, test, range, 0); - assert_int_equal(status, F_status_set_error(statuss[i])); - } // for + assert_int_equal(status, F_status_set_error(F_file_write)); + } } void test__f_file_stream_write_range__parameter_checking(void **state) { @@ -93,9 +67,9 @@ void test__f_file_stream_write_range__returns_data_not(void **state) { { const f_string_range_t range = f_string_range_t_initialize; - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); - const f_status_t status = f_file_stream_write_range(file, path, range, 0); + const f_status_t status = f_file_stream_write_range(file, test, range, 0); assert_int_equal(status, F_data_not); } @@ -121,11 +95,11 @@ void test__f_file_stream_write_range__returns_data_not(void **state) { { const f_string_range_t range = f_string_range_t_initialize; - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); f_array_length_t written = 1; - const f_status_t status = f_file_stream_write_range(file, path, range, &written); + const f_status_t status = f_file_stream_write_range(file, test, range, &written); assert_int_equal(status, F_data_not); assert_int_equal(written, 0); @@ -145,7 +119,7 @@ void test__f_file_stream_write_range__returns_data_not(void **state) { void test__f_file_stream_write_range__works(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); const f_string_range_t range = macro_f_string_range_t_initialize(0, 0); { @@ -154,28 +128,24 @@ void test__f_file_stream_write_range__works(void **state) { file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - const f_status_t status = f_file_stream_write_range(file, path, range, 0); + const f_status_t status = f_file_stream_write_range(file, test, range, 0); assert_int_equal(status, F_none_stop); } { f_file_t file = f_file_t_initialize; - file.size_write = path.used; + file.size_write = test.used; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - const f_status_t status = f_file_stream_write_range(file, path, range, 0); + const f_status_t status = f_file_stream_write_range(file, test, range, 0); assert_int_equal(status, F_none_eos); } diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_until.c b/level_0/f_file/tests/unit/c/test-file-stream_write_until.c index fb882b9..0bf8e2d 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_write_until.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_write_until.c @@ -7,48 +7,22 @@ extern "C" { void test__f_file_stream_write_until__fails(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); - - int errnos[] = { - EAGAIN, - EBADF, - EFAULT, - EINTR, - EINVAL, - EIO, - EISDIR, - EWOULDBLOCK, - mock_errno_generic, - }; - - f_status_t statuss[] = { - F_block, - F_file_descriptor, - F_buffer, - F_interrupt, - F_parameter, - F_input_output, - F_file_type_directory, - F_block, - F_file_write, - }; - - for (int i = 0; i < 9; ++i) { + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + + { f_file_t file = f_file_t_initialize; file.size_read = 1; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, true); - will_return(__wrap_fwrite_unlocked, errnos[i]); + will_return(__wrap_fwrite_unlocked, 0); + will_return(__wrap_ferror_unlocked, true); - will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 1); + const f_status_t status = f_file_stream_write_until(file, test, 1, 0); - const f_status_t status = f_file_stream_write_until(file, path, 1, 0); - - assert_int_equal(status, F_status_set_error(statuss[i])); - } // for + assert_int_equal(status, F_status_set_error(F_file_write)); + } } void test__f_file_stream_write_until__parameter_checking(void **state) { @@ -77,7 +51,7 @@ void test__f_file_stream_write_until__returns_file_closed(void **state) { void test__f_file_stream_write_until__returns_data_not(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); f_file_t file = f_file_t_initialize; file.stream = F_type_input_d; @@ -89,7 +63,7 @@ void test__f_file_stream_write_until__returns_data_not(void **state) { } { - const f_status_t status = f_file_stream_write_until(file, path, 0, 0); + const f_status_t status = f_file_stream_write_until(file, test, 0, 0); assert_int_equal(status, F_data_not); } @@ -112,7 +86,7 @@ void test__f_file_stream_write_until__returns_data_not(void **state) { { f_array_length_t written = 1; - const f_status_t status = f_file_stream_write_until(file, path, 0, &written); + const f_status_t status = f_file_stream_write_until(file, test, 0, &written); assert_int_equal(status, F_data_not); assert_int_equal(written, 0); @@ -130,54 +104,48 @@ void test__f_file_stream_write_until__returns_data_not(void **state) { void test__f_file_stream_write_until__works(void **state) { - const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); { f_file_t file = f_file_t_initialize; file.size_write = 1; file.stream = F_type_input_d; + // The letter 't'. will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); + // The letter 'e'. will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); + // The letter 's'. will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); + // The letter 't'. will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - const f_status_t status = f_file_stream_write_until(file, path, path.used, 0); + const f_status_t status = f_file_stream_write_until(file, test, test.used, 0); assert_int_equal(status, F_none_eos); } { f_file_t file = f_file_t_initialize; - file.size_write = path.used; + file.size_write = test.used; file.stream = F_type_input_d; will_return(__wrap_fwrite_unlocked, false); - will_return(__wrap_fwrite_unlocked, file.size_write); - + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); - will_return(__wrap_ferror_unlocked, 0); - const f_status_t status = f_file_stream_write_until(file, path, path.used, 0); + const f_status_t status = f_file_stream_write_until(file, test, test.used, 0); assert_int_equal(status, F_none_eos); } diff --git a/level_0/f_print/tests/unit/c/mock-print.c b/level_0/f_print/tests/unit/c/mock-print.c index cabf181..9f5c062 100644 --- a/level_0/f_print/tests/unit/c/mock-print.c +++ b/level_0/f_print/tests/unit/c/mock-print.c @@ -20,7 +20,7 @@ size_t __wrap_fwrite_unlocked(const void *ptr, size_t size, size_t nmemb, FILE * return mock_type(int); } - return nmemb; + return mock_type(size_t); } ssize_t __wrap_write(int fd, const void *buf, size_t count) { diff --git a/level_0/f_print/tests/unit/c/test-print-.c b/level_0/f_print/tests/unit/c/test-print-.c index 7b8d16b..ff2b920 100644 --- a/level_0/f_print/tests/unit/c/test-print-.c +++ b/level_0/f_print/tests/unit/c/test-print-.c @@ -60,6 +60,7 @@ void test__f_print__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print(test.string, test.used, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-character.c b/level_0/f_print/tests/unit/c/test-print-character.c index 45fd9eb..018d6be 100644 --- a/level_0/f_print/tests/unit/c/test-print-character.c +++ b/level_0/f_print/tests/unit/c/test-print-character.c @@ -37,6 +37,7 @@ void test__f_print_character__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_character(test.string[0], stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-character_safely.c b/level_0/f_print/tests/unit/c/test-print-character_safely.c index e9c3d6f..fa42b6e 100644 --- a/level_0/f_print/tests/unit/c/test-print-character_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-character_safely.c @@ -79,6 +79,7 @@ void test__f_print_character_safely__returns_utf(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_character_safely(test.string[0], stdout); @@ -93,6 +94,7 @@ void test__f_print_character_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, f_print_sequence_delete_s.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_character_safely((f_char_t) 0x7f, stdout); @@ -102,6 +104,7 @@ void test__f_print_character_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, f_print_sequence_unknown_s.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_character_safely((f_char_t) F_utf_byte_1_d, stdout); @@ -111,6 +114,7 @@ void test__f_print_character_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_character_safely(test.string[0], stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic.c b/level_0/f_print/tests/unit/c/test-print-dynamic.c index c2992ab..cbab19a 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic.c @@ -46,6 +46,7 @@ void test__f_print_dynamic__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic(test, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic_partial.c b/level_0/f_print/tests/unit/c/test-print-dynamic_partial.c index d757a56..6776c34 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic_partial.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic_partial.c @@ -51,6 +51,7 @@ void test__f_print_dynamic_partial__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic_partial(test, partial, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw.c b/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw.c index 07be962..30e0653 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw.c @@ -51,6 +51,7 @@ void test__f_print_dynamic_partial_raw__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 3); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic_partial_raw(test, partial, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw_safely.c index 5a05589..f95e495 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw_safely.c @@ -51,6 +51,7 @@ void test__f_print_dynamic_partial_raw_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 3); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic_partial_raw_safely(test, partial, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic_partial_safely.c b/level_0/f_print/tests/unit/c/test-print-dynamic_partial_safely.c index 1e25af8..09c6004 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic_partial_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic_partial_safely.c @@ -51,6 +51,7 @@ void test__f_print_dynamic_partial_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 3); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic_partial_safely(test, partial, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic_raw.c b/level_0/f_print/tests/unit/c/test-print-dynamic_raw.c index 8ac1bb5..eb96bab 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic_raw.c @@ -46,6 +46,7 @@ void test__f_print_dynamic_raw__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic_raw(test, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-dynamic_raw_safely.c index 581b965..152de7a 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic_raw_safely.c @@ -46,6 +46,7 @@ void test__f_print_dynamic_raw_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic_raw_safely(test, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-dynamic_safely.c b/level_0/f_print/tests/unit/c/test-print-dynamic_safely.c index a6963bd0..7d495ed 100644 --- a/level_0/f_print/tests/unit/c/test-print-dynamic_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-dynamic_safely.c @@ -46,6 +46,7 @@ void test__f_print_dynamic_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_dynamic_safely(test, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except.c b/level_0/f_print/tests/unit/c/test-print-except.c index 94b5f3a..34c4450 100644 --- a/level_0/f_print/tests/unit/c/test-print-except.c +++ b/level_0/f_print/tests/unit/c/test-print-except.c @@ -65,6 +65,7 @@ void test__f_print_except__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except(test.string, 0, test.used, except, stdout); @@ -76,6 +77,7 @@ void test__f_print_except__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except(test.string, 2, test.used, except, stdout); @@ -88,6 +90,7 @@ void test__f_print_except__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except(test.string, 1, test.used, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic.c index 5705ffc..f9e5667 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic.c @@ -52,6 +52,7 @@ void test__f_print_except_dynamic__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic(test, except, stdout); @@ -64,6 +65,7 @@ void test__f_print_except_dynamic__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic(test, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial.c index 03752e5..327f894 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial.c @@ -56,6 +56,7 @@ void test__f_print_except_dynamic_partial__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial(test, partial, except, stdout); @@ -68,6 +69,7 @@ void test__f_print_except_dynamic_partial__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial(test, partial, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw.c index 920854c..dd217cb 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw.c @@ -56,6 +56,7 @@ void test__f_print_except_dynamic_partial_raw__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial_raw(test, partial, except, stdout); @@ -68,6 +69,7 @@ void test__f_print_except_dynamic_partial_raw__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial_raw(test, partial, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw_safely.c index 27ad0d0..91c7400 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw_safely.c @@ -56,6 +56,7 @@ void test__f_print_except_dynamic_partial_raw_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial_raw_safely(test, partial, except, stdout); @@ -68,6 +69,7 @@ void test__f_print_except_dynamic_partial_raw_safely__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial_raw_safely(test, partial, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_safely.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_safely.c index a6aad5b..5428d71 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_safely.c @@ -56,6 +56,7 @@ void test__f_print_except_dynamic_partial_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial_safely(test, partial, except, stdout); @@ -68,6 +69,7 @@ void test__f_print_except_dynamic_partial_safely__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_partial_safely(test, partial, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw.c index d5b2ac8..29a27d1 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw.c @@ -52,6 +52,7 @@ void test__f_print_except_dynamic_raw__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_raw(test, except, stdout); @@ -64,6 +65,7 @@ void test__f_print_except_dynamic_raw__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_raw(test, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw_safely.c index 8a5092a..5fa066d 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic_raw_safely.c @@ -52,6 +52,7 @@ void test__f_print_except_dynamic_raw_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_raw_safely(test, except, stdout); @@ -64,6 +65,7 @@ void test__f_print_except_dynamic_raw_safely__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_raw_safely(test, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_dynamic_safely.c b/level_0/f_print/tests/unit/c/test-print-except_dynamic_safely.c index 4a34167..9b1accd 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_dynamic_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_dynamic_safely.c @@ -52,6 +52,7 @@ void test__f_print_except_dynamic_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_safely(test, except, stdout); @@ -64,6 +65,7 @@ void test__f_print_except_dynamic_safely__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_dynamic_safely(test, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in.c b/level_0/f_print/tests/unit/c/test-print-except_in.c index 2340b7f..343cdfd 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in.c @@ -69,6 +69,7 @@ void test__f_print_except_in__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in(test.string, 0, test.used, except, range, stdout); @@ -81,6 +82,7 @@ void test__f_print_except_in__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in(test.string, 2, test.used, except, range, stdout); @@ -97,6 +99,7 @@ void test__f_print_except_in__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in(test.string, 1, test.used, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic.c index bb759c2..252e8e0 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic.c @@ -56,6 +56,7 @@ void test__f_print_except_in_dynamic__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic(test, except, range, stdout); @@ -72,6 +73,7 @@ void test__f_print_except_in_dynamic__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic(test, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial.c index 522bda9..33cb8ed 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial.c @@ -60,6 +60,7 @@ void test__f_print_except_in_dynamic_partial__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial(test, partial, except, range, stdout); @@ -76,6 +77,7 @@ void test__f_print_except_in_dynamic_partial__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial(test, partial, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw.c index 24d1ba1..cc43287 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw.c @@ -60,6 +60,7 @@ void test__f_print_except_in_dynamic_partial_raw__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial_raw(test, partial, except, range, stdout); @@ -76,6 +77,7 @@ void test__f_print_except_in_dynamic_partial_raw__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial_raw(test, partial, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw_safely.c index b90ca7e..20b59ed 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw_safely.c @@ -60,6 +60,7 @@ void test__f_print_except_in_dynamic_partial_raw_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial_raw_safely(test, partial, except, range, stdout); @@ -76,6 +77,7 @@ void test__f_print_except_in_dynamic_partial_raw_safely__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial_raw_safely(test, partial, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_safely.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_safely.c index 8c2fa1e..d5b14ff 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_safely.c @@ -60,6 +60,7 @@ void test__f_print_except_in_dynamic_partial_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial_safely(test, partial, except, range, stdout); @@ -76,6 +77,7 @@ void test__f_print_except_in_dynamic_partial_safely__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_partial_safely(test, partial, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw.c index 2ad258c..acb751c 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw.c @@ -56,6 +56,7 @@ void test__f_print_except_in_dynamic_raw__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_raw(test, except, range, stdout); @@ -72,6 +73,7 @@ void test__f_print_except_in_dynamic_raw__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_raw(test, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw_safely.c index 0063216..7613cc5 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw_safely.c @@ -56,6 +56,7 @@ void test__f_print_except_in_dynamic_raw_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_raw_safely(test, except, range, stdout); @@ -72,6 +73,7 @@ void test__f_print_except_in_dynamic_raw_safely__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_raw_safely(test, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_safely.c b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_safely.c index e862b0b..7dd1a55 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_dynamic_safely.c @@ -56,6 +56,7 @@ void test__f_print_except_in_dynamic_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_safely(test, except, range, stdout); @@ -72,6 +73,7 @@ void test__f_print_except_in_dynamic_safely__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_dynamic_safely(test, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_raw.c b/level_0/f_print/tests/unit/c/test-print-except_in_raw.c index 26db749..bd59a35 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_raw.c @@ -69,6 +69,7 @@ void test__f_print_except_in_raw__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_raw(test.string, 0, test.used, except, range, stdout); @@ -81,6 +82,7 @@ void test__f_print_except_in_raw__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_raw(test.string, 2, test.used, except, range, stdout); @@ -97,6 +99,7 @@ void test__f_print_except_in_raw__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_raw(test.string, 1, test.used, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-except_in_raw_safely.c index 6683bbd..635e5f0 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_raw_safely.c @@ -69,6 +69,7 @@ void test__f_print_except_in_raw_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_raw_safely(test.string, 0, test.used, except, range, stdout); @@ -81,6 +82,7 @@ void test__f_print_except_in_raw_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_raw_safely(test.string, 2, test.used, except, range, stdout); @@ -97,6 +99,7 @@ void test__f_print_except_in_raw_safely__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_raw_safely(test.string, 1, test.used, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_in_safely.c b/level_0/f_print/tests/unit/c/test-print-except_in_safely.c index 0e411e9..9bfb321 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_in_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_in_safely.c @@ -69,6 +69,7 @@ void test__f_print_except_in_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_safely(test.string, 0, test.used, except, range, stdout); @@ -81,6 +82,7 @@ void test__f_print_except_in_safely__works(void **state) { const f_string_ranges_t range = f_string_ranges_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_safely(test.string, 2, test.used, except, range, stdout); @@ -97,6 +99,7 @@ void test__f_print_except_in_safely__works(void **state) { const f_string_ranges_t range = macro_f_string_ranges_t_initialize(ranges, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_in_safely(test.string, 1, test.used, except, range, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_raw.c b/level_0/f_print/tests/unit/c/test-print-except_raw.c index ee39ac3..0b17254 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_raw.c +++ b/level_0/f_print/tests/unit/c/test-print-except_raw.c @@ -65,6 +65,7 @@ void test__f_print_except_raw__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_raw(test.string, 0, test.used, except, stdout); @@ -76,6 +77,7 @@ void test__f_print_except_raw__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_raw(test.string, 2, test.used, except, stdout); @@ -88,6 +90,7 @@ void test__f_print_except_raw__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_raw(test.string, 1, test.used, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_raw_safely.c b/level_0/f_print/tests/unit/c/test-print-except_raw_safely.c index e428bf3..b77fd2a 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_raw_safely.c @@ -65,6 +65,7 @@ void test__f_print_except_raw_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_raw_safely(test.string, 0, test.used, except, stdout); @@ -76,6 +77,7 @@ void test__f_print_except_raw_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_raw_safely(test.string, 2, test.used, except, stdout); @@ -88,6 +90,7 @@ void test__f_print_except_raw_safely__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_raw_safely(test.string, 1, test.used, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-except_safely.c b/level_0/f_print/tests/unit/c/test-print-except_safely.c index 8caa07c..fce666a 100644 --- a/level_0/f_print/tests/unit/c/test-print-except_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-except_safely.c @@ -65,6 +65,7 @@ void test__f_print_except_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_safely(test.string, 0, test.used, except, stdout); @@ -76,6 +77,7 @@ void test__f_print_except_safely__works(void **state) { const f_array_lengths_t except = f_array_lengths_t_initialize; will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_safely(test.string, 2, test.used, except, stdout); @@ -88,6 +90,7 @@ void test__f_print_except_safely__works(void **state) { const f_array_lengths_t except = macro_f_array_lengths_t_initialize(lengths, 0, 1); will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used - 1); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_except_safely(test.string, 1, test.used, except, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-raw.c b/level_0/f_print/tests/unit/c/test-print-raw.c index cdc24d4..4840158 100644 --- a/level_0/f_print/tests/unit/c/test-print-raw.c +++ b/level_0/f_print/tests/unit/c/test-print-raw.c @@ -60,6 +60,7 @@ void test__f_print_raw__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_raw(test.string, test.used, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-raw_safely.c b/level_0/f_print/tests/unit/c/test-print-raw_safely.c index 9014874..1316995 100644 --- a/level_0/f_print/tests/unit/c/test-print-raw_safely.c +++ b/level_0/f_print/tests/unit/c/test-print-raw_safely.c @@ -60,6 +60,7 @@ void test__f_print_raw_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_raw_safely(test.string, test.used, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-raw_terminated.c b/level_0/f_print/tests/unit/c/test-print-raw_terminated.c index dba764e..7c44097 100644 --- a/level_0/f_print/tests/unit/c/test-print-raw_terminated.c +++ b/level_0/f_print/tests/unit/c/test-print-raw_terminated.c @@ -46,6 +46,7 @@ void test__f_print_raw_terminated__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_raw_terminated(test.string, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-safely.c b/level_0/f_print/tests/unit/c/test-print-safely.c index 5ce011c..f45e043 100644 --- a/level_0/f_print/tests/unit/c/test-print-safely.c +++ b/level_0/f_print/tests/unit/c/test-print-safely.c @@ -60,6 +60,7 @@ void test__f_print_safely__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_safely(test.string, test.used, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-safely_terminated.c b/level_0/f_print/tests/unit/c/test-print-safely_terminated.c index 72c6ca7..1f6d366 100644 --- a/level_0/f_print/tests/unit/c/test-print-safely_terminated.c +++ b/level_0/f_print/tests/unit/c/test-print-safely_terminated.c @@ -46,6 +46,7 @@ void test__f_print_safely_terminated__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_safely_terminated(test.string, stdout); diff --git a/level_0/f_print/tests/unit/c/test-print-terminated.c b/level_0/f_print/tests/unit/c/test-print-terminated.c index f6231fe..17963f5 100644 --- a/level_0/f_print/tests/unit/c/test-print-terminated.c +++ b/level_0/f_print/tests/unit/c/test-print-terminated.c @@ -46,6 +46,7 @@ void test__f_print_terminated__works(void **state) { { will_return(__wrap_fwrite_unlocked, false); + will_return(__wrap_fwrite_unlocked, test.used); will_return(__wrap_ferror_unlocked, false); const f_status_t status = f_print_terminated(test.string, stdout);