]> Kevux Git Server - fll/commitdiff
Update: Unit tests in several projects.
authorKevin Day <thekevinday@gmail.com>
Wed, 8 Jun 2022 01:13:59 +0000 (20:13 -0500)
committerKevin Day <thekevinday@gmail.com>
Wed, 8 Jun 2022 01:13:59 +0000 (20:13 -0500)
Remove invalid errnor checks.
Design some of the mocks to be more consistent across the projects.

52 files changed:
level_0/f_conversion/tests/unit/c/test-conversion-number_signed_print.c
level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_print.c
level_0/f_file/tests/unit/c/mock-file.c
level_0/f_file/tests/unit/c/test-file-stream_read.c
level_0/f_file/tests/unit/c/test-file-stream_read_block.c
level_0/f_file/tests/unit/c/test-file-stream_read_until.c
level_0/f_file/tests/unit/c/test-file-stream_write.c
level_0/f_file/tests/unit/c/test-file-stream_write_block.c
level_0/f_file/tests/unit/c/test-file-stream_write_range.c
level_0/f_file/tests/unit/c/test-file-stream_write_until.c
level_0/f_print/tests/unit/c/mock-print.c
level_0/f_print/tests/unit/c/test-print-.c
level_0/f_print/tests/unit/c/test-print-character.c
level_0/f_print/tests/unit/c/test-print-character_safely.c
level_0/f_print/tests/unit/c/test-print-dynamic.c
level_0/f_print/tests/unit/c/test-print-dynamic_partial.c
level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw.c
level_0/f_print/tests/unit/c/test-print-dynamic_partial_raw_safely.c
level_0/f_print/tests/unit/c/test-print-dynamic_partial_safely.c
level_0/f_print/tests/unit/c/test-print-dynamic_raw.c
level_0/f_print/tests/unit/c/test-print-dynamic_raw_safely.c
level_0/f_print/tests/unit/c/test-print-dynamic_safely.c
level_0/f_print/tests/unit/c/test-print-except.c
level_0/f_print/tests/unit/c/test-print-except_dynamic.c
level_0/f_print/tests/unit/c/test-print-except_dynamic_partial.c
level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw.c
level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_raw_safely.c
level_0/f_print/tests/unit/c/test-print-except_dynamic_partial_safely.c
level_0/f_print/tests/unit/c/test-print-except_dynamic_raw.c
level_0/f_print/tests/unit/c/test-print-except_dynamic_raw_safely.c
level_0/f_print/tests/unit/c/test-print-except_dynamic_safely.c
level_0/f_print/tests/unit/c/test-print-except_in.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_raw_safely.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic_partial_safely.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic_raw_safely.c
level_0/f_print/tests/unit/c/test-print-except_in_dynamic_safely.c
level_0/f_print/tests/unit/c/test-print-except_in_raw.c
level_0/f_print/tests/unit/c/test-print-except_in_raw_safely.c
level_0/f_print/tests/unit/c/test-print-except_in_safely.c
level_0/f_print/tests/unit/c/test-print-except_raw.c
level_0/f_print/tests/unit/c/test-print-except_raw_safely.c
level_0/f_print/tests/unit/c/test-print-except_safely.c
level_0/f_print/tests/unit/c/test-print-raw.c
level_0/f_print/tests/unit/c/test-print-raw_safely.c
level_0/f_print/tests/unit/c/test-print-raw_terminated.c
level_0/f_print/tests/unit/c/test-print-safely.c
level_0/f_print/tests/unit/c/test-print-safely_terminated.c
level_0/f_print/tests/unit/c/test-print-terminated.c

index 417a8c371facf7f8cc43e01d556e5faa5163a882..ba1928c8cf6c18b31157326097b83185486ee870 100644 (file)
@@ -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");
index 8d2ba3d0021bd9bb9508921712c27d0759fd9a2b..fb7396be6b9940f83221e07fc922bc57d33a852d 100644 (file)
@@ -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");
index 34056e6416c2f43b30acdb65c95355b8e75f8e98..5f4ba245ec1836e25c2e83705438c609a6752a63 100644 (file)
@@ -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) {
index 95ca8545db7f02e30495177198f7cc3437cd2688..72739ba601537d7752926a6b3c4321146967d05a 100644 (file)
@@ -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);
 
index fec3f97eb3d11591867b3624168679132ca61dfe..d974c8186abb153bc6b008e7846e3313a0af8493 100644 (file)
@@ -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);
 
index c7578b48ae3b5e32cf2cda2e9acb6b9a172e3c6b..4b0e0c7495a2f29e02efc53ab5724533893076ab 100644 (file)
@@ -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);
 
index 683e1ecf6650471a30555da182a96234827b8f8f..7046bb1b2e38da71cae507b3932ff72a780447ba 100644 (file)
@@ -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);
   }
index 3716b3548d1b18bff27a67ed73944f108d6e2c8c..c98e6d6d07d493c0042258b8b5702511c29cc64a 100644 (file)
@@ -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);
   }
index c00e90d5562dda94e31d3fdf7366b960c0468a6f..582d5544225ab89e0e37baada4e4a3f865e75ce4 100644 (file)
@@ -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);
   }
index fb882b95f8b3c8679cd73050f2373b0e36c3c6f8..0bf8e2d8b4579bd0fe5eb4a90a9b2f2bd04c6793 100644 (file)
@@ -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);
   }
index cabf181afbef67b017fc422e4ce2ab1187cd0ba1..9f5c06283591b98c3652909bf303397b066364df 100644 (file)
@@ -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) {
index 7b8d16b2f80553f25e493e48b4cf96f40baabdcb..ff2b9208c6ebdb2aeefc111d403a0ef8bffc054b 100644 (file)
@@ -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);
index 45fd9eb0e7e15f032ac9abde49b5325d14021f50..018d6bee7fff027d41ea20b0d8eac9da1f685b17 100644 (file)
@@ -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);
index e9c3d6fe5766601a2a60ab92559f0ee47f6311d2..fa42b6e0db9e98d302f7b13d5616b944a48db309 100644 (file)
@@ -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);
index c2992abb8ecac998071e1ff7506e1661a0edf8ed..cbab19a64224f0d42bb9918b1c2f164c09b50ba0 100644 (file)
@@ -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);
index d757a56a377fe26de33d20e3fb98e96939c3255c..6776c3471432d22f8cca5f7550232aa0f6f0d3d7 100644 (file)
@@ -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);
index 07be962ec42d51fb031fdeb4f3dd449c97eba4ba..30e06535001f755045a849daf075b461815aabff 100644 (file)
@@ -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);
index 5a055897301881654be918cd67b18d5b655d0f40..f95e495e4bcfe8e074ba6db82d87a25abe26111c 100644 (file)
@@ -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);
index 1e25af8d171c3c5458ad4acc17b362ca82c42d19..09c60047267b78e5bce42b4b2a00cf6f85fadc38 100644 (file)
@@ -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);
index 8ac1bb5a3d02fdc6ea25a15a16f54b30b562e6dd..eb96bab49c9374a222ff3f60fd25b7448f8d5ad0 100644 (file)
@@ -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);
index 581b965da97d85b79cca37150cdce861771ffc6a..152de7a1efb75f5f044e1715414e016bc87d8533 100644 (file)
@@ -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);
index a6963bd065139a2763fbcada3ed56228ef3b092f..7d495edb2df9a01e05cb1863f36b96ee95bce411 100644 (file)
@@ -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);
index 94b5f3af3cb1c2417d1594487708cc6858fc940e..34c44504a00d60bc351a66083f314adb7482b061 100644 (file)
@@ -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);
index 5705ffc4c2456dc828b1e8f3da8119a235665113..f9e566794424213b9e7577b9a269244f45d3cfc5 100644 (file)
@@ -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);
index 03752e54600ec571537a134f595bda7e89407559..327f894f41c84dc221466a6a1ff199ae6d69d280 100644 (file)
@@ -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);
index 920854cf621a0793c36e67c38d1f23f0e2a8ed04..dd217cb6a70675c18d5a6d93628819ec693fcf60 100644 (file)
@@ -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);
index 27ad0d0cb42e229edbdf67ad4c1f549a0fb1241c..91c7400c7a5a7b05416eb78665462ee47b63691c 100644 (file)
@@ -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);
index a6aad5bfc4c505fdae385f19a751bab46d7d6831..5428d710ffa1f5bfad54c5fa64f67c49e4934ee6 100644 (file)
@@ -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);
index d5b2ac8c0db495e1c1f9eb8ca945c372d381d0d3..29a27d164f12b27c875dd20f76a10a6303828ba7 100644 (file)
@@ -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);
index 8a5092a6f69b2d871d17ffb8cefa1ef7f9a4b3cf..5fa066ded79f68150bf6258f6ce10fe028098dba 100644 (file)
@@ -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);
index 4a34167c33983fbdff07e35638eeff3e7619d5ba..9b1accd916ca72c5833f766c125d42225435e77a 100644 (file)
@@ -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);
index 2340b7fdc3857af9606a2aaa708844e11c935196..343cdfd726e86e6644452d8b658f735e62f154ef 100644 (file)
@@ -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);
index bb759c24e28d84e994655cd296a89ee2cffec0bc..252e8e09e763bba89533cf4b00d53c1bca393c53 100644 (file)
@@ -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);
index 522bda97156ab39dca595af2d863c9da20cdd8d4..33cb8ed81bd44f78c85c227911db812cf5bcd09e 100644 (file)
@@ -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);
index 24d1ba1d6cd288d5a49b6098191d950f98e31217..cc43287353daab1f2acf0ebcea102612238755a8 100644 (file)
@@ -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);
index b90ca7ece48a7109aa1ea7094515abdd0b9f123d..20b59edfd1c19c357d06cb5e14b3ba08a822cea9 100644 (file)
@@ -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);
index 8c2fa1e7933ccb01d9c769aebe12264c9bf976c1..d5b14fff47fed02462c32cd9e424084447a0e0fa 100644 (file)
@@ -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);
index 2ad258c1986226e4f816c6a829d43b75398b77cc..acb751cfb5dab3491caac10c2d793d199852afe6 100644 (file)
@@ -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);
index 0063216ddf0d89499b6763da6bdfb0ae28c8d640..7613cc50cb872ebdc3ebc1812b470b97d2d92eb4 100644 (file)
@@ -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);
index e862b0b7afb3ef4eba19cf01c7c4ecdd89669e01..7dd1a55a8a5e2fe47e189fbac584a43f8790088f 100644 (file)
@@ -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);
index 26db7492c09bdb23417cefbb4e30303bcb24c772..bd59a35cb103f3da2f02ea678c3944f9b360abea 100644 (file)
@@ -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);
index 6683bbd49dc9aec25103555ac314227da378b1cd..635e5f04494f924a3aacfd671fe211a6b7e88bb2 100644 (file)
@@ -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);
index 0e411e940cb95269e28cd13b60527ceae0c90c93..9bfb321ff1da6031f5e881b1a1ff729a15e2be96 100644 (file)
@@ -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);
index ee39ac3cc6241c45d892e7ca5637fc277373e50a..0b17254fcab8d07b10effeb04e093b5e88d7c0b6 100644 (file)
@@ -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);
index e428bf3d6305762b4d08c4f76b2cff10e369890a..b77fd2a10c0407e790e98f4b0b33c5e4272ac267 100644 (file)
@@ -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);
index 8caa07c7e3808c9033cd449563bde2f297f70b6a..fce666ad36b63b0e76b349836680071165e4233c 100644 (file)
@@ -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);
index cdc24d467fdcfdc18e139761e8706fbfe91ec228..4840158ae7bcb7dd75804d2e97621389c331c5fb 100644 (file)
@@ -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);
index 9014874eaa0ff8b98a5356e5e5db86a114e07cba..1316995200b7ee22bd8f411a0f7607610274668e 100644 (file)
@@ -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);
index dba764ecfa04a37e5567568ff86dc0026c37f215..7c440976d21b593e7d624b3138fc7fa58d9bf3d8 100644 (file)
@@ -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);
index 5ce011cdabdcbcc5b34a0c60f7e1aad41aa65444..f45e043c4d33088621d61a2991534f5f4be65dcd 100644 (file)
@@ -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);
index 72c6ca79665426f3092722858c0d8b5a55b94cac..1f6d3666f5fc58997973e67d4911b7b86f40d01e 100644 (file)
@@ -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);
index f6231fec4816a507d7883eda661834eeea377a44..17963f5970e75511d88f68c0483195ff9a6e5766 100644 (file)
@@ -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);