]> Kevux Git Server - fll/commitdiff
Progress: Unit tests and other minor changes.
authorKevin Day <kevin@kevux.org>
Wed, 19 Apr 2023 03:21:32 +0000 (22:21 -0500)
committerKevin Day <kevin@kevux.org>
Wed, 19 Apr 2023 03:26:13 +0000 (22:26 -0500)
Get more of the unit tests up to date.
I did not finish working on the f_file unit tests.
I specifically stopped on the stream functions, namely the f_stream_write().

Fix the file defaults, such as _di_f_type_file_defaults_ that should be _di_f_type_file_defaults_d_.

The file flags (wrapped by _di_f_file_flag_d_) must be located with the f_type type_file.h file.

103 files changed:
build/disable/level_0/f_type.h
build/stand_alone/fake.config.h
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/c/file.c
level_0/f_file/c/file/common.h
level_0/f_file/c/private-file.c
level_0/f_file/c/private-file.h
level_0/f_file/data/build/settings-tests
level_0/f_file/tests/unit/c/test-file-access_at.c
level_0/f_file/tests/unit/c/test-file-access_at.h
level_0/f_file/tests/unit/c/test-file-close.c
level_0/f_file/tests/unit/c/test-file-close.h
level_0/f_file/tests/unit/c/test-file-close_flush.c [deleted file]
level_0/f_file/tests/unit/c/test-file-close_flush.h [deleted file]
level_0/f_file/tests/unit/c/test-file-create_at.c
level_0/f_file/tests/unit/c/test-file-create_at.h
level_0/f_file/tests/unit/c/test-file-create_device_at.c
level_0/f_file/tests/unit/c/test-file-create_device_at.h
level_0/f_file/tests/unit/c/test-file-create_fifo_at.c
level_0/f_file/tests/unit/c/test-file-create_fifo_at.h
level_0/f_file/tests/unit/c/test-file-create_node_at.c
level_0/f_file/tests/unit/c/test-file-create_node_at.h
level_0/f_file/tests/unit/c/test-file-descriptor.c
level_0/f_file/tests/unit/c/test-file-descriptor.h
level_0/f_file/tests/unit/c/test-file-exists_at.c
level_0/f_file/tests/unit/c/test-file-exists_at.h
level_0/f_file/tests/unit/c/test-file-flush.c
level_0/f_file/tests/unit/c/test-file-flush.h
level_0/f_file/tests/unit/c/test-file-is_at.c
level_0/f_file/tests/unit/c/test-file-is_at.h
level_0/f_file/tests/unit/c/test-file-is_stat.h
level_0/f_file/tests/unit/c/test-file-link_at.c
level_0/f_file/tests/unit/c/test-file-link_at.h
level_0/f_file/tests/unit/c/test-file-link_hard_at.c
level_0/f_file/tests/unit/c/test-file-link_hard_at.h
level_0/f_file/tests/unit/c/test-file-link_read_at.c
level_0/f_file/tests/unit/c/test-file-link_read_at.h
level_0/f_file/tests/unit/c/test-file-mode_read_at.c
level_0/f_file/tests/unit/c/test-file-mode_read_at.h
level_0/f_file/tests/unit/c/test-file-mode_set_at.c
level_0/f_file/tests/unit/c/test-file-mode_set_at.h
level_0/f_file/tests/unit/c/test-file-open_at.c
level_0/f_file/tests/unit/c/test-file-open_at.h
level_0/f_file/tests/unit/c/test-file-read.c
level_0/f_file/tests/unit/c/test-file-read.h
level_0/f_file/tests/unit/c/test-file-read_block.c
level_0/f_file/tests/unit/c/test-file-read_block.h
level_0/f_file/tests/unit/c/test-file-read_until.c
level_0/f_file/tests/unit/c/test-file-read_until.h
level_0/f_file/tests/unit/c/test-file-remove_at.c
level_0/f_file/tests/unit/c/test-file-remove_at.h
level_0/f_file/tests/unit/c/test-file-rename_at.c
level_0/f_file/tests/unit/c/test-file-rename_at.h
level_0/f_file/tests/unit/c/test-file-role_change_at.c
level_0/f_file/tests/unit/c/test-file-role_change_at.h
level_0/f_file/tests/unit/c/test-file-seek.c
level_0/f_file/tests/unit/c/test-file-seek.h
level_0/f_file/tests/unit/c/test-file-size_at.c
level_0/f_file/tests/unit/c/test-file-size_at.h
level_0/f_file/tests/unit/c/test-file-size_by_id.c
level_0/f_file/tests/unit/c/test-file-size_by_id.h
level_0/f_file/tests/unit/c/test-file-stat_at.c
level_0/f_file/tests/unit/c/test-file-stat_at.h
level_0/f_file/tests/unit/c/test-file-stat_by_id.c
level_0/f_file/tests/unit/c/test-file-stat_by_id.h
level_0/f_file/tests/unit/c/test-file-stream_close.c
level_0/f_file/tests/unit/c/test-file-stream_close.h
level_0/f_file/tests/unit/c/test-file-stream_open.c
level_0/f_file/tests/unit/c/test-file-stream_read.c
level_0/f_file/tests/unit/c/test-file-stream_read.h
level_0/f_file/tests/unit/c/test-file-stream_read_block.c
level_0/f_file/tests/unit/c/test-file-stream_read_block.h
level_0/f_file/tests/unit/c/test-file-stream_read_until.c
level_0/f_file/tests/unit/c/test-file-stream_read_until.h
level_0/f_file/tests/unit/c/test-file-stream_reopen.c
level_0/f_file/tests/unit/c/test-file-stream_write.c
level_0/f_file/tests/unit/c/test-file-stream_write.h
level_0/f_file/tests/unit/c/test-file-stream_write_block.c
level_0/f_file/tests/unit/c/test-file-stream_write_block.h
level_0/f_file/tests/unit/c/test-file-stream_write_range.c
level_0/f_file/tests/unit/c/test-file-stream_write_range.h
level_0/f_file/tests/unit/c/test-file-stream_write_until.c
level_0/f_file/tests/unit/c/test-file-stream_write_until.h
level_0/f_file/tests/unit/c/test-file-touch_at.c
level_0/f_file/tests/unit/c/test-file-touch_at.h
level_0/f_file/tests/unit/c/test-file-type_at.c
level_0/f_file/tests/unit/c/test-file-type_at.h
level_0/f_file/tests/unit/c/test-file-write.c
level_0/f_file/tests/unit/c/test-file-write.h
level_0/f_file/tests/unit/c/test-file-write_block.c
level_0/f_file/tests/unit/c/test-file-write_block.h
level_0/f_file/tests/unit/c/test-file-write_range.c
level_0/f_file/tests/unit/c/test-file-write_range.h
level_0/f_file/tests/unit/c/test-file-write_until.c
level_0/f_file/tests/unit/c/test-file-write_until.h
level_0/f_file/tests/unit/c/test-file.c
level_0/f_file/tests/unit/c/test-file.h
level_0/f_type/c/type_file.h
level_3/fake/c/main/build.c
level_3/fake/c/main/fake/do.c
level_3/fake/c/main/make/operate_process_type.c
level_3/utf8/c/main/utf8.c

index 80f0c712c57105c9c2251fce738ac844400376c0..634e5dbdacc02f4be2e11c36e58fc386f6c59487 100644 (file)
@@ -30,7 +30,7 @@
 #define _di_f_status_t_
 #define _di_f_time_spec_t_
 #define _di_f_time_t_
-#define _di_f_type_file_defaults_
+#define _di_f_type_file_defaults_d_
 #define _di_f_type_input_output_d_
 #define _di_f_type_number_64_t_
 #define _di_f_type_sizes_d_
index 08cb93e12488e4a835a45ffc8f9a56fbfe8c8c39..5bd320ef43de520234e0aecd4475ddbfd1c8dd45 100644 (file)
 #define _di_f_file_descriptor_
 //#define _di_f_file_exists_
 #define _di_f_file_exists_at_
-//#define _di_f_file_flag_d_
 //#define _di_f_file_flush_
 //#define _di_f_file_group_read_
 //#define _di_f_file_is_
 #define _di_f_time_t_
 
 //#define _di_f_type_d_
-//#define _di_f_type_file_defaults_
+//#define _di_f_type_file_defaults_d_
+//#define _di_f_type_file_flag_d_
 //#define _di_f_type_number_64_t_
 //#define _di_f_type_sizes_d_
 
index ba1928c8cf6c18b31157326097b83185486ee870..e8218c60eede6d2ca8384fd7fd98503e058e82ca 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_conversion_number_signed_print__fails(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -14,7 +16,7 @@ void test__f_conversion_number_signed_print__fails(void **state) {
     will_return(__wrap_fwrite_unlocked, 0);
     will_return(__wrap_ferror_unlocked, true);
 
-    const f_status_t status = f_conversion_number_signed_print(1, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_signed_print(1, data, output);
 
     assert_int_equal(status, F_status_set_error(F_output));
   }
@@ -22,6 +24,8 @@ void test__f_conversion_number_signed_print__fails(void **state) {
 
 void test__f_conversion_number_signed_print__fails_for_prepend(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, F_conversion_data_flag_base_prepend_d, 0);
 
@@ -29,7 +33,7 @@ void test__f_conversion_number_signed_print__fails_for_prepend(void **state) {
     will_return(__wrap_fwrite_unlocked, 0);
     will_return(__wrap_ferror_unlocked, true);
 
-    const f_status_t status = f_conversion_number_signed_print(1, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_signed_print(1, data, output);
 
     assert_int_equal(status, F_status_set_error(F_output));
   }
@@ -37,6 +41,8 @@ void test__f_conversion_number_signed_print__fails_for_prepend(void **state) {
 
 void test__f_conversion_number_signed_print__fails_for_zero(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -44,7 +50,7 @@ void test__f_conversion_number_signed_print__fails_for_zero(void **state) {
     will_return(__wrap_fwrite_unlocked, 0);
     will_return(__wrap_ferror_unlocked, true);
 
-    const f_status_t status = f_conversion_number_signed_print(0, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_signed_print(0, data, output);
 
     assert_int_equal(status, F_status_set_error(F_output));
   }
@@ -52,19 +58,22 @@ void test__f_conversion_number_signed_print__fails_for_zero(void **state) {
 
 void test__f_conversion_number_signed_print__parameter_checking(void **state) {
 
+  f_file_t output = macro_f_file_t_initialize2(0, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(2, 0, 0);
 
-    const f_status_t status = f_conversion_number_signed_print(0, data, 0);
+    const f_status_t status = f_conversion_number_signed_print(0, data, output);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 
   {
-    FILE *file = 0;
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(1, 0, 0);
 
-    const f_status_t status = f_conversion_number_signed_print(0, data, file);
+    output.stream = F_type_output_d;
+
+    const f_status_t status = f_conversion_number_signed_print(0, data, output);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -72,6 +81,8 @@ void test__f_conversion_number_signed_print__parameter_checking(void **state) {
 
 void test__f_conversion_number_signed_print__works(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -81,7 +92,7 @@ void test__f_conversion_number_signed_print__works(void **state) {
 
     expect_string(__wrap_fwrite_unlocked, ptr, "1");
 
-    const f_status_t status = f_conversion_number_signed_print(1, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_signed_print(1, data, output);
 
     assert_int_equal(status, F_none);
   }
@@ -89,6 +100,8 @@ void test__f_conversion_number_signed_print__works(void **state) {
 
 void test__f_conversion_number_signed_print__works_for_zero(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -98,7 +111,7 @@ void test__f_conversion_number_signed_print__works_for_zero(void **state) {
 
     expect_string(__wrap_fwrite_unlocked, ptr, "0");
 
-    const f_status_t status = f_conversion_number_signed_print(0, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_signed_print(0, data, output);
 
     assert_int_equal(status, F_none);
   }
@@ -106,10 +119,12 @@ void test__f_conversion_number_signed_print__works_for_zero(void **state) {
 
 void test__f_conversion_number_signed_print__works_for_zero_with_width_zero(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 0);
 
-    const f_status_t status = f_conversion_number_signed_print(0, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_signed_print(0, data, output);
 
     assert_int_equal(status, F_none);
   }
index fb7396be6b9940f83221e07fc922bc57d33a852d..36fe479787e278dd8da90ee12e374270ad2e79ca 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_conversion_number_unsigned_print__fails(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -14,7 +16,7 @@ void test__f_conversion_number_unsigned_print__fails(void **state) {
     will_return(__wrap_fwrite_unlocked, 0);
     will_return(__wrap_ferror_unlocked, true);
 
-    const f_status_t status = f_conversion_number_unsigned_print(1, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_unsigned_print(1, data, output);
 
     assert_int_equal(status, F_status_set_error(F_output));
   }
@@ -22,6 +24,8 @@ void test__f_conversion_number_unsigned_print__fails(void **state) {
 
 void test__f_conversion_number_unsigned_print__fails_for_prepend(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, F_conversion_data_flag_base_prepend_d, 0);
 
@@ -29,7 +33,7 @@ void test__f_conversion_number_unsigned_print__fails_for_prepend(void **state) {
     will_return(__wrap_fwrite_unlocked, 0);
     will_return(__wrap_ferror_unlocked, true);
 
-    const f_status_t status = f_conversion_number_unsigned_print(1, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_unsigned_print(1, data, output);
 
     assert_int_equal(status, F_status_set_error(F_output));
   }
@@ -37,6 +41,8 @@ void test__f_conversion_number_unsigned_print__fails_for_prepend(void **state) {
 
 void test__f_conversion_number_unsigned_print__fails_for_zero(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -44,7 +50,7 @@ void test__f_conversion_number_unsigned_print__fails_for_zero(void **state) {
     will_return(__wrap_fwrite_unlocked, 0);
     will_return(__wrap_ferror_unlocked, true);
 
-    const f_status_t status = f_conversion_number_unsigned_print(0, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_unsigned_print(0, data, output);
 
     assert_int_equal(status, F_status_set_error(F_output));
   }
@@ -52,19 +58,22 @@ void test__f_conversion_number_unsigned_print__fails_for_zero(void **state) {
 
 void test__f_conversion_number_unsigned_print__parameter_checking(void **state) {
 
+  f_file_t output = macro_f_file_t_initialize2(0, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(2, 0, 0);
 
-    const f_status_t status = f_conversion_number_unsigned_print(0, data, 0);
+    const f_status_t status = f_conversion_number_unsigned_print(0, data, output);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 
   {
-    FILE *file = 0;
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(1, 0, 0);
 
-    const f_status_t status = f_conversion_number_unsigned_print(0, data, file);
+    output.stream = F_type_output_d;
+
+    const f_status_t status = f_conversion_number_unsigned_print(0, data, output);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -72,6 +81,8 @@ void test__f_conversion_number_unsigned_print__parameter_checking(void **state)
 
 void test__f_conversion_number_unsigned_print__works(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -81,7 +92,7 @@ void test__f_conversion_number_unsigned_print__works(void **state) {
 
     expect_string(__wrap_fwrite_unlocked, ptr, "1");
 
-    const f_status_t status = f_conversion_number_unsigned_print(1, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_unsigned_print(1, data, output);
 
     assert_int_equal(status, F_none);
   }
@@ -89,6 +100,8 @@ void test__f_conversion_number_unsigned_print__works(void **state) {
 
 void test__f_conversion_number_unsigned_print__works_for_zero(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 1);
 
@@ -98,7 +111,7 @@ void test__f_conversion_number_unsigned_print__works_for_zero(void **state) {
 
     expect_string(__wrap_fwrite_unlocked, ptr, "0");
 
-    const f_status_t status = f_conversion_number_unsigned_print(0, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_unsigned_print(0, data, output);
 
     assert_int_equal(status, F_none);
   }
@@ -106,10 +119,12 @@ void test__f_conversion_number_unsigned_print__works_for_zero(void **state) {
 
 void test__f_conversion_number_unsigned_print__works_for_zero_with_width_zero(void **state) {
 
+  const f_file_t output = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     const f_conversion_data_t data = macro_f_conversion_data_t_initialize(10, 0, 0);
 
-    const f_status_t status = f_conversion_number_unsigned_print(0, data, F_type_output_d);
+    const f_status_t status = f_conversion_number_unsigned_print(0, data, output);
 
     assert_int_equal(status, F_none);
   }
index 944d069af6c9d8cf805a593105057b0ecc4f245b..fbf2f7895e7df15a2f54d171821aea8633bb3c6f 100644 (file)
@@ -92,7 +92,7 @@ extern "C" {
         if (F_status_is_error(status)) return status;
       }
 
-      return private_f_file_copy_content(source, destination, size_block == 0 ? F_file_default_read_size_d : size_block);
+      return private_f_file_copy_content(source, destination, size_block == 0 ? F_file_default_size_read_d : size_block);
     }
 
     if (macro_f_file_type_is_link(source_stat.st_mode)) {
@@ -152,7 +152,7 @@ extern "C" {
       status = private_f_file_mode_set(destination, (~F_file_type_mask_d) & mode.regular);
       if (F_status_is_error(status)) return status;
 
-      return private_f_file_copy_content(source, destination, size_block == 0 ? F_file_default_read_size_d : size_block);
+      return private_f_file_copy_content(source, destination, size_block == 0 ? F_file_default_size_read_d : size_block);
     }
 
     if (macro_f_file_type_is_directory(source_stat.st_mode)) {
index eb547709fd297987572e331aa6c876d1a6c83d1e..52643da34c73ff1ef18f1a47a47cf97228133c22 100644 (file)
@@ -221,109 +221,6 @@ extern "C" {
 #endif // _di_f_file_at_d_
 
 /**
- * File flag related functionality.
- */
-#ifndef _di_f_file_flag_d_
-
-  // file open flags
-  #define F_file_flag_append_d             O_APPEND
-  #define F_file_flag_asynchronous_d       O_ASYNC
-  #define F_file_flag_create_d             O_CREAT
-  #define F_file_flag_close_execute_d      O_CLOEXEC
-  #define F_file_flag_direct_d             O_DIRECT
-  #define F_file_flag_directory_d          O_DIRECTORY
-  #define F_file_flag_exclusive_d          O_EXCL
-  #define F_file_flag_large_file_d         O_LARGEFILE
-  #define F_file_flag_no_access_time_d     O_NOATIME
-  #define F_file_flag_no_follow_d          O_NOFOLLOW
-  #define F_file_flag_no_tty_d             O_NOCTTY
-  #define F_file_flag_non_blocking_d       O_NONBLOCK
-  #define F_file_flag_path_d               010000000
-  #define F_file_flag_read_only_d          O_RDONLY
-  #define F_file_flag_read_write_d         O_RDWR
-  #define F_file_flag_synchronous_d        O_SYNC
-  #define F_file_flag_synchronous_direct_d O_DSYNC
-  #define F_file_flag_temporary_d          O_TMPFILE
-  #define F_file_flag_truncate_d           O_TRUNC
-  #define F_file_flag_write_only_d         O_WRONLY
-
-  // File open flags pre-combined with create.
-  #define F_file_flag_create_ro_d (O_CREAT | O_RDONLY)
-  #define F_file_flag_create_wo_d (O_CREAT | O_WRONLY)
-  #define F_file_flag_create_rw_d (O_CREAT | O_RDRW)
-
-  // File open flags pre-combined will fail if file exists.
-  #define F_file_flag_create_new_ro_d (O_CREAT | O_EXCL | O_RDONLY)
-  #define F_file_flag_create_new_wo_d (O_CREAT | O_EXCL | O_WRONLY)
-  #define F_file_flag_create_new_rw_d (O_CREAT | O_EXCL | O_RDRW)
-
-  // File open flags pre-combined will truncate any existing files to 0.
-  #define F_file_flag_truncate_ro_d (O_CREAT | O_TRUNC | O_RDONLY)
-  #define F_file_flag_truncate_rw_d (O_CREAT | O_TRUNC | O_RDRW)
-  #define F_file_flag_truncate_wo_d (O_CREAT | O_TRUNC | O_WRONLY)
-
-  // File open flags pre-combined will truncate any existing files to 0.
-  #define F_file_flag_append_rw_d (O_CREAT | O_APPEND | O_RDRW)
-  #define F_file_flag_append_wo_d (O_CREAT | O_APPEND | O_WRONLY)
-
-  // File open flags pre-combined with synchronous io.
-  #define F_file_flag_sync_ro_d            (O_SYNC | O_RDONLY)
-  #define F_file_flag_sync_wo_d            (O_SYNC | O_WRONLY)
-  #define F_file_flag_sync_rw_d            (O_SYNC | O_RDRW)
-  #define F_file_flag_sync_create_ro_d     (O_SYNC | O_CREAT | O_RDONLY)
-  #define F_file_flag_sync_create_wo_d     (O_SYNC | O_CREAT | O_WRONLY)
-  #define F_file_flag_sync_create_rw_d     (O_SYNC | O_CREAT | O_RDRW)
-  #define F_file_flag_sync_create_new_ro_d (O_SYNC | O_CREAT | O_EXCL | O_RDONLY)
-  #define F_file_flag_sync_create_new_wo_d (O_SYNC | O_CREAT | O_EXCL | O_WRONLY)
-  #define F_file_flag_sync_create_new_rw_d (O_SYNC | O_CREAT | O_EXCL | O_RDRW)
-
-  // File open flags pre-combined with asynchronous io.
-  #define F_file_flag_async_ro_d            (O_ASYNC | O_RDONLY)
-  #define F_file_flag_async_wo_d            (O_ASYNC | O_WRONLY)
-  #define F_file_flag_async_rw_d            (O_ASYNC | O_RDRW)
-  #define F_file_flag_async_create_ro_d     (O_ASYNC | O_CREAT | O_RDONLY)
-  #define F_file_flag_async_create_wo_d     (O_ASYNC | O_CREAT | O_WRONLY)
-  #define F_file_flag_async_create_rw_d     (O_ASYNC | O_CREAT | O_RDRW)
-  #define F_file_flag_async_create_new_ro_d (O_ASYNC | O_CREAT | O_EXCL | O_RDONLY)
-  #define F_file_flag_async_create_new_wo_d (O_ASYNC | O_CREAT | O_EXCL | O_WRONLY)
-  #define F_file_flag_async_create_new_rw_d (O_ASYNC | O_CREAT | O_EXCL | O_RDRW)
-
-  // File open flags pre-combined with direct io (which works synchronously).
-  #define F_file_flag_direct_ro_d            (O_DIRECT | O_RDONLY)
-  #define F_file_flag_direct_wo_d            (O_DIRECT | O_WRONLY)
-  #define F_file_flag_direct_rw_d            (O_DIRECT | O_RDRW)
-  #define F_file_flag_direct_create_ro_d     (O_DIRECT | O_CREAT | O_RDONLY)
-  #define F_file_flag_direct_create_wo_d     (O_DIRECT | O_CREAT | O_WRONLY)
-  #define F_file_flag_direct_create_rw_d     (O_DIRECT | O_CREAT | O_RDRW)
-  #define F_file_flag_direct_create_new_ro_d (O_DIRECT | O_CREAT | O_EXCL | O_RDONLY)
-  #define F_file_flag_direct_create_new_wo_d (O_DIRECT | O_CREAT | O_EXCL | O_WRONLY)
-  #define F_file_flag_direct_create_new_rw_d (O_DIRECT | O_CREAT | O_EXCL | O_RDRW)
-
-  // File open flags pre-combined with large_file.
-  #define F_file_flag_large_ro_d                  (O_LARGEFILE | O_RDONLY)
-  #define F_file_flag_large_wo_d                  (O_LARGEFILE | O_WRONLY)
-  #define F_file_flag_large_rw_d                  (O_LARGEFILE | O_RDRW)
-  #define F_file_flag_large_sync_ro_d             (O_LARGEFILE | O_SYNC | O_RDONLY)
-  #define F_file_flag_large_sync_wo_d             (O_LARGEFILE | O_SYNC | O_WRONLY)
-  #define F_file_flag_large_sync_rw_d             (O_LARGEFILE | O_SYNC | O_RDRW)
-  #define F_file_flag_large_sync_create_ro_d      (O_LARGEFILE | O_SYNC | O_CREAT | O_RDONLY)
-  #define F_file_flag_large_sync_create_wo_d      (O_LARGEFILE | O_SYNC | O_CREAT | O_WRONLY)
-  #define F_file_flag_large_sync_create_rw_d      (O_LARGEFILE | O_SYNC | O_CREAT | O_RDRW)
-  #define F_file_flag_large_sync_create_new_ro_d  (O_LARGEFILE | O_SYNC | O_CREAT | O_EXCL | O_RDONLY)
-  #define F_file_flag_large_sync_create_new_wo_d  (O_LARGEFILE | O_SYNC | O_CREAT | O_EXCL | O_WRONLY)
-  #define F_file_flag_large_sync_create_new_rw_d  (O_LARGEFILE | O_SYNC | O_CREAT | O_EXCL | O_RDRW)
-  #define F_file_flag_large_async_ro_d            (O_LARGEFILE | O_ASYNC | O_RDONLY)
-  #define F_file_flag_large_async_wo_d            (O_LARGEFILE | O_ASYNC | O_WRONLY)
-  #define F_file_flag_large_async_rw_d            (O_LARGEFILE | O_ASYNC | O_RDRW)
-  #define F_file_flag_large_async_create_ro_d     (O_LARGEFILE | O_ASYNC | O_CREAT | O_RDONLY)
-  #define F_file_flag_large_async_create_wo_d     (O_LARGEFILE | O_ASYNC | O_CREAT | O_WRONLY)
-  #define F_file_flag_large_async_create_rw_d     (O_LARGEFILE | O_ASYNC | O_CREAT | O_RDRW)
-  #define F_file_flag_large_async_create_new_ro_d (O_LARGEFILE | O_ASYNC | O_CREAT | O_EXCL | O_RDONLY)
-  #define F_file_flag_large_async_create_new_wo_d (O_LARGEFILE | O_ASYNC | O_CREAT | O_EXCL | O_WRONLY)
-  #define F_file_flag_large_async_create_new_rw_d (O_LARGEFILE | O_ASYNC | O_CREAT | O_EXCL | O_RDRW)
-#endif // _di_f_file_flag_d_
-
-/**
  * File mode related functionality.
  *
  * There are two types of file modes that the f_file_mode_t macros are associated with.
index 2691cde669d4cb7640e7d0dc9f79422850c73549..0be7546fc34d5278354bd83c0ed9576d3d78eb71 100644 (file)
@@ -5,7 +5,7 @@
 extern "C" {
 #endif
 
-#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
   f_status_t private_f_file_close(f_file_t * const file) {
 
     if (close(file->id) < 0) {
@@ -28,7 +28,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
 
 #if !defined(_di_f_file_copy_) || !defined(_di_f_file_clone_)
   f_status_t private_f_file_copy_content(const f_string_static_t source, const f_string_static_t destination, const f_number_unsigned_t size_block) {
@@ -234,7 +234,7 @@ extern "C" {
   }
 #endif // !defined(_di_f_file_create_device_at_) || !defined(_di_f_file_create_node_at_)
 
-#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
   f_status_t private_f_file_flush(const f_file_t file) {
 
     if (fsync(file.id) < 0) {
@@ -250,7 +250,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
 
 #if !defined(_di_f_file_link_) || !defined(_di_f_file_copy_)
   f_status_t private_f_file_link(const f_string_static_t target, const f_string_static_t point) {
index e0763a80fa457c30a68f7df6cf8ea692897cb23f..baa6307f1f6ecc2e58d0c6db77519abe951d6b4b 100644 (file)
@@ -41,15 +41,14 @@ extern "C" {
  * @see f_file_clone()
  * @see f_file_clone_at()
  * @see f_file_close()
- * @see f_file_close_flush()
  * @see f_file_copy()
  * @see f_file_create()
  * @see f_file_create_at()
  * @see f_file_stream_close()
  */
-#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
   extern f_status_t private_f_file_close(f_file_t * const file) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
 
 /**
  * Copy a file.
@@ -377,15 +376,14 @@ extern "C" {
  * @see f_file_clone()
  * @see f_file_clone_at()
  * @see f_file_close()
- * @see f_file_close_flush()
  * @see f_file_copy()
  * @see f_file_create()
  * @see f_file_create_at()
  * @see f_file_stream_close()
  */
-#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#if !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
   extern f_status_t private_f_file_flush(const f_file_t file) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_close_flush_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
+#endif // !defined(_di_f_file_clone_) || !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_create_) || !defined(_di_f_file_create_at_) || !defined(_di_f_file_stream_close_)
 
 /**
  * Private implementation of f_file_link().
index 5d8d7331ea6664a533d5a0efdce4d93baa902866..a382816b4122f210f141a0d89e06b42810f09202 100644 (file)
@@ -25,7 +25,7 @@ build_language c
 build_libraries -lc -lcmocka
 build_libraries-individual -lf_memory -lf_string -lf_file
 
-build_sources_program test-file-access.c test-file-access_at.c test-file-clone.c test-file-close.c test-file-close_flush.c test-file-copy.c test-file-create.c test-file-create_at.c test-file-create_device.c test-file-create_device_at.c test-file-create_fifo.c test-file-create_fifo_at.c test-file-create_node.c test-file-create_node_at.c test-file-descriptor.c test-file-exists.c test-file-exists_at.c test-file-flush.c test-file-group_read.c test-file-is.c test-file-is_at.c test-file-is_stat.c test-file-link.c test-file-link_at.c test-file-link_hard.c test-file-link_hard_at.c test-file-link_read.c test-file-link_read_at.c test-file-mode_determine.c test-file-mode_from_string.c test-file-mode_read.c test-file-mode_read_at.c test-file-mode_set.c test-file-mode_set_at.c test-file-mode_to_mode.c test-file-name_base.c test-file-name_directory.c test-file-open.c test-file-open_at.c test-file-owner_read.c test-file-read.c test-file-read_block.c test-file-read_until.c test-file-remove.c test-file-remove_at.c test-file-rename.c test-file-rename_at.c test-file-role_change.c test-file-role_change_at.c test-file-seek.c test-file-size.c test-file-size_at.c test-file-size_by_id.c test-file-stat.c test-file-stat_at.c test-file-stat_by_id.c test-file-stream_close.c test-file-stream_open_descriptor.c test-file-stream_open.c test-file-stream_read.c test-file-stream_read_block.c test-file-stream_read_until.c test-file-stream_reopen.c test-file-stream_write.c test-file-stream_write_block.c test-file-stream_write_until.c test-file-stream_write_range.c test-file-touch.c test-file-touch_at.c test-file-type.c test-file-type_at.c test-file-umask_get.c test-file-umask_set.c test-file-write.c test-file-write_block.c test-file-write_until.c test-file-write_range.c
+build_sources_program test-file-access.c test-file-access_at.c test-file-clone.c test-file-close.c test-file-copy.c test-file-create.c test-file-create_at.c test-file-create_device.c test-file-create_device_at.c test-file-create_fifo.c test-file-create_fifo_at.c test-file-create_node.c test-file-create_node_at.c test-file-descriptor.c test-file-exists.c test-file-exists_at.c test-file-flush.c test-file-group_read.c test-file-is.c test-file-is_at.c test-file-is_stat.c test-file-link.c test-file-link_at.c test-file-link_hard.c test-file-link_hard_at.c test-file-link_read.c test-file-link_read_at.c test-file-mode_determine.c test-file-mode_from_string.c test-file-mode_read.c test-file-mode_read_at.c test-file-mode_set.c test-file-mode_set_at.c test-file-mode_to_mode.c test-file-name_base.c test-file-name_directory.c test-file-open.c test-file-open_at.c test-file-owner_read.c test-file-read.c test-file-read_block.c test-file-read_until.c test-file-remove.c test-file-remove_at.c test-file-rename.c test-file-rename_at.c test-file-role_change.c test-file-role_change_at.c test-file-seek.c test-file-size.c test-file-size_at.c test-file-size_by_id.c test-file-stat.c test-file-stat_at.c test-file-stat_by_id.c test-file-stream_close.c test-file-stream_open_descriptor.c test-file-stream_open.c test-file-stream_read.c test-file-stream_read_block.c test-file-stream_read_until.c test-file-stream_reopen.c test-file-stream_write.c test-file-stream_write_block.c test-file-stream_write_until.c test-file-stream_write_range.c test-file-touch.c test-file-touch_at.c test-file-type.c test-file-type_at.c test-file-umask_get.c test-file-umask_set.c test-file-write.c test-file-write_block.c test-file-write_until.c test-file-write_range.c
 build_sources_program test-file.c
 
 build_script no
index 62a8584115957209e974590dbf7734f20626109b..abb6ed2ed490249ac331001c59ffd05dde91bf08 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_access_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -43,7 +44,7 @@ void test__f_file_access_at__fails(void **state) {
       will_return(__wrap_faccessat, true);
       will_return(__wrap_faccessat, errnos[i]);
 
-      const f_status_t status = f_file_access_at(0, path, F_file_access_mode_exist_d, 0);
+      const f_status_t status = f_file_access_at(file, path, F_file_access_mode_exist_d, 0);
 
       assert_int_equal(status, statuss[i]);
     } // for
@@ -91,7 +92,7 @@ void test__f_file_access_at__fails(void **state) {
         will_return(__wrap_faccessat, true);
         will_return(__wrap_faccessat, errnos[i]);
 
-        const f_status_t status = f_file_access_at(0, path, modes[j], 0);
+        const f_status_t status = f_file_access_at(file, path, modes[j], 0);
 
         assert_int_equal(status, statuss[i]);
       } // for
@@ -101,22 +102,36 @@ void test__f_file_access_at__fails(void **state) {
 
 void test__f_file_access_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_access_at(0, f_string_empty_s, 0, 0);
+    const f_status_t status = f_file_access_at(file, f_string_empty_s, 0, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_access_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_access_at(file, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_access_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
     will_return(__wrap_faccessat, false);
     will_return(__wrap_faccessat, 0);
 
-    const f_status_t status = f_file_access_at(0, path, F_file_access_mode_exist_d, 0);
+    const f_status_t status = f_file_access_at(file, path, F_file_access_mode_exist_d, 0);
 
     assert_int_equal(status, F_true);
   }
index d7702e61941b8a1b8dad0a1ae2837c884c8dc72e..d38542445e9cc0a56ab6729bb8202cb90b8abe75 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_access_at__fails(void **state);
 extern void test__f_file_access_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_access_at()
+ */
+extern void test__f_file_access_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_access_at()
index a0a4349007c10f55a33a024d7f7d512de85924ef..8dd5a3dde79902ecda923411211d3fac45e43132 100644 (file)
@@ -28,20 +28,20 @@ void test__f_file_close__fails(void **state) {
 
     for (int i = 0; i < 6; ++i) {
 
-      int id = 0;
+      f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
       will_return(__wrap_close, true);
       will_return(__wrap_close, errnos[i]);
 
-      const f_status_t status = f_file_close(&id);
+      const f_status_t status = f_file_close(&file);
 
       assert_int_equal(status, F_status_set_error(statuss[i]));
 
       if (errnos[i] == EBADF || errnos[i] == EINTR) {
-        assert_int_equal(id, 0);
+        assert_int_equal(file.id, F_type_descriptor_output_d);
       }
       else {
-        assert_int_equal(id, -1);
+        assert_int_equal(file.id, -1);
       }
     } // for
   }
@@ -56,30 +56,30 @@ void test__f_file_close__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_close__works(void **state) {
-
-  {
-    int id = 0;
+void test__f_file_close__returns_file_descriptor_not(void **state) {
 
-    will_return(__wrap_close, false);
-    will_return(__wrap_close, 0);
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
 
-    const f_status_t status = f_file_close(&id);
+  {
+    const f_status_t status = f_file_close(&file);
 
-    assert_int_equal(status, F_none);
-    assert_int_equal(id, -1);
+    assert_int_equal(status, F_file_descriptor_not);
   }
 }
 
-void test__f_file_close__works_already_closed(void **state) {
+void test__f_file_close__works(void **state) {
+
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
   {
-    int id = -1;
 
-    const f_status_t status = f_file_close(&id);
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 0);
+
+    const f_status_t status = f_file_close(&file);
 
     assert_int_equal(status, F_none);
-    assert_int_equal(id, -1);
+    assert_int_equal(file.id, -1);
   }
 }
 
index a21cf13e31b67722526f9f2b5cddfed3f6dac554..5746d83617e1423059d83d293a0a8dced041b3f2 100644 (file)
@@ -25,17 +25,17 @@ extern void test__f_file_close__fails(void **state);
 extern void test__f_file_close__parameter_checking(void **state);
 
 /**
- * Test that function works.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_close()
  */
-extern void test__f_file_close__works(void **state);
+extern void test__f_file_close__returns_file_descriptor_not(void **state);
 
 /**
- * Test that function works when already closed.
+ * Test that function works.
  *
  * @see f_file_close()
  */
-extern void test__f_file_close__works_already_closed(void **state);
+extern void test__f_file_close__works(void **state);
 
 #endif // _TEST__F_file_close_h
diff --git a/level_0/f_file/tests/unit/c/test-file-close_flush.c b/level_0/f_file/tests/unit/c/test-file-close_flush.c
deleted file mode 100644 (file)
index fc7f370..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "test-file.h"
-#include "test-file-close_flush.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_file_close_flush__fails(void **state) {
-
-  {
-    int errnos[] = {
-      EBADF,
-      EINTR,
-      EIO,
-      ENOSPC,
-      EDQUOT,
-      mock_errno_generic,
-    };
-
-    f_status_t statuss[] = {
-      F_file_descriptor,
-      F_interrupt,
-      F_input_output,
-      F_space_not,
-      F_filesystem_quota_block,
-      F_file_close,
-    };
-
-    for (int i = 0; i < 6; ++i) {
-
-      int id = 0;
-
-      will_return(__wrap_fsync, false);
-      will_return(__wrap_fsync, 0);
-
-      will_return(__wrap_close, true);
-      will_return(__wrap_close, errnos[i]);
-
-      const f_status_t status = f_file_close_flush(&id);
-
-      assert_int_equal(status, F_status_set_error(statuss[i]));
-
-      if (errnos[i] == EBADF || errnos[i] == EINTR) {
-        assert_int_equal(id, 0);
-      }
-      else {
-        assert_int_equal(id, -1);
-      }
-    } // for
-  }
-}
-
-void test__f_file_close_flush__parameter_checking(void **state) {
-
-  {
-    const f_status_t status = f_file_close_flush(0);
-
-    assert_int_equal(status, F_status_set_error(F_parameter));
-  }
-}
-
-void test__f_file_close_flush__works(void **state) {
-
-  {
-    int id = 0;
-
-    will_return(__wrap_fsync, false);
-    will_return(__wrap_fsync, 0);
-
-    will_return(__wrap_close, false);
-    will_return(__wrap_close, 0);
-
-    const f_status_t status = f_file_close_flush(&id);
-
-    assert_int_equal(status, F_none);
-    assert_int_equal(id, -1);
-  }
-}
-
-void test__f_file_close_flush__works_already_closed(void **state) {
-
-  {
-    int id = -1;
-
-    const f_status_t status = f_file_close_flush(&id);
-
-    assert_int_equal(status, F_none);
-    assert_int_equal(id, -1);
-  }
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-close_flush.h b/level_0/f_file/tests/unit/c/test-file-close_flush.h
deleted file mode 100644 (file)
index dd709e9..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: File
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the file project.
- */
-#ifndef _TEST__F_file_close_flush_h
-#define _TEST__F_file_close_flush_h
-
-/**
- * Test that function fails.
- *
- * @see f_file_close_flush()
- */
-extern void test__f_file_close_flush__fails(void **state);
-
-/**
- * Test that parameter checking works as expected.
- *
- * @see f_file_close_flush()
- */
-extern void test__f_file_close_flush__parameter_checking(void **state);
-
-/**
- * Test that function works.
- *
- * @see f_file_close_flush()
- */
-extern void test__f_file_close_flush__works(void **state);
-
-/**
- * Test that function works.
- *
- * @see f_file_close_flush()
- */
-extern void test__f_file_close_flush__works_already_closed(void **state);
-
-#endif // _TEST__F_file_close_flush_h
index 056fe85225bdca49276d730853381946ef915d81..5e3e04c92d277a45acc0ca81d95e4fae892a8d2f 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_create_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -65,7 +66,7 @@ void test__f_file_create_at__fails(void **state) {
       will_return(__wrap_openat, true);
       will_return(__wrap_openat, errnos[i]);
 
-      const f_status_t status = f_file_create_at(0, path, 0, F_false);
+      const f_status_t status = f_file_create_at(file, path, 0, F_false);
 
       assert_int_equal(status, F_status_set_error(statuss[i]));
     } // for
@@ -101,7 +102,7 @@ void test__f_file_create_at__fails(void **state) {
       will_return(__wrap_close, true);
       will_return(__wrap_close, errnos[i]);
 
-      const f_status_t status = f_file_create_at(0, path, 0, F_false);
+      const f_status_t status = f_file_create_at(file, path, 0, F_false);
 
       assert_int_equal(status, F_status_set_error(statuss[i]));
     } // for
@@ -110,15 +111,29 @@ void test__f_file_create_at__fails(void **state) {
 
 void test__f_file_create_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_create_at(0, f_string_empty_s, 0, F_false);
+    const f_status_t status = f_file_create_at(file, f_string_empty_s, 0, F_false);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_create_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_create_at(file, f_string_empty_s, 0, F_false);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_create_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -131,7 +146,7 @@ void test__f_file_create_at__works(void **state) {
     will_return(__wrap_close, false);
     will_return(__wrap_close, 0);
 
-    const f_status_t status = f_file_create_at(0, path, 0, F_false);
+    const f_status_t status = f_file_create_at(file, path, 0, F_false);
 
     assert_int_equal(status, F_none);
   }
index 2aaf173df5bbc1e7ad8e5108ab831578b58d19f7..3c9badd86f56c2eedbc737525e2809fe82af5a33 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_create_at__fails(void **state);
 extern void test__f_file_create_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_create_at()
+ */
+extern void test__f_file_create_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_create_at()
index 970d615a76a9e71945deaa8eee1542236d3d2e5a..a04e8b5b5b101c0ed8b75c8ec75bbfda482d9248 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_create_device_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -61,7 +62,7 @@ void test__f_file_create_device_at__fails(void **state) {
         will_return(__wrap_mknodat, true);
         will_return(__wrap_mknodat, errnos[i]);
 
-        const f_status_t status = f_file_create_device_at(0, path, modes[j], 1, 1);
+        const f_status_t status = f_file_create_device_at(file, path, modes[j], 1, 1);
 
         assert_int_equal(status, F_status_set_error(statuss[i]));
       } // for
@@ -71,15 +72,29 @@ void test__f_file_create_device_at__fails(void **state) {
 
 void test__f_file_create_device_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_create_device_at(0, f_string_empty_s, 0, 0, 0);
+    const f_status_t status = f_file_create_device_at(file, f_string_empty_s, 0, 0, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_create_device_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_create_device_at(file, f_string_empty_s, 0, 0, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_create_device_at__returns_supported_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   const int modes[] = {
@@ -93,7 +108,7 @@ void test__f_file_create_device_at__returns_supported_not(void **state) {
   {
     for (uint8_t i = 0; i < 5; ++i) {
 
-      const f_status_t status = f_file_create_device_at(0, path, modes[i], 0, 0);
+      const f_status_t status = f_file_create_device_at(file, path, modes[i], 0, 0);
 
       assert_int_equal(F_status_set_fine(status), F_support_not);
     } // for
@@ -102,6 +117,7 @@ void test__f_file_create_device_at__returns_supported_not(void **state) {
 
 void test__f_file_create_device_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   const int modes[] = {
@@ -116,7 +132,7 @@ void test__f_file_create_device_at__works(void **state) {
       will_return(__wrap_mknodat, false);
       will_return(__wrap_mknodat, 0);
 
-      const f_status_t status = f_file_create_device_at(0, path, modes[i], 1, 1);
+      const f_status_t status = f_file_create_device_at(file, path, modes[i], 1, 1);
 
       assert_int_equal(status, F_none);
     } // for
index 78b3a0a8bed76644472faeac9adce975fc3147ad..beeb1797cfe190da334601f3a4897fbc2246444a 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_create_device_at__fails(void **state);
 extern void test__f_file_create_device_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_create_device_at()
+ */
+extern void test__f_file_create_device_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works but the file type is not supported (specified via mode).
  *
  * @see f_file_create_device_at()
index a30d6f56e0a5e04a5998e8c5100046257f35b0fe..a2e1f7284c7283e36a7bb30a39542aaa8179dba4 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_create_fifo_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -43,7 +44,7 @@ void test__f_file_create_fifo_at__fails(void **state) {
       will_return(__wrap_mkfifoat, true);
       will_return(__wrap_mkfifoat, errnos[i]);
 
-      const f_status_t status = f_file_create_fifo_at(0, path, 0);
+      const f_status_t status = f_file_create_fifo_at(file, path, 0);
 
       assert_int_equal(status, F_status_set_error(statuss[i]));
     } // for
@@ -52,15 +53,29 @@ void test__f_file_create_fifo_at__fails(void **state) {
 
 void test__f_file_create_fifo_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_create_fifo_at(0, f_string_empty_s, 0);
+    const f_status_t status = f_file_create_fifo_at(file, f_string_empty_s, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_create_fifo_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_create_fifo_at(file, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_create_fifo_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   for (uint8_t i = 0; i < 3; ++i) {
@@ -68,7 +83,7 @@ void test__f_file_create_fifo_at__works(void **state) {
     will_return(__wrap_mkfifoat, false);
     will_return(__wrap_mkfifoat, 0);
 
-    const f_status_t status = f_file_create_fifo_at(0, path, 0);
+    const f_status_t status = f_file_create_fifo_at(file, path, 0);
 
     assert_int_equal(status, F_none);
   } // for
index 963b797eb8eda8e12628e5755dbbecc70a82e2c2..189cabf95c378bcc9b19294646c204b53f9bf1a3 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_create_fifo_at__fails(void **state);
 extern void test__f_file_create_fifo_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_create_fifo_at()
+ */
+extern void test__f_file_create_fifo_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_create_fifo_at()
index 952984d97859506ed7c9a06fdc6431b921ee13ca..027e9d0b998da57160971c40399d95b3883f8720 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_create_node_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -61,7 +62,7 @@ void test__f_file_create_node_at__fails(void **state) {
         will_return(__wrap_mknodat, true);
         will_return(__wrap_mknodat, errnos[i]);
 
-        const f_status_t status = f_file_create_node_at(0, path, modes[j], 1);
+        const f_status_t status = f_file_create_node_at(file, path, modes[j], 1);
 
         assert_int_equal(status, F_status_set_error(statuss[i]));
       } // for
@@ -71,15 +72,29 @@ void test__f_file_create_node_at__fails(void **state) {
 
 void test__f_file_create_node_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_create_node_at(0, f_string_empty_s, 0, 0);
+    const f_status_t status = f_file_create_node_at(file, f_string_empty_s, 0, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_create_node_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_create_node_at(file, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_create_node_at__returns_supported_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   const int modes[] = {
@@ -93,7 +108,7 @@ void test__f_file_create_node_at__returns_supported_not(void **state) {
   {
     for (uint8_t i = 0; i < 5; ++i) {
 
-      const f_status_t status = f_file_create_node_at(0, path, modes[i], 0);
+      const f_status_t status = f_file_create_node_at(file, path, modes[i], 0);
 
       assert_int_equal(F_status_set_fine(status), F_support_not);
     } // for
@@ -102,6 +117,7 @@ void test__f_file_create_node_at__returns_supported_not(void **state) {
 
 void test__f_file_create_node_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   const int modes[] = {
@@ -116,7 +132,7 @@ void test__f_file_create_node_at__works(void **state) {
       will_return(__wrap_mknodat, false);
       will_return(__wrap_mknodat, 0);
 
-      const f_status_t status = f_file_create_node_at(0, path, modes[i], 1);
+      const f_status_t status = f_file_create_node_at(file, path, modes[i], 1);
 
       assert_int_equal(status, F_none);
     } // for
index b3a8ebd224bf66b7eb51ec12148a37bd6206dc4f..60c4c7ee6841291e7ae0dd3d15ec29737b2c70ff 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_create_node_at__fails(void **state);
 extern void test__f_file_create_node_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_create_node_at()
+ */
+extern void test__f_file_create_node_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works but the file type is not supported (specified via mode).
  *
  * @see f_file_create_node_at()
index ba2d6bfd4d5b74468ab4e26f6c5ff00965b94032..03a53951a37cb672849e7caa32a90ac7615a331f 100644 (file)
@@ -8,13 +8,13 @@ extern "C" {
 void test__f_file_descriptor__fails(void **state) {
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
     will_return(__wrap_fileno, -1);
 
     const f_status_t status = f_file_descriptor(&file);
 
-    assert_int_equal(F_status_set_fine(status), F_stream_not);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 }
 
@@ -27,18 +27,28 @@ void test__f_file_descriptor__parameter_checking(void **state) {
   }
 }
 
+void test__f_file_descriptor__returns_stream_not(void **state) {
+
+  f_file_t file = macro_f_file_t_initialize2(0, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_descriptor(&file);
+
+    assert_int_equal(status, F_stream_not);
+  }
+}
+
 void test__f_file_descriptor__works(void **state) {
 
   {
-    const int id = 1;
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
-    will_return(__wrap_fileno, id);
+    will_return(__wrap_fileno, F_type_descriptor_output_d);
 
     const f_status_t status = f_file_descriptor(&file);
 
     assert_int_equal(status, F_none);
-    assert_int_equal(file.id, id);
+    assert_int_equal(file.id, F_type_descriptor_output_d);
   }
 }
 
index 51eb13bb496ce8e4af83782923cf963eb936c0b4..4c87d2b378b655e1a5ddf8065e44d3c7c612699c 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_descriptor__fails(void **state);
 extern void test__f_file_descriptor__parameter_checking(void **state);
 
 /**
+ * Test that function works but the stream is not valid.
+ *
+ * @see f_file_descriptor()
+ */
+extern void test__f_file_descriptor__returns_stream_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_descriptor()
index a1bccc17134cff93a970b1d6edbb84c92905ae83..2e00bdb9d2c8269097ee1eefc2360eec8da423e2 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_exists_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -40,7 +41,7 @@ void test__f_file_exists_at__fails(void **state) {
     will_return(__wrap_fstatat, true);
     will_return(__wrap_fstatat, errnos[i]);
 
-    const f_status_t status = f_file_exists_at(0, path, 0);
+    const f_status_t status = f_file_exists_at(file, path, 0);
 
     assert_int_equal(status, statuss[i]);
   } // for
@@ -48,15 +49,29 @@ void test__f_file_exists_at__fails(void **state) {
 
 void test__f_file_exists_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_exists_at(0, f_string_empty_s, 0);
+    const f_status_t status = f_file_exists_at(file, f_string_empty_s, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_exists_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_exists_at(file, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_exists_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   struct stat statistics;
@@ -70,7 +85,7 @@ void test__f_file_exists_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_exists_at(0, path, 0);
+    const f_status_t status = f_file_exists_at(file, path, 0);
 
     assert_int_equal(status, F_true);
   }
index 6ae3ea37e9c1147abf9fa60adbffb5a8d16b4a3a..a7e8122c852eeae6f1af92fcf468408adf63eaf8 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_exists_at__fails(void **state);
 extern void test__f_file_exists_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_exists_at()
+ */
+extern void test__f_file_exists_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_exists_at()
index 7641af54203bb362a467ee24d16cc392eb0c62f7..cef7bdb398bd64d102f8ef1632514d3ebb69cd06 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_file_flush__fails(void **state) {
 
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   int errnos[] = {
     EBADF,
     EDQUOT,
@@ -32,19 +34,32 @@ void test__f_file_flush__fails(void **state) {
     will_return(__wrap_fsync, true);
     will_return(__wrap_fsync, errnos[i]);
 
-    const f_status_t status = f_file_flush(0);
+    const f_status_t status = f_file_flush(file);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
 }
 
+void test__f_file_flush__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_flush(file);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_flush__works(void **state) {
 
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     will_return(__wrap_fsync, false);
     will_return(__wrap_fsync, 0);
 
-    const f_status_t status = f_file_flush(0);
+    const f_status_t status = f_file_flush(file);
 
     assert_int_equal(status, F_none);
   }
index 67ffb38fcee224e663b2e4d44e72c5e2af803067..ccd303aebb2364efed9939e3dd8387a656a90305 100644 (file)
 extern void test__f_file_flush__fails(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_flush()
+ */
+extern void test__f_file_flush__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_flush()
index 08684b150e244e03767078bc09c7317f4353f780..95507e5b9349ee18ef20306a83997111652f58e0 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_is_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -53,7 +54,7 @@ void test__f_file_is_at__fails(void **state) {
       will_return(__wrap_fstatat, true);
       will_return(__wrap_fstatat, errnos[i]);
 
-      const f_status_t status = f_file_is_at(0, path, types[j], 0);
+      const f_status_t status = f_file_is_at(file, path, types[j], 0);
 
       assert_int_equal(status, statuss[i]);
     } // for
@@ -62,15 +63,29 @@ void test__f_file_is_at__fails(void **state) {
 
 void test__f_file_is_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_is_at(0, f_string_empty_s, 0, 0);
+    const f_status_t status = f_file_is_at(file, f_string_empty_s, 0, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_is_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_is_at(file, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_is_at__returns_false(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   f_status_t types[] = {
@@ -101,7 +116,7 @@ void test__f_file_is_at__returns_false(void **state) {
       will_return(__wrap_fstatat, &statistics);
       will_return(__wrap_fstatat, 0);
 
-      const f_status_t status = f_file_is_at(0, path, types[i], 0);
+      const f_status_t status = f_file_is_at(file, path, types[i], 0);
 
       assert_int_equal(status, F_false);
     } // for
@@ -110,6 +125,7 @@ void test__f_file_is_at__returns_false(void **state) {
 
 void test__f_file_is_at__returns_true(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   f_status_t types[] = {
@@ -140,7 +156,7 @@ void test__f_file_is_at__returns_true(void **state) {
       will_return(__wrap_fstatat, &statistics);
       will_return(__wrap_fstatat, 0);
 
-      const f_status_t status = f_file_is_at(0, path, types[i], 0);
+      const f_status_t status = f_file_is_at(file, path, types[i], 0);
 
       assert_int_equal(status, F_true);
     } // for
index b43810cf1484af928d178fa5e57121e3f43cf86f..1fbb827e1c7c19677846883608391e9f3c5d966f 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_is_at__fails(void **state);
 extern void test__f_file_is_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_is_at()
+ */
+extern void test__f_file_is_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works and returns F_false.
  *
  * @see f_file_is_at()
index 6aa8eed3359e049ae71abd1156a3c6c64216d1db..aafcee0cf05423211694fa4966671bad0b4e8a97 100644 (file)
 #define _TEST__F_file_is_stat_h
 
 /**
- * Test that function fails.
- *
- * @see f_file_is_stat()
- */
-extern void test__f_file_is_stat__fails(void **state);
-
-/**
  * Test that function works and returns F_false.
  *
  * @see f_file_is_stat()
index 73993bb446425e4df1af1190b0219afb6c4fa5b2..0d1827be649980064987065699fd041bbc5efe2c 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_link_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -58,7 +59,7 @@ void test__f_file_link_at__fails(void **state) {
     will_return(__wrap_symlinkat, true);
     will_return(__wrap_symlinkat, errnos[i]);
 
-    const f_status_t status = f_file_link_at(0, path, path);
+    const f_status_t status = f_file_link_at(file, path, path);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -66,36 +67,50 @@ void test__f_file_link_at__fails(void **state) {
 
 void test__f_file_link_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    const f_status_t status = f_file_link_at(0, f_string_empty_s, f_string_empty_s);
+    const f_status_t status = f_file_link_at(file, f_string_empty_s, f_string_empty_s);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_link_at(0, path, f_string_empty_s);
+    const f_status_t status = f_file_link_at(file, path, f_string_empty_s);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_link_at(0, f_string_empty_s, path);
+    const f_status_t status = f_file_link_at(file, f_string_empty_s, path);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_link_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    const f_status_t status = f_file_link_at(file, path, path);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_link_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
     will_return(__wrap_symlinkat, false);
     will_return(__wrap_symlinkat, 0);
 
-    const f_status_t status = f_file_link_at(0, path, path);
+    const f_status_t status = f_file_link_at(file, path, path);
 
     assert_int_equal(status, F_none);
   }
index 46ab52067b41e8b4650df45ee9039d0ee20939ba..ac32c1f212eb68d45ed49b286e75bc40994c124e 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_link_at__fails(void **state);
 extern void test__f_file_link_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_link_at()
+ */
+extern void test__f_file_link_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_link_at()
index 23d7c74345a9f062f5247e48d02be59a1ab56e53..f5c596d22035aa57aa39458bd8d2a133e47e2626 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_file_link_hard_at__fails(void **state) {
 
+  const f_file_t target = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_file_t point = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -58,7 +60,7 @@ void test__f_file_link_hard_at__fails(void **state) {
     will_return(__wrap_linkat, true);
     will_return(__wrap_linkat, errnos[i]);
 
-    const f_status_t status = f_file_link_hard_at(0, 0, path, path, 0);
+    const f_status_t status = f_file_link_hard_at(target, point, path, path, 0);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -66,36 +68,62 @@ void test__f_file_link_hard_at__fails(void **state) {
 
 void test__f_file_link_hard_at__returns_data_not(void **state) {
 
+  const f_file_t target = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_file_t point = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    const f_status_t status = f_file_link_hard_at(0, 0, f_string_empty_s, f_string_empty_s, 0);
+    const f_status_t status = f_file_link_hard_at(target, point, f_string_empty_s, f_string_empty_s, 0);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_link_hard_at(0, 0, path, f_string_empty_s, 0);
+    const f_status_t status = f_file_link_hard_at(target, point, path, f_string_empty_s, 0);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_link_hard_at(0, 0, f_string_empty_s, path, 0);
+    const f_status_t status = f_file_link_hard_at(target, point, f_string_empty_s, path, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_link_hard_at__returns_file_descriptor_not(void **state) {
+
+  f_file_t target = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  f_file_t point = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    const f_status_t status = f_file_link_hard_at(target, point, path, path, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+
+  {
+    target.id = F_type_descriptor_output_d;
+    point.id = -1;
+
+    const f_status_t status = f_file_link_hard_at(target, point, path, path, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_link_hard_at__works(void **state) {
 
+  const f_file_t target = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_file_t point = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
     will_return(__wrap_linkat, false);
     will_return(__wrap_linkat, 0);
 
-    const f_status_t status = f_file_link_hard_at(0, 0, path, path, 0);
+    const f_status_t status = f_file_link_hard_at(target, point, path, path, 0);
 
     assert_int_equal(status, F_none);
   }
index 3d8a45308eb00a20953d3a5f1242bed2bef565a7..7ad2de19d6e48d9a0de0a2c37441df5ff93ba05e 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_link_hard_at__fails(void **state);
 extern void test__f_file_link_hard_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_link_hard_at()
+ */
+extern void test__f_file_link_hard_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_link_hard_at()
index 52c10ac26cdd7a615d6c13244330114559171dfd..a70c92ca7ebbd3fb87ef0f7e5975b5c24a1b7a62 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_link_read_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -54,7 +55,7 @@ void test__f_file_link_read_at__fails(void **state) {
     will_return(__wrap_readlinkat, true);
     will_return(__wrap_readlinkat, errnos[i]);
 
-    const f_status_t status = f_file_link_read_at(0, path, 0, &buffer);
+    const f_status_t status = f_file_link_read_at(file, path, 0, &buffer);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -64,10 +65,11 @@ void test__f_file_link_read_at__fails(void **state) {
 
 void test__f_file_link_read_at__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
 
   {
-    const f_status_t status = f_file_link_read_at(0, f_string_empty_s, 0, 0);
+    const f_status_t status = f_file_link_read_at(file, f_string_empty_s, 0, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -77,10 +79,11 @@ void test__f_file_link_read_at__parameter_checking(void **state) {
 
 void test__f_file_link_read_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
 
   {
-    const f_status_t status = f_file_link_read_at(0, f_string_empty_s, 0, &buffer);
+    const f_status_t status = f_file_link_read_at(file, f_string_empty_s, 0, &buffer);
 
     assert_int_equal(status, F_data_not);
   }
@@ -88,8 +91,23 @@ void test__f_file_link_read_at__returns_data_not(void **state) {
   f_string_dynamic_resize(0, &buffer);
 }
 
+void test__f_file_link_read_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
+
+  {
+    const f_status_t status = f_file_link_read_at(file, f_string_empty_s, 0, &buffer);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+
+  f_string_dynamic_resize(0, &buffer);
+}
+
 void test__f_file_link_read_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   struct stat statistics;
@@ -111,7 +129,7 @@ void test__f_file_link_read_at__works(void **state) {
     will_return(__wrap_readlinkat, source);
     will_return(__wrap_readlinkat, 0);
 
-    const f_status_t status = f_file_link_read_at(0, path, 0, &buffer);
+    const f_status_t status = f_file_link_read_at(file, path, 0, &buffer);
 
     assert_int_equal(status, F_none);
   }
index de3f893ac74c01a106931020f7ff7fb370931a99..6400845d5844fbba27c05e9774b10b2bcc22adaa 100644 (file)
@@ -32,6 +32,13 @@ extern void test__f_file_link_read_at__parameter_checking(void **state);
 extern void test__f_file_link_read_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_link_read_at()
+ */
+extern void test__f_file_link_read_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_link_read_at()
index 0b91df0142f9d6b68b0bbab7d3b5cb5891be4099..c24de185c280a382f2b24b1830833c6f891448a5 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_mode_read_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -42,7 +43,7 @@ void test__f_file_mode_read_at__fails(void **state) {
     will_return(__wrap_fstatat, true);
     will_return(__wrap_fstatat, errnos[i]);
 
-    const f_status_t status = f_file_mode_read_at(0, path, 0, &mode);
+    const f_status_t status = f_file_mode_read_at(file, path, 0, &mode);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -50,8 +51,10 @@ void test__f_file_mode_read_at__fails(void **state) {
 
 void test__f_file_mode_read_at__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_mode_read_at(0, f_string_empty_s, 0, 0);
+    const f_status_t status = f_file_mode_read_at(file, f_string_empty_s, 0, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -59,17 +62,34 @@ void test__f_file_mode_read_at__parameter_checking(void **state) {
 
 void test__f_file_mode_read_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     mode_t mode = 0;
 
-    const f_status_t status = f_file_mode_read_at(0, f_string_empty_s, 0, &mode);
+    const f_status_t status = f_file_mode_read_at(file, f_string_empty_s, 0, &mode);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_mode_read_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    mode_t mode = 0;
+
+    const f_status_t status = f_file_mode_read_at(file, path, 0, &mode);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_mode_read_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   struct stat statistics;
@@ -85,7 +105,7 @@ void test__f_file_mode_read_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_mode_read_at(0, path, 0, &mode);
+    const f_status_t status = f_file_mode_read_at(file, path, 0, &mode);
 
     assert_int_equal(status, F_none);
     assert_int_equal(mode, statistics.st_mode);
index ae85c845458073394028d814c6a21881cdde15b4..cb8fd63909775a23d8a54195e11b49ddfbc25519 100644 (file)
@@ -32,6 +32,13 @@ extern void test__f_file_mode_read_at__parameter_checking(void **state);
 extern void test__f_file_mode_read_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_mode_read_at()
+ */
+extern void test__f_file_mode_read_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_mode_read_at()
index 9456b8b3e5e123b273b603b8591ae919aaf4fde7..786500f0a6b8371df394b7a8df6b57373ea7081c 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_mode_set_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   const mode_t mode = 0;
@@ -46,7 +47,7 @@ void test__f_file_mode_set_at__fails(void **state) {
     will_return(__wrap_fchmodat, true);
     will_return(__wrap_fchmodat, errnos[i]);
 
-    const f_status_t status = f_file_mode_set_at(0, path, mode);
+    const f_status_t status = f_file_mode_set_at(file, path, mode);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -54,17 +55,31 @@ void test__f_file_mode_set_at__fails(void **state) {
 
 void test__f_file_mode_set_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const mode_t mode = 0;
 
   {
-    const f_status_t status = f_file_mode_set_at(0, f_string_empty_s, mode);
+    const f_status_t status = f_file_mode_set_at(file, f_string_empty_s, mode);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_mode_set_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  const mode_t mode = 0;
+
+  {
+    const f_status_t status = f_file_mode_set_at(file, f_string_empty_s, mode);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_mode_set_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   const mode_t mode = 0;
@@ -73,7 +88,7 @@ void test__f_file_mode_set_at__works(void **state) {
     will_return(__wrap_fchmodat, false);
     will_return(__wrap_fchmodat, 5);
 
-    const f_status_t status = f_file_mode_set_at(0, path, mode);
+    const f_status_t status = f_file_mode_set_at(file, path, mode);
 
     assert_int_equal(status, F_none);
   }
index be05852b50f29c526dafe906e484158433fc1b7f..8c40b6c31be9d9215eb9414c205262b62e826cac 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_mode_set_at__fails(void **state);
 extern void test__f_file_mode_set_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_mode_set_at()
+ */
+extern void test__f_file_mode_set_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_mode_set_at()
index 8111e5780b4b6c833588d28086f46f09643849c7..9a75e41123ac3243a190c059d4c277315a36cec9 100644 (file)
@@ -61,12 +61,12 @@ void test__f_file_open_at__fails(void **state) {
 
   for (int i = 0; i < 22; ++i) {
 
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
     will_return(__wrap_openat, true);
     will_return(__wrap_openat, errnos[i]);
 
-    const f_status_t status = f_file_open_at(0, path, 0, &file);
+    const f_status_t status = f_file_open_at(file, path, 0, &file);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -75,7 +75,9 @@ void test__f_file_open_at__fails(void **state) {
 void test__f_file_open_at__parameter_checking(void **state) {
 
   {
-    const f_status_t status = f_file_open_at(0, f_string_empty_s, 0, 0);
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
+    const f_status_t status = f_file_open_at(file, f_string_empty_s, 0, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -84,25 +86,36 @@ void test__f_file_open_at__parameter_checking(void **state) {
 void test__f_file_open_at__returns_data_not(void **state) {
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
-    const f_status_t status = f_file_open_at(0, f_string_empty_s, 0, &file);
+    const f_status_t status = f_file_open_at(file, f_string_empty_s, 0, &file);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_open_at__returns_file_descriptor_not(void **state) {
+
+  {
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+    const f_status_t status = f_file_open_at(file, f_string_empty_s, 0, &file);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_open_at__works(void **state) {
 
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
     will_return(__wrap_openat, false);
     will_return(__wrap_openat, 5);
 
-    const f_status_t status = f_file_open_at(0, path, F_false, &file);
+    const f_status_t status = f_file_open_at(file, path, F_false, &file);
 
     assert_int_equal(status, F_none);
     assert_int_equal(file.id, 5);
index bc85e274c52178ca697e660ee72144baa7a6a889..ac172e262b961a289c39b65248a89ec30b7370ec 100644 (file)
@@ -32,6 +32,13 @@ extern void test__f_file_open_at__parameter_checking(void **state);
 extern void test__f_file_open_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_open_at()
+ */
+extern void test__f_file_open_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_open_at()
index 2ccfc15eebc967fc7e2659423cb51f5bc6ec05de..c5d16b1e7619b479a5728160f144c4405ca54d54 100644 (file)
@@ -81,7 +81,7 @@ void test__f_file_read__parameter_checking(void **state) {
   f_string_dynamic_resize(0, &buffer);
 }
 
-void test__f_file_read__returns_file_closed(void **state) {
+void test__f_file_read__returns_file_descriptor_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
@@ -89,7 +89,7 @@ void test__f_file_read__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_read(file, &buffer);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 
   f_string_dynamic_resize(0, &buffer);
index 35a5aa441982a155944bd22100a87308cf92c112..9b3a8523eb07f89310bec205aefa582866439e6c 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_read__fails(void **state);
 extern void test__f_file_read__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_read()
  */
-extern void test__f_file_read__returns_file_closed(void **state);
+extern void test__f_file_read__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works.
index 8b546b6a5b11c70eab0a0c51dfddedb5dbf67b4e..0d837af23b7089ed1dc5c5cdf7e71824bbe78997 100644 (file)
@@ -81,7 +81,7 @@ void test__f_file_read_block__parameter_checking(void **state) {
   f_string_dynamic_resize(0, &buffer);
 }
 
-void test__f_file_read_block__returns_file_closed(void **state) {
+void test__f_file_read_block__returns_file_descriptor_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
@@ -89,7 +89,7 @@ void test__f_file_read_block__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_read_block(file, &buffer);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 
   f_string_dynamic_resize(0, &buffer);
index 14723a91e4fa3aa67f3a90bce1c8061bbf9fd80b..53628e3dd23d0d765351726884f1ba963773d237 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_read_block__fails(void **state);
 extern void test__f_file_read_block__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_read_block()
  */
-extern void test__f_file_read_block__returns_file_closed(void **state);
+extern void test__f_file_read_block__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works.
index a3fd48e189bf1e86a9c8090f763296cdb46bb8dc..909b1a013949bb68f3d574ab2f4372844998a432 100644 (file)
@@ -81,7 +81,7 @@ void test__f_file_read_until__parameter_checking(void **state) {
   f_string_dynamic_resize(0, &buffer);
 }
 
-void test__f_file_read_until__returns_file_closed(void **state) {
+void test__f_file_read_until__returns_file_descriptor_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
@@ -89,7 +89,7 @@ void test__f_file_read_until__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_read_until(file, 1, &buffer);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 
   f_string_dynamic_resize(0, &buffer);
index c1d5c2deb701156fa5311c543a3eb3b99607e4a9..ffd67be14087b234a9ef8cd7744083407f7b4bb2 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_read_until__fails(void **state);
 extern void test__f_file_read_until__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_read_until()
  */
-extern void test__f_file_read_until__returns_file_closed(void **state);
+extern void test__f_file_read_until__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works.
index edc42ae2aeda60cca9cab5ef7b09dadb869a6aab..c8bfab190978938b5e2a7f5e37b64f39fe670dbd 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_remove_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -49,7 +50,7 @@ void test__f_file_remove_at__fails(void **state) {
       will_return(__wrap_unlinkat, true);
       will_return(__wrap_unlinkat, errnos[i]);
 
-      const f_status_t status = f_file_remove_at(0, path, 0);
+      const f_status_t status = f_file_remove_at(file, path, 0);
 
       assert_int_equal(status, F_status_set_error(statuss[i]));
     } // for
@@ -58,22 +59,36 @@ void test__f_file_remove_at__fails(void **state) {
 
 void test__f_file_remove_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_remove_at(0, f_string_empty_s, 0);
+    const f_status_t status = f_file_remove_at(file, f_string_empty_s, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_remove_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    const f_status_t status = f_file_remove_at(file, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_remove_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
     will_return(__wrap_unlinkat, false);
     will_return(__wrap_unlinkat, 0);
 
-    const f_status_t status = f_file_remove_at(0, path, 0);
+    const f_status_t status = f_file_remove_at(file, path, 0);
 
     assert_int_equal(status, F_none);
   }
index 8bd5e5c67b6504dec067ac08f84faaeb8b7021de..5342cdf30c007680acfcbbdf51e1bef84fa342f0 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_remove_at__fails(void **state);
 extern void test__f_file_remove_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_remove_at()
+ */
+extern void test__f_file_remove_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_remove_at()
index 9c58ac2db3835f85e04e17b5cc6b2855b37df0b4..3a3795bf4fbdc08579f2edc4b1e30e6c1e8a8abc 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_file_rename_at__fails(void **state) {
 
+  const f_file_t source = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_file_t destination = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -66,7 +68,7 @@ void test__f_file_rename_at__fails(void **state) {
         will_return(__wrap_renameat, errnos[i]);
       #endif // _f_file_rename_use_renameat2_
 
-      const f_status_t status = f_file_rename_at(0, 0, path, path, 0);
+      const f_status_t status = f_file_rename_at(source, destination, path, path, 0);
 
       assert_int_equal(status, F_status_set_error(statuss[i]));
     } // for
@@ -75,29 +77,55 @@ void test__f_file_rename_at__fails(void **state) {
 
 void test__f_file_rename_at__returns_data_not(void **state) {
 
+  const f_file_t source = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_file_t destination = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    const f_status_t status = f_file_rename_at(0, 0, f_string_empty_s, f_string_empty_s, 0);
+    const f_status_t status = f_file_rename_at(source, destination, f_string_empty_s, f_string_empty_s, 0);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_rename_at(0, 0, path, f_string_empty_s, 0);
+    const f_status_t status = f_file_rename_at(source, destination, path, f_string_empty_s, 0);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_rename_at(0, 0, f_string_empty_s, path, 0);
+    const f_status_t status = f_file_rename_at(source, destination, f_string_empty_s, path, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_rename_at__returns_file_descriptor_not(void **state) {
+
+  f_file_t source = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  f_file_t destination = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    const f_status_t status = f_file_rename_at(source, destination, path, path, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+
+  {
+    source.id = F_type_descriptor_output_d;
+    destination.id = -1;
+
+    const f_status_t status = f_file_rename_at(source, destination, path, path, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_rename_at__works(void **state) {
 
+  const f_file_t source = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+  const f_file_t destination = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -109,7 +137,7 @@ void test__f_file_rename_at__works(void **state) {
       will_return(__wrap_renameat, 0);
     #endif // _f_file_rename_use_renameat2_
 
-    const f_status_t status = f_file_rename_at(0, 0, path, path, 0);
+    const f_status_t status = f_file_rename_at(source, destination, path, path, 0);
 
     assert_int_equal(status, F_none);
   }
index bf404bba4caeb6c4e0c649f884396d9cddb6d988..73c1ace0159a9b8409a6af51d9c200ecc742f9fa 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_rename_at__fails(void **state);
 extern void test__f_file_rename_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_rename_at()
+ */
+extern void test__f_file_rename_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_rename_at()
index ab69cb0bda4b71f63c8338e071827829718cc5a9..7533a8ab3fc32223a97e3e9770a11239d6b50b8f 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_role_change_at__fails_for_dereference(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -59,7 +60,7 @@ void test__f_file_role_change_at__fails_for_dereference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, 0, 0);
+    const f_status_t status = f_file_role_change_at(file, path, 0, 0, 0);
 
     assert_int_equal(F_status_set_fine(status), status_owners[i]);
   } // for
@@ -72,7 +73,7 @@ void test__f_file_role_change_at__fails_for_dereference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, 0, 0);
+    const f_status_t status = f_file_role_change_at(file, path, 0, 0, 0);
 
     assert_int_equal(F_status_set_fine(status), status_groups[i]);
   } // for
@@ -82,7 +83,7 @@ void test__f_file_role_change_at__fails_for_dereference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, -1, 0, 0);
+    const f_status_t status = f_file_role_change_at(file, path, -1, 0, 0);
 
     assert_int_equal(F_status_set_fine(status), status_groups[i]);
   } // for
@@ -92,7 +93,7 @@ void test__f_file_role_change_at__fails_for_dereference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, -1, 0);
+    const f_status_t status = f_file_role_change_at(file, path, 0, -1, 0);
 
     assert_int_equal(F_status_set_fine(status), status_owners[i]);
   } // for
@@ -100,6 +101,7 @@ void test__f_file_role_change_at__fails_for_dereference(void **state) {
 
 void test__f_file_role_change_at__fails_for_reference(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -152,7 +154,7 @@ void test__f_file_role_change_at__fails_for_reference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, 0, F_file_at_symlink_follow_no_d);
+    const f_status_t status = f_file_role_change_at(file, path, 0, 0, F_file_at_symlink_follow_no_d);
 
     assert_int_equal(F_status_set_fine(status), status_owners[i]);
   } // for
@@ -165,7 +167,7 @@ void test__f_file_role_change_at__fails_for_reference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, 0, F_file_at_symlink_follow_no_d);
+    const f_status_t status = f_file_role_change_at(file, path, 0, 0, F_file_at_symlink_follow_no_d);
 
     assert_int_equal(F_status_set_fine(status), status_groups[i]);
   } // for
@@ -175,7 +177,7 @@ void test__f_file_role_change_at__fails_for_reference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, -1, 0, F_file_at_symlink_follow_no_d);
+    const f_status_t status = f_file_role_change_at(file, path, -1, 0, F_file_at_symlink_follow_no_d);
 
     assert_int_equal(F_status_set_fine(status), status_groups[i]);
   } // for
@@ -185,7 +187,7 @@ void test__f_file_role_change_at__fails_for_reference(void **state) {
     will_return(__wrap_fchownat, true);
     will_return(__wrap_fchownat, errnos[i]);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, -1, F_file_at_symlink_follow_no_d);
+    const f_status_t status = f_file_role_change_at(file, path, 0, -1, F_file_at_symlink_follow_no_d);
 
     assert_int_equal(F_status_set_fine(status), status_owners[i]);
   } // for
@@ -193,29 +195,43 @@ void test__f_file_role_change_at__fails_for_reference(void **state) {
 
 void test__f_file_role_change_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    const f_status_t status = f_file_role_change_at(0, f_string_empty_s, -1, -1, 0);
+    const f_status_t status = f_file_role_change_at(file, f_string_empty_s, -1, -1, 0);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_role_change_at(0, path, -1, -1, 0);
+    const f_status_t status = f_file_role_change_at(file, path, -1, -1, 0);
 
     assert_int_equal(status, F_data_not);
   }
 
   {
-    const f_status_t status = f_file_role_change_at(0, f_string_empty_s, 0, 0, 0);
+    const f_status_t status = f_file_role_change_at(file, f_string_empty_s, 0, 0, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_role_change_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    const f_status_t status = f_file_role_change_at(file, path, 0, 0, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_role_change_at__works_for_dereference(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -225,7 +241,7 @@ void test__f_file_role_change_at__works_for_dereference(void **state) {
     will_return(__wrap_fchownat, false);
     will_return(__wrap_fchownat, 0);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, 0, 0);
+    const f_status_t status = f_file_role_change_at(file, path, 0, 0, 0);
 
     assert_int_equal(status, F_none);
   }
@@ -234,7 +250,7 @@ void test__f_file_role_change_at__works_for_dereference(void **state) {
     will_return(__wrap_fchownat, false);
     will_return(__wrap_fchownat, 0);
 
-    const f_status_t status = f_file_role_change_at(0, path, -1, 0, 0);
+    const f_status_t status = f_file_role_change_at(file, path, -1, 0, 0);
 
     assert_int_equal(status, F_none);
   }
@@ -243,7 +259,7 @@ void test__f_file_role_change_at__works_for_dereference(void **state) {
     will_return(__wrap_fchownat, false);
     will_return(__wrap_fchownat, 0);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, -1, 0);
+    const f_status_t status = f_file_role_change_at(file, path, 0, -1, 0);
 
     assert_int_equal(status, F_none);
   }
@@ -251,6 +267,7 @@ void test__f_file_role_change_at__works_for_dereference(void **state) {
 
 void test__f_file_role_change_at__works_for_reference(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -260,7 +277,7 @@ void test__f_file_role_change_at__works_for_reference(void **state) {
     will_return(__wrap_fchownat, false);
     will_return(__wrap_fchownat, 0);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, 0, F_file_at_symlink_follow_no_d);
+    const f_status_t status = f_file_role_change_at(file, path, 0, 0, F_file_at_symlink_follow_no_d);
 
     assert_int_equal(status, F_none);
   }
@@ -269,7 +286,7 @@ void test__f_file_role_change_at__works_for_reference(void **state) {
     will_return(__wrap_fchownat, false);
     will_return(__wrap_fchownat, 0);
 
-    const f_status_t status = f_file_role_change_at(0, path, -1, 0, F_file_at_symlink_follow_no_d);
+    const f_status_t status = f_file_role_change_at(file, path, -1, 0, F_file_at_symlink_follow_no_d);
 
     assert_int_equal(status, F_none);
   }
@@ -278,7 +295,7 @@ void test__f_file_role_change_at__works_for_reference(void **state) {
     will_return(__wrap_fchownat, false);
     will_return(__wrap_fchownat, 0);
 
-    const f_status_t status = f_file_role_change_at(0, path, 0, -1, F_file_at_symlink_follow_no_d);
+    const f_status_t status = f_file_role_change_at(file, path, 0, -1, F_file_at_symlink_follow_no_d);
 
     assert_int_equal(status, F_none);
   }
index b36b7df5ab33eb0ffd78b2036d68d37cfbd345a4..b80c79647cd581f5fbc239fcb0f27281d0af707e 100644 (file)
@@ -32,6 +32,13 @@ extern void test__f_file_role_change_at__fails_for_reference(void **state);
 extern void test__f_file_role_change_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_role_change_at()
+ */
+extern void test__f_file_role_change_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works for dereferenced files.
  *
  * @see f_file_role_change_at()
index 5ce244aacbe3ad55f2f186690da2f3aa7f065b07..5b30a840f4470021ae610fcfc365c3ef07836b7e 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_file_seek__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   int errnos[] = {
     EBADF,
     EINVAL,
@@ -32,7 +34,7 @@ void test__f_file_seek__fails(void **state) {
     will_return(__wrap_lseek, true);
     will_return(__wrap_lseek, errnos[i]);
 
-    const f_status_t status = f_file_seek(0, 0, 0, &seeked);
+    const f_status_t status = f_file_seek(file, 0, 0, &seeked);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -40,36 +42,52 @@ void test__f_file_seek__fails(void **state) {
 
 void test__f_file_seek__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   off_t seeked = 0;
 
   {
-    const f_status_t status = f_file_seek(0, -1, 0, 0);
+    const f_status_t status = f_file_seek(file, -1, 0, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 
   {
-    const f_status_t status = f_file_seek(0, -1, 0, &seeked);
+    const f_status_t status = f_file_seek(file, -1, 0, &seeked);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 
   {
-    const f_status_t status = f_file_seek(0, 0, 0, 0);
+    const f_status_t status = f_file_seek(file, 0, 0, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 }
 
+void test__f_file_seek__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    off_t seeked = 0;
+
+    const f_status_t status = f_file_seek(file, 0, 0, &seeked);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_seek__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     off_t seeked = 0;
 
     will_return(__wrap_lseek, false);
     will_return(__wrap_lseek, 0);
 
-    const f_status_t status = f_file_seek(0, 0, 0, &seeked);
+    const f_status_t status = f_file_seek(file, 0, 0, &seeked);
 
     assert_int_equal(status, F_none);
   }
index 38f2c5ff3557e1b34968d2a8664620f1ed93efa4..c753c85e45412773ef6fa2d5884b95a929ed0e7b 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_seek__fails(void **state);
 extern void test__f_file_seek__parameter_checking(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_seek()
+ */
+extern void test__f_file_seek__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_seek()
index c402e4c16ce879521d8ea30cd8c81f4d24aa6bc4..d3de2486958ea1173add4ddd71596b6f33ad5579 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_size_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -44,7 +45,7 @@ void test__f_file_size_at__fails(void **state) {
     will_return(__wrap_fstatat, true);
     will_return(__wrap_fstatat, errnos[i]);
 
-    const f_status_t status = f_file_size_at(0, path, F_false, &size);
+    const f_status_t status = f_file_size_at(file, path, F_false, &size);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -52,8 +53,10 @@ void test__f_file_size_at__fails(void **state) {
 
 void test__f_file_size_at__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_size_at(0, f_string_empty_s, F_false, 0);
+    const f_status_t status = f_file_size_at(file, f_string_empty_s, F_false, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -61,17 +64,33 @@ void test__f_file_size_at__parameter_checking(void **state) {
 
 void test__f_file_size_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     off_t size = 0;
 
-    const f_status_t status = f_file_size_at(0, f_string_empty_s, F_false, &size);
+    const f_status_t status = f_file_size_at(file, f_string_empty_s, F_false, &size);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_size_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    off_t size = 0;
+
+    const f_status_t status = f_file_size_at(file, f_string_empty_s, F_false, &size);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_size_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   struct stat statistics;
@@ -88,7 +107,7 @@ void test__f_file_size_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_size_at(0, path, F_false, &size);
+    const f_status_t status = f_file_size_at(file, path, F_false, &size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(size, statistics.st_size);
@@ -104,7 +123,7 @@ void test__f_file_size_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_size_at(0, path, F_true, &size);
+    const f_status_t status = f_file_size_at(file, path, F_true, &size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(size, statistics.st_size);
index a09a891f4ca5bc81234bb72f1d18881e1986c606..3bb4e3eebd44ee526fd1c771812d708ef3472f53 100644 (file)
@@ -32,6 +32,13 @@ extern void test__f_file_size_at__parameter_checking(void **state);
 extern void test__f_file_size_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_size_at()
+ */
+extern void test__f_file_size_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_size_at()
index ceb8f20ab304ff3ed7bf1ba48ca5b6a41ae2b451..fc827168994038d9022ca82df2be73b5786828cb 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_file_size_by_id__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   int errnos[] = {
     EACCES,
     EBADF,
@@ -42,7 +44,7 @@ void test__f_file_size_by_id__fails(void **state) {
     will_return(__wrap_fstat, true);
     will_return(__wrap_fstat, errnos[i]);
 
-    const f_status_t status = f_file_size_by_id(0, &size);
+    const f_status_t status = f_file_size_by_id(file, &size);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -50,26 +52,32 @@ void test__f_file_size_by_id__fails(void **state) {
 
 void test__f_file_size_by_id__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_size_by_id(0, 0);
+    const f_status_t status = f_file_size_by_id(file, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 }
 
-void test__f_file_size_by_id__returns_file_closed(void **state) {
+void test__f_file_size_by_id__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
 
   {
     off_t size = 0;
 
-    const f_status_t status = f_file_size_by_id(-1, &size);
+    const f_status_t status = f_file_size_by_id(file, &size);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
-  } // for
+    assert_int_equal(status, F_file_descriptor_not);
+  }
 }
 
 void test__f_file_size_by_id__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   struct stat statistics;
 
   memset(&statistics, 0, sizeof(struct stat));
@@ -84,7 +92,7 @@ void test__f_file_size_by_id__works(void **state) {
     will_return(__wrap_fstat, &statistics);
     will_return(__wrap_fstat, 0);
 
-    const f_status_t status = f_file_size_by_id(0, &size);
+    const f_status_t status = f_file_size_by_id(file, &size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(size, statistics.st_size);
index f5d42abb5f4474c68b937548bb29551bb24e980a..9b96834c61cd19df62117625e78ac626620e60f1 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_size_by_id__fails(void **state);
 extern void test__f_file_size_by_id__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the path is empty.
  *
  * @see f_file_size_by_id()
  */
-extern void test__f_file_size_by_id__returns_file_closed(void **state);
+extern void test__f_file_size_by_id__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works.
index 284ff71798afa4b869d648061aed0efdcc2e8c09..adedf8ca2d9e7ffd8e114224e40600dcec045922 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_stat_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -46,7 +47,7 @@ void test__f_file_stat_at__fails(void **state) {
     will_return(__wrap_fstatat, true);
     will_return(__wrap_fstatat, errnos[i]);
 
-    const f_status_t status = f_file_stat_at(0, path, F_false, &result);
+    const f_status_t status = f_file_stat_at(file, path, F_false, &result);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -54,8 +55,10 @@ void test__f_file_stat_at__fails(void **state) {
 
 void test__f_file_stat_at__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_stat_at(0, f_string_empty_s, F_false, 0);
+    const f_status_t status = f_file_stat_at(file, f_string_empty_s, F_false, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -63,19 +66,37 @@ void test__f_file_stat_at__parameter_checking(void **state) {
 
 void test__f_file_stat_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     struct stat result;
 
     memset(&result, 0, sizeof(struct stat));
 
-    const f_status_t status = f_file_stat_at(0, f_string_empty_s, F_false, &result);
+    const f_status_t status = f_file_stat_at(file, f_string_empty_s, F_false, &result);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_stat_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    struct stat result;
+
+    memset(&result, 0, sizeof(struct stat));
+
+    const f_status_t status = f_file_stat_at(file, f_string_empty_s, F_false, &result);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_stat_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   struct stat statistics;
@@ -94,7 +115,7 @@ void test__f_file_stat_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_stat_at(0, path, F_false, &result);
+    const f_status_t status = f_file_stat_at(file, path, F_false, &result);
 
     assert_int_equal(status, F_none);
     assert_int_equal(result.st_mode, statistics.st_mode);
@@ -113,7 +134,7 @@ void test__f_file_stat_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_stat_at(0, path, F_true, &result);
+    const f_status_t status = f_file_stat_at(file, path, F_true, &result);
 
     assert_int_equal(status, F_none);
     assert_int_equal(result.st_mode, statistics.st_mode);
index 91b5abffdc68188c39ff367c68932f54a67df921..3ac21b18d2c7a779e700571cadd6706617afbc85 100644 (file)
@@ -32,6 +32,13 @@ extern void test__f_file_stat_at__parameter_checking(void **state);
 extern void test__f_file_stat_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_stat_at()
+ */
+extern void test__f_file_stat_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_stat_at()
index 7282fa0e7cd127e6d95c3e550d0e5d8886099352..b4a2c143226e6aeebac41d7a0932dd1383d5d477 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_file_stat_by_id__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   int errnos[] = {
     EACCES,
     EBADF,
@@ -44,7 +46,7 @@ void test__f_file_stat_by_id__fails(void **state) {
     will_return(__wrap_fstat, true);
     will_return(__wrap_fstat, errnos[i]);
 
-    const f_status_t status = f_file_stat_by_id(0, &result);
+    const f_status_t status = f_file_stat_by_id(file, &result);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -52,28 +54,34 @@ void test__f_file_stat_by_id__fails(void **state) {
 
 void test__f_file_stat_by_id__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_stat_by_id(0, 0);
+    const f_status_t status = f_file_stat_by_id(file, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 }
 
-void test__f_file_stat_by_id__returns_file_closed(void **state) {
+void test__f_file_stat_by_id__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
 
   {
     struct stat result;
 
     memset(&result, 0, sizeof(struct stat));
 
-    const f_status_t status = f_file_stat_by_id(-1, &result);
+    const f_status_t status = f_file_stat_by_id(file, &result);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
-  } // for
+    assert_int_equal(status, F_file_descriptor_not);
+  }
 }
 
 void test__f_file_stat_by_id__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   struct stat statistics;
 
   memset(&statistics, 0, sizeof(struct stat));
@@ -90,7 +98,7 @@ void test__f_file_stat_by_id__works(void **state) {
     will_return(__wrap_fstat, &statistics);
     will_return(__wrap_fstat, 0);
 
-    const f_status_t status = f_file_stat_by_id(0, &result);
+    const f_status_t status = f_file_stat_by_id(file, &result);
 
     assert_int_equal(status, F_none);
     assert_int_equal(result.st_mode, statistics.st_mode);
index 63ffcdd50e8b0f106eca5c1673c50f5c0ecdb658..5e4cf72425c9c1017af9e1ec86ef362ba35c64c0 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stat_by_id__fails(void **state);
 extern void test__f_file_stat_by_id__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_stat_by_id()
  */
-extern void test__f_file_stat_by_id__returns_file_closed(void **state);
+extern void test__f_file_stat_by_id__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works.
index 26404fc672e9a9aca12ae7ca99949ba885ad9bbc..46fd3b75828971f3c2c41538a681126c5ca95acc 100644 (file)
@@ -5,72 +5,7 @@
 extern "C" {
 #endif
 
-void test__f_file_stream_close__fails_for_file_descriptor(void **state) {
-
-  int errno_flushs[] = {
-    EBADF,
-    EDQUOT,
-    EINVAL,
-    EIO,
-    ENOSPC,
-    EROFS,
-  };
-
-  int errno_closes[] = {
-    EBADF,
-    EDQUOT,
-    EINTR,
-    EIO,
-    ENOSPC,
-    mock_errno_generic,
-  };
-
-  f_status_t status_closes[] = {
-    F_file_descriptor,
-    F_filesystem_quota_block,
-    F_interrupt,
-    F_input_output,
-    F_space_not,
-    F_file_close,
-  };
-
-  for (uint8_t flush = 0; flush < 2; ++flush) {
-
-    for (int i = 0; i < 6; ++i) {
-
-      f_file_t file = f_file_t_initialize;
-      file.id = 0;
-      file.stream = 0;
-
-      if (flush) {
-        if (flush == 1) {
-          will_return(__wrap_fsync, true);
-          will_return(__wrap_fsync, errno_flushs[i]);
-        }
-        else {
-          will_return(__wrap_fsync, false);
-          will_return(__wrap_fsync, 0);
-        }
-
-        will_return(__wrap_close, true);
-        will_return(__wrap_close, errno_closes[i]);
-      }
-      else {
-        will_return(__wrap_close, true);
-        will_return(__wrap_close, errno_closes[i]);
-      }
-
-      const f_status_t status = f_file_stream_close(flush, &file);
-
-      assert_int_equal(F_status_set_fine(status), status_closes[i]);
-
-      assert_int_equal(file.id, -1);
-      assert_int_equal(file.stream, 0);
-    } // for
-  } // for
-}
-
-void test__f_file_stream_close__fails_for_stream(void **state) {
+void test__f_file_stream_close__fails(void **state) {
 
   int errnos[] = {
     EACCES,
@@ -116,119 +51,54 @@ void test__f_file_stream_close__fails_for_stream(void **state) {
     F_file_close,
   };
 
-  for (uint8_t flush = 0; flush < 2; ++flush) {
-
-    for (int i = 0; i < 19; ++i) {
-
-      f_file_t file = f_file_t_initialize;
-      file.id = 0;
-      file.stream = F_type_input_d;
-
-      if (flush) {
-        if (flush == 1) {
-          will_return(__wrap_fflush, true);
-          will_return(__wrap_fflush, errnos[i]);
-        }
-        else {
-          will_return(__wrap_fflush, false);
-          will_return(__wrap_fflush, 0);
-        }
-
-        will_return(__wrap_fclose, true);
-        will_return(__wrap_fclose, errnos[i]);
-      }
-      else {
-        will_return(__wrap_fclose, true);
-        will_return(__wrap_fclose, errnos[i]);
-      }
-
-      const f_status_t status = f_file_stream_close(flush, &file);
-
-      assert_int_equal(F_status_set_fine(status), status_closes[i]);
-      assert_int_equal(file.id, -1);
-      assert_int_equal(file.stream, 0);
-    } // for
+  for (int i = 0; i < 19; ++i) {
+
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
+    will_return(__wrap_fclose, true);
+    will_return(__wrap_fclose, errnos[i]);
+
+    const f_status_t status = f_file_stream_close(&file);
+
+    assert_int_equal(F_status_set_fine(status), status_closes[i]);
+    assert_int_equal(file.stream, 0);
   } // for
 }
 
 void test__f_file_stream_close__parameter_checking(void **state) {
 
   {
-    const f_status_t status = f_file_stream_close(F_false, 0);
+    const f_status_t status = f_file_stream_close(0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
 }
 
-void test__f_file_stream_close__works(void **state) {
-
-  {
-    f_file_t file = f_file_t_initialize;
-
-    file.id = 0;
-    file.stream = F_type_input_d;
-
-    will_return(__wrap_fclose, false);
-    will_return(__wrap_fclose, 0);
+void test__f_file_stream_close__returns_stream_not(void **state) {
 
-    const f_status_t status = f_file_stream_close(F_false, &file);
-
-    assert_int_equal(status, F_none);
-    assert_int_equal(file.id, -1);
-    assert_int_equal(file.stream, 0);
-  }
+  f_file_t file = macro_f_file_t_initialize2(0, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
   {
-    f_file_t file = f_file_t_initialize;
-
-    file.id = 0;
-    file.stream = 0;
-
-    will_return(__wrap_close, false);
-    will_return(__wrap_close, 0);
+    const f_status_t status = f_file_stream_close(&file);
 
-    const f_status_t status = f_file_stream_close(F_false, &file);
-
-    assert_int_equal(status, F_none);
-    assert_int_equal(file.id, -1);
-    assert_int_equal(file.stream, 0);
+    assert_int_equal(status, F_stream_not);
   }
+}
+
+void test__f_file_stream_close__works(void **state) {
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
     file.id = 0;
     file.stream = F_type_input_d;
 
-    will_return(__wrap_fflush, false);
-    will_return(__wrap_fflush, 0);
-
     will_return(__wrap_fclose, false);
     will_return(__wrap_fclose, 0);
 
-    const f_status_t status = f_file_stream_close(F_true, &file);
-
-    assert_int_equal(status, F_none);
-    assert_int_equal(file.id, -1);
-    assert_int_equal(file.stream, 0);
-  }
-
-  {
-    f_file_t file = f_file_t_initialize;
-
-    file.id = 0;
-    file.stream = 0;
-
-    will_return(__wrap_fsync, false);
-    will_return(__wrap_fsync, 0);
-
-    will_return(__wrap_close, false);
-    will_return(__wrap_close, 0);
-
-    const f_status_t status = f_file_stream_close(F_true, &file);
+    const f_status_t status = f_file_stream_close(&file);
 
     assert_int_equal(status, F_none);
-    assert_int_equal(file.id, -1);
     assert_int_equal(file.stream, 0);
   }
 }
index ebd4cfd433c81ade5dcff8701e2b150075f3daf0..1600b38ff3b924b17fa022900224a51e5aa92a0f 100644 (file)
 #define _TEST__F_file_stream_close_h
 
 /**
- * Test that function fails for a file using the file descriptor.
+ * Test that function fails.
  *
  * @see f_file_stream_close()
  */
-extern void test__f_file_stream_close__fails_for_file_descriptor(void **state);
+extern void test__f_file_stream_close__fails(void **state);
 
 /**
- * Test that function fails for a file stream.
+ * Test that parameter checking works as expected.
  *
  * @see f_file_stream_close()
  */
-extern void test__f_file_stream_close__fails_for_stream(void **state);
+extern void test__f_file_stream_close__parameter_checking(void **state);
 
 /**
- * Test that parameter checking works as expected.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_close()
  */
-extern void test__f_file_stream_close__parameter_checking(void **state);
+extern void test__f_file_stream_close__returns_stream_not(void **state);
 
 /**
  * Test that function works.
index 284f6c2c19e2c27ebcd26d5ef246296bb5cff5e6..822ec0303b277ecca37940890aad6beb2cb494c6 100644 (file)
@@ -107,7 +107,6 @@ void test__f_file_stream_open__returns_data_not(void **state) {
 void test__f_file_stream_open__works(void **state) {
 
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
-  const int id = 1;
 
   {
     f_file_t file = f_file_t_initialize;
@@ -115,8 +114,6 @@ void test__f_file_stream_open__works(void **state) {
     will_return(__wrap_fopen, false);
     will_return(__wrap_fopen, F_type_output_d);
 
-    will_return(__wrap_fileno, id);
-
     const f_status_t status = f_file_stream_open(path, path, &file);
 
     assert_int_equal(status, F_none);
@@ -129,8 +126,6 @@ void test__f_file_stream_open__works(void **state) {
     will_return(__wrap_fopen, false);
     will_return(__wrap_fopen, F_type_output_d);
 
-    will_return(__wrap_fileno, id);
-
     const f_status_t status = f_file_stream_open(path, f_string_empty_s, &file);
 
     assert_int_equal(status, F_none);
index 72739ba601537d7752926a6b3c4321146967d05a..887a7306bf6cd48ab076a401d75d3b3396695750 100644 (file)
@@ -54,7 +54,7 @@ void test__f_file_stream_read__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_stream_read__returns_file_closed(void **state) {
+void test__f_file_stream_read__returns_stream_not(void **state) {
 
   const f_file_t file = f_file_t_initialize;
   f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
@@ -62,7 +62,7 @@ void test__f_file_stream_read__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_stream_read(file, &buffer);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_stream_not);
   }
 
   f_string_dynamic_resize(0, &buffer);
index 2db6c2dbee40412a4dff356af1c35d69ff7837f6..fa0a490cf77bca536f6aa590965e4dc86cb62789 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stream_read__fails(void **state);
 extern void test__f_file_stream_read__parameter_checking(void **state);
 
 /**
- * Test that function works but the file stream is closed.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_read()
  */
-extern void test__f_file_stream_read__returns_file_closed(void **state);
+extern void test__f_file_stream_read__returns_stream_not(void **state);
 
 /**
  * Test that function works.
index d974c8186abb153bc6b008e7846e3313a0af8493..17c1cdfbe75420532b9a072d4d8b5d779a929c60 100644 (file)
@@ -54,7 +54,7 @@ void test__f_file_stream_read_block__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_stream_read_block__returns_file_closed(void **state) {
+void test__f_file_stream_read_block__returns_stream_not(void **state) {
 
   const f_file_t file = f_file_t_initialize;
 
@@ -63,7 +63,7 @@ void test__f_file_stream_read_block__returns_file_closed(void **state) {
 
     const f_status_t status = f_file_stream_read_block(file, &string);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_stream_not);
   }
 }
 
index f80d256803a778b69be516a6f929b2350b47ad29..4a599b74a496ac36c85c342719362944e44aeeec 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stream_read_block__fails(void **state);
 extern void test__f_file_stream_read_block__parameter_checking(void **state);
 
 /**
- * Test that function works but the file stream is closed.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_read_block()
  */
-extern void test__f_file_stream_read_block__returns_file_closed(void **state);
+extern void test__f_file_stream_read_block__returns_stream_not(void **state);
 
 /**
  * Test that function works.
index 4b0e0c7495a2f29e02efc53ab5724533893076ab..ccab7b5d288528ec428fa98017f62a5bd9eb3dd9 100644 (file)
@@ -54,7 +54,7 @@ void test__f_file_stream_read_until__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_stream_read_until__returns_file_closed(void **state) {
+void test__f_file_stream_read_until__returns_stream_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
@@ -64,7 +64,7 @@ void test__f_file_stream_read_until__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_stream_read_until(file, 0, &buffer);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_stream_not);
   }
 
   f_string_dynamic_resize(0, &buffer);
index 550b73b22e0e1a83775c6ae78493f9c509454637..ae8a4b71922bca23c81a960a16d4befed60e4449 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stream_read_until__fails(void **state);
 extern void test__f_file_stream_read_until__parameter_checking(void **state);
 
 /**
- * Test that function works but the file stream is closed.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_read_until()
  */
-extern void test__f_file_stream_read_until__returns_file_closed(void **state);
+extern void test__f_file_stream_read_until__returns_stream_not(void **state);
 
 /**
  * Test that function works.
index e0645fc28b2d55aafa09bd043c96782fb60a1a4f..41c46e0d1955c7b6edf5ce462a0bdd5307c4021c 100644 (file)
@@ -101,7 +101,6 @@ void test__f_file_stream_reopen__returns_data_not(void **state) {
 void test__f_file_stream_reopen__works(void **state) {
 
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
-  const int id = 1;
 
   {
     f_file_t file = f_file_t_initialize;
@@ -110,8 +109,6 @@ void test__f_file_stream_reopen__works(void **state) {
     will_return(__wrap_freopen, false);
     will_return(__wrap_freopen, F_type_input_d);
 
-    will_return(__wrap_fileno, id);
-
     const f_status_t status = f_file_stream_reopen(path, path, &file);
 
     assert_int_equal(status, F_none);
@@ -124,8 +121,6 @@ void test__f_file_stream_reopen__works(void **state) {
     will_return(__wrap_freopen, false);
     will_return(__wrap_freopen, F_type_input_d);
 
-    will_return(__wrap_fileno, id);
-
     const f_status_t status = f_file_stream_reopen(path, f_string_empty_s, &file);
 
     assert_int_equal(status, F_none);
index 7046bb1b2e38da71cae507b3932ff72a780447ba..3a6fd0c00f3da88859b7a9378ee51e6e1c08ad23 100644 (file)
@@ -10,13 +10,11 @@ void test__f_file_stream_write__fails(void **state) {
   const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_read = 1;
-    file.stream = F_type_input_d;
+    file.size_write = 1;
 
-    will_return(__wrap_fwrite_unlocked, true);
-    will_return(__wrap_fwrite_unlocked, 0);
-    will_return(__wrap_ferror_unlocked, true);
+    will_return(__wrap_write, 0);
 
     const f_status_t status = f_file_stream_write(file, test, 0);
 
@@ -26,7 +24,7 @@ void test__f_file_stream_write__fails(void **state) {
 
 void test__f_file_stream_write__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   {
@@ -36,21 +34,20 @@ void test__f_file_stream_write__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_stream_write__returns_file_closed(void **state) {
+void test__f_file_stream_write__returns_stream_not(void **state) {
 
   const f_file_t file = f_file_t_initialize;
 
   {
     const f_status_t status = f_file_stream_write(file, f_string_empty_s, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_stream_not);
   }
 }
 
 void test__f_file_stream_write__returns_data_not(void **state) {
 
-  f_file_t file = f_file_t_initialize;
-  file.stream = F_type_input_d;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
   {
     const f_status_t status = f_file_stream_write(file, f_string_empty_s, 0);
@@ -73,9 +70,8 @@ void test__f_file_stream_write__works(void **state) {
   const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_write = test.used;
-    file.stream = F_type_input_d;
 
     will_return(__wrap_fwrite_unlocked, false);
     will_return(__wrap_fwrite_unlocked, test.used);
index b1c96804b6d5702f698d698c6239588ff5f69437..0452a44e09ad66b6d1ecfd293e78a57c531b0971 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stream_write__fails(void **state);
 extern void test__f_file_stream_write__parameter_checking(void **state);
 
 /**
- * Test that function works but the file stream is closed.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_write()
  */
-extern void test__f_file_stream_write__returns_file_closed(void **state);
+extern void test__f_file_stream_write__returns_stream_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index c98e6d6d07d493c0042258b8b5702511c29cc64a..0329baad3e0e7b226f1502b3b3f0218d8aaf9d1e 100644 (file)
@@ -27,7 +27,7 @@ void test__f_file_stream_write_block__fails(void **state) {
 
 void test__f_file_stream_write_block__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   {
@@ -37,21 +37,20 @@ void test__f_file_stream_write_block__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_stream_write_block__returns_file_closed(void **state) {
+void test__f_file_stream_write_block__returns_stream_not(void **state) {
 
   const f_file_t file = f_file_t_initialize;
 
   {
     const f_status_t status = f_file_stream_write_block(file, f_string_empty_s, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_stream_not);
   }
 }
 
 void test__f_file_stream_write_block__returns_data_not(void **state) {
 
-  f_file_t file = f_file_t_initialize;
-  file.stream = F_type_input_d;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
   {
     const f_status_t status = f_file_stream_write_block(file, f_string_empty_s, 0);
@@ -76,9 +75,8 @@ void test__f_file_stream_write_block__works(void **state) {
   {
     f_array_length_t written = 0;
 
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_write = 1;
-    file.stream = F_type_input_d;
 
     // The letter 't'.
     will_return(__wrap_fwrite_unlocked, false);
@@ -122,9 +120,8 @@ void test__f_file_stream_write_block__works(void **state) {
   }
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_write = test.used;
-    file.stream = F_type_input_d;
 
     will_return(__wrap_fwrite_unlocked, false);
     will_return(__wrap_fwrite_unlocked, test.used);
index 7b56052818f8d58cdc604e1d2417a2a929ec71a0..f5f02ecbc6fb67712fb78cccc9e7e78f635e1a55 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stream_write_block__fails(void **state);
 extern void test__f_file_stream_write_block__parameter_checking(void **state);
 
 /**
- * Test that function works but the file stream is closed.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_write_block()
  */
-extern void test__f_file_stream_write_block__returns_file_closed(void **state);
+extern void test__f_file_stream_write_block__returns_stream_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index 582d5544225ab89e0e37baada4e4a3f865e75ce4..f13990b20b83b5ff48ff34e04a570623d0df3df2 100644 (file)
@@ -11,10 +11,8 @@ void test__f_file_stream_write_range__fails(void **state) {
   const f_string_range_t range = macro_f_string_range_t_initialize(0, 0);
 
   {
-
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_read = 1;
-    file.stream = F_type_input_d;
 
     will_return(__wrap_fwrite_unlocked, true);
     will_return(__wrap_fwrite_unlocked, 0);
@@ -28,7 +26,7 @@ void test__f_file_stream_write_range__fails(void **state) {
 
 void test__f_file_stream_write_range__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   const f_string_range_t range = f_string_range_t_initialize;
@@ -40,7 +38,7 @@ void test__f_file_stream_write_range__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_stream_write_range__returns_file_closed(void **state) {
+void test__f_file_stream_write_range__returns_stream_not(void **state) {
 
   const f_file_t file = f_file_t_initialize;
   const f_string_range_t range = f_string_range_t_initialize;
@@ -48,14 +46,13 @@ void test__f_file_stream_write_range__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_stream_write_range(file, f_string_empty_s, range, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_stream_not);
   }
 }
 
 void test__f_file_stream_write_range__returns_data_not(void **state) {
 
-  f_file_t file = f_file_t_initialize;
-  file.stream = F_type_input_d;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
   {
     const f_string_range_t range = f_string_range_t_initialize;
@@ -123,9 +120,8 @@ void test__f_file_stream_write_range__works(void **state) {
   const f_string_range_t range = macro_f_string_range_t_initialize(0, 0);
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_write = 1;
-    file.stream = F_type_input_d;
 
     will_return(__wrap_fwrite_unlocked, false);
     will_return(__wrap_fwrite_unlocked, 1);
@@ -137,9 +133,8 @@ void test__f_file_stream_write_range__works(void **state) {
   }
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_write = test.used;
-    file.stream = F_type_input_d;
 
     will_return(__wrap_fwrite_unlocked, false);
     will_return(__wrap_fwrite_unlocked, test.used);
index e19361ff71fc3b96ff1019a34ff63f6e7ce0963d..496a2cd14852f9b6181bcffe57a0b32c073b75e1 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stream_write_range__fails(void **state);
 extern void test__f_file_stream_write_range__parameter_checking(void **state);
 
 /**
- * Test that function works but the file stream is closed.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_write_range()
  */
-extern void test__f_file_stream_write_range__returns_file_closed(void **state);
+extern void test__f_file_stream_write_range__returns_stream_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index 0bf8e2d8b4579bd0fe5eb4a90a9b2f2bd04c6793..7e7b88af97e78d6d72d5091c8c3106142fb62166 100644 (file)
@@ -10,10 +10,8 @@ void test__f_file_stream_write_until__fails(void **state) {
   const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_read = 1;
-    file.stream = F_type_input_d;
 
     will_return(__wrap_fwrite_unlocked, true);
     will_return(__wrap_fwrite_unlocked, 0);
@@ -27,7 +25,7 @@ void test__f_file_stream_write_until__fails(void **state) {
 
 void test__f_file_stream_write_until__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   {
@@ -37,7 +35,7 @@ void test__f_file_stream_write_until__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_stream_write_until__returns_file_closed(void **state) {
+void test__f_file_stream_write_until__returns_stream_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   file.stream = 0;
@@ -45,7 +43,7 @@ void test__f_file_stream_write_until__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_stream_write_until(file, f_string_empty_s, 0, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_stream_not);
   }
 }
 
@@ -53,8 +51,7 @@ void test__f_file_stream_write_until__returns_data_not(void **state) {
 
   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;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
   {
     const f_status_t status = f_file_stream_write_until(file, f_string_empty_s, 0, 0);
@@ -107,9 +104,8 @@ void test__f_file_stream_write_until__works(void **state) {
   const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_write = 1;
-    file.stream = F_type_input_d;
 
     // The letter 't'.
     will_return(__wrap_fwrite_unlocked, false);
@@ -137,9 +133,8 @@ void test__f_file_stream_write_until__works(void **state) {
   }
 
   {
-    f_file_t file = f_file_t_initialize;
+    f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
     file.size_write = test.used;
-    file.stream = F_type_input_d;
 
     will_return(__wrap_fwrite_unlocked, false);
     will_return(__wrap_fwrite_unlocked, test.used);
index 86c441b400b86dec974c6ee0f68895a11b5a4cd6..13a91fc45391f639908e902d0e8d56150075f097 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_stream_write_until__fails(void **state);
 extern void test__f_file_stream_write_until__parameter_checking(void **state);
 
 /**
- * Test that function works but the file stream is closed.
+ * Test that function works but the stream is not valid.
  *
  * @see f_file_stream_write_until()
  */
-extern void test__f_file_stream_write_until__returns_file_closed(void **state);
+extern void test__f_file_stream_write_until__returns_stream_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index 2e3b72c7b35aafcf97ebc1dfd357bc5f97d3ddb0..7749294bfc174f4be57df6c2a70cc344fbc81313 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_touch_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
   const mode_t mode = 0;
 
@@ -55,7 +56,7 @@ void test__f_file_touch_at__fails(void **state) {
         will_return(__wrap_close, 0);
       }
 
-      const f_status_t status = f_file_touch_at(1, path, mode, 0);
+      const f_status_t status = f_file_touch_at(file, path, mode, 0);
 
       if (statuss[i] == F_file_found_not) {
         assert_int_equal(status, F_none);
@@ -112,7 +113,7 @@ void test__f_file_touch_at__fails(void **state) {
       will_return(__wrap_utimensat, true);
       will_return(__wrap_utimensat, errnos[i]);
 
-      const f_status_t status = f_file_touch_at(1, path, mode, 0);
+      const f_status_t status = f_file_touch_at(file, path, mode, 0);
 
       assert_int_equal(status, F_status_set_error(statuss[i]));
     } // for
@@ -121,17 +122,31 @@ void test__f_file_touch_at__fails(void **state) {
 
 void test__f_file_touch_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const mode_t mode = 0;
 
   {
-    const f_status_t status = f_file_touch_at(1, f_string_empty_s, mode, 0);
+    const f_status_t status = f_file_touch_at(file, f_string_empty_s, mode, 0);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_touch_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+  const mode_t mode = 0;
+
+  {
+    const f_status_t status = f_file_touch_at(file, f_string_empty_s, mode, 0);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_touch_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
   const mode_t mode = 0;
 
@@ -149,7 +164,7 @@ void test__f_file_touch_at__works(void **state) {
     will_return(__wrap_utimensat, false);
     will_return(__wrap_utimensat, 0);
 
-    const f_status_t status = f_file_touch_at(1, path, mode, 0);
+    const f_status_t status = f_file_touch_at(file, path, mode, 0);
 
     assert_int_equal(status, F_none);
   }
index 2afd9b0785a00f3811b42e5132cad800b9d162bb..e77b0ebcbd3b1fcf718c6b8ec310e455a742a668 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_file_touch_at__fails(void **state);
 extern void test__f_file_touch_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_touch_at()
+ */
+extern void test__f_file_touch_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_touch_at()
index 92d11a064065b2a2e6fc1f603b32cafb394eef6a..b53671c07037c27b106cc429ec2a3144b06354f2 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 void test__f_file_type_at__fails(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   int errnos[] = {
@@ -42,7 +43,7 @@ void test__f_file_type_at__fails(void **state) {
     will_return(__wrap_fstatat, true);
     will_return(__wrap_fstatat, errnos[i]);
 
-    const f_status_t status = f_file_type_at(0, path, 0, &mode);
+    const f_status_t status = f_file_type_at(file, path, 0, &mode);
 
     assert_int_equal(status, F_status_set_error(statuss[i]));
   } // for
@@ -50,8 +51,10 @@ void test__f_file_type_at__fails(void **state) {
 
 void test__f_file_type_at__parameter_checking(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
-    const f_status_t status = f_file_type_at(0, f_string_empty_s, 0, 0);
+    const f_status_t status = f_file_type_at(file, f_string_empty_s, 0, 0);
 
     assert_int_equal(status, F_status_set_error(F_parameter));
   }
@@ -59,17 +62,33 @@ void test__f_file_type_at__parameter_checking(void **state) {
 
 void test__f_file_type_at__returns_data_not(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
+
   {
     int type = 0;
 
-    const f_status_t status = f_file_type_at(0, f_string_empty_s, 0, &type);
+    const f_status_t status = f_file_type_at(file, f_string_empty_s, 0, &type);
 
     assert_int_equal(status, F_data_not);
   }
 }
 
+void test__f_file_type_at__returns_file_descriptor_not(void **state) {
+
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, -1, F_file_flag_write_only_d);
+
+  {
+    int type = 0;
+
+    const f_status_t status = f_file_type_at(file, f_string_empty_s, 0, &type);
+
+    assert_int_equal(status, F_file_descriptor_not);
+  }
+}
+
 void test__f_file_type_at__works(void **state) {
 
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
 
   {
@@ -85,7 +104,7 @@ void test__f_file_type_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_type_at(0, path, 0, &type);
+    const f_status_t status = f_file_type_at(file, path, 0, &type);
 
     assert_int_equal(status, F_none);
     assert_int_equal(type, F_file_type_link_d);
@@ -104,7 +123,7 @@ void test__f_file_type_at__works(void **state) {
     will_return(__wrap_fstatat, &statistics);
     will_return(__wrap_fstatat, 0);
 
-    const f_status_t status = f_file_type_at(0, path, 0, &type);
+    const f_status_t status = f_file_type_at(file, path, 0, &type);
 
     assert_int_equal(status, F_none);
     assert_int_equal(type, F_file_type_regular_d);
index d66f85073d0fd3cbc1b772dbeb9175bfa02c75d8..830e631b1a62357b8962c07cda200ac9ed1eb6d2 100644 (file)
@@ -32,6 +32,13 @@ extern void test__f_file_type_at__parameter_checking(void **state);
 extern void test__f_file_type_at__returns_data_not(void **state);
 
 /**
+ * Test that function works but the descriptor is not valid.
+ *
+ * @see f_file_type_at()
+ */
+extern void test__f_file_type_at__returns_file_descriptor_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_file_type_at()
index 3393cbc1cabe3076075c390c725881e288d18416..02c62ed9dc729eb9ce2ab3402c374d50c68da81c 100644 (file)
@@ -67,7 +67,7 @@ void test__f_file_write__fails(void **state) {
 
 void test__f_file_write__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   {
@@ -77,14 +77,14 @@ void test__f_file_write__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_write__returns_file_closed(void **state) {
+void test__f_file_write__returns_file_descriptor_not(void **state) {
 
   const f_file_t file = f_file_t_initialize;
 
   {
     const f_status_t status = f_file_write(file, f_string_empty_s, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 }
 
index 22098fb0b7c467eeefd77089db432b38aaa515ef..f009664676935e908f73df2b50036269dc24011e 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_write__fails(void **state);
 extern void test__f_file_write__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_write()
  */
-extern void test__f_file_write__returns_file_closed(void **state);
+extern void test__f_file_write__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index 1db4be29ed3c469c2889efb9a05305326f3a5d5e..b63f9ee383be601e0fa64ad30a00873a078bc9f3 100644 (file)
@@ -50,7 +50,7 @@ void test__f_file_write_block__fails(void **state) {
 
 void test__f_file_write_block__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   {
@@ -60,7 +60,7 @@ void test__f_file_write_block__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_write_block__returns_file_closed(void **state) {
+void test__f_file_write_block__returns_file_descriptor_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   file.size_write = 1;
@@ -68,7 +68,7 @@ void test__f_file_write_block__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_write_block(file, f_string_empty_s, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 }
 
index b8f66fbb0d2e7212f5f275c0322b20c7fbda6985..157d752fa2ff143888287b44aad477b9c0d0e71d 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_write_block__fails(void **state);
 extern void test__f_file_write_block__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_write_block()
  */
-extern void test__f_file_write_block__returns_file_closed(void **state);
+extern void test__f_file_write_block__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index be959334d167698575a9b4589774e958ad2eacda..e601f6e2227434c01dcf926cdc0381e38d544dd8 100644 (file)
@@ -51,7 +51,7 @@ void test__f_file_write_range__fails(void **state) {
 
 void test__f_file_write_range__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   const f_string_range_t range = f_string_range_t_initialize;
@@ -63,7 +63,7 @@ void test__f_file_write_range__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_write_range__returns_file_closed(void **state) {
+void test__f_file_write_range__returns_file_descriptor_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   const f_string_range_t range = f_string_range_t_initialize;
@@ -73,14 +73,13 @@ void test__f_file_write_range__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_write_range(file, f_string_empty_s, range, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 }
 
 void test__f_file_write_range__returns_data_not(void **state) {
 
-  f_file_t file = f_file_t_initialize;
-  file.id = 0;
+  const f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
 
   {
     const f_string_range_t range = f_string_range_t_initialize;
index c74b496a440202eea9e853638b9341fcf0819aeb..ae912188d01eb72f5fc69634bda96f84694d21f5 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_write_range__fails(void **state);
 extern void test__f_file_write_range__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_write_range()
  */
-extern void test__f_file_write_range__returns_file_closed(void **state);
+extern void test__f_file_write_range__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index 771b7c27d5f3334fbefa6c8756bd6c90bb7c22d5..51c2c0bf24c4115e3b836f393e65050b69e2b1f2 100644 (file)
@@ -50,7 +50,7 @@ void test__f_file_write_until__fails(void **state) {
 
 void test__f_file_write_until__parameter_checking(void **state) {
 
-  f_file_t file = f_file_t_initialize;
+  f_file_t file = macro_f_file_t_initialize2(F_type_output_d, F_type_descriptor_output_d, F_file_flag_write_only_d);
   file.size_write = 0;
 
   {
@@ -60,7 +60,7 @@ void test__f_file_write_until__parameter_checking(void **state) {
   }
 }
 
-void test__f_file_write_until__returns_file_closed(void **state) {
+void test__f_file_write_until__returns_file_descriptor_not(void **state) {
 
   f_file_t file = f_file_t_initialize;
   file.size_write = 1;
@@ -68,7 +68,7 @@ void test__f_file_write_until__returns_file_closed(void **state) {
   {
     const f_status_t status = f_file_write_until(file, f_string_empty_s, 1, 0);
 
-    assert_int_equal(F_status_set_fine(status), F_file_closed);
+    assert_int_equal(F_status_set_fine(status), F_file_descriptor_not);
   }
 }
 
index ff8f9604309ec1f842a12c3469052b5a8fc41690..0d8a9b255445f1010cbb9a61095a3d02f2673aee 100644 (file)
@@ -25,11 +25,11 @@ extern void test__f_file_write_until__fails(void **state);
 extern void test__f_file_write_until__parameter_checking(void **state);
 
 /**
- * Test that function works but the file is closed.
+ * Test that function works but the descriptor is not valid.
  *
  * @see f_file_write_until()
  */
-extern void test__f_file_write_until__returns_file_closed(void **state);
+extern void test__f_file_write_until__returns_file_descriptor_not(void **state);
 
 /**
  * Test that function works but the path is empty.
index a5b22ec4fee2eed334465f0bad35a27ca8c89fdb..411c09fa95811f000361909259dc919366cea69c 100644 (file)
@@ -25,6 +25,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_access_at__fails),
     cmocka_unit_test(test__f_file_access_at__returns_data_not),
+    cmocka_unit_test(test__f_file_access_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_access_at__works),
 
     cmocka_unit_test(test__f_file_clone__fails_during_read_write),
@@ -36,12 +37,8 @@ int main(void) {
     cmocka_unit_test(test__f_file_clone__works_for_link),
 
     cmocka_unit_test(test__f_file_close__fails),
+    cmocka_unit_test(test__f_file_close__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_close__works),
-    cmocka_unit_test(test__f_file_close__works_already_closed),
-
-    cmocka_unit_test(test__f_file_close_flush__fails),
-    cmocka_unit_test(test__f_file_close_flush__works),
-    cmocka_unit_test(test__f_file_close_flush__works_already_closed),
 
     cmocka_unit_test(test__f_file_copy__fails_during_read_write),
     cmocka_unit_test(test__f_file_copy__fails_for_block),
@@ -66,6 +63,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_create_at__fails),
     cmocka_unit_test(test__f_file_create_at__returns_data_not),
+    cmocka_unit_test(test__f_file_create_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_create_at__works),
 
     cmocka_unit_test(test__f_file_create_device__fails),
@@ -75,6 +73,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_create_device_at__fails),
     cmocka_unit_test(test__f_file_create_device_at__returns_data_not),
+    cmocka_unit_test(test__f_file_create_device_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_create_device_at__returns_supported_not),
     cmocka_unit_test(test__f_file_create_device_at__works),
 
@@ -84,6 +83,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_create_fifo_at__fails),
     cmocka_unit_test(test__f_file_create_fifo_at__returns_data_not),
+    cmocka_unit_test(test__f_file_create_fifo_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_create_fifo_at__works),
 
     cmocka_unit_test(test__f_file_create_node__fails),
@@ -93,10 +93,12 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_create_node_at__fails),
     cmocka_unit_test(test__f_file_create_node_at__returns_data_not),
+    cmocka_unit_test(test__f_file_create_node_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_create_node_at__returns_supported_not),
     cmocka_unit_test(test__f_file_create_node_at__works),
 
     cmocka_unit_test(test__f_file_descriptor__fails),
+    cmocka_unit_test(test__f_file_descriptor__returns_stream_not),
     cmocka_unit_test(test__f_file_descriptor__works),
 
     cmocka_unit_test(test__f_file_exists__fails),
@@ -105,9 +107,11 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_exists_at__fails),
     cmocka_unit_test(test__f_file_exists_at__returns_data_not),
+    cmocka_unit_test(test__f_file_exists_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_exists_at__works),
 
     cmocka_unit_test(test__f_file_flush__fails),
+    cmocka_unit_test(test__f_file_flush__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_flush__works),
 
     cmocka_unit_test(test__f_file_group_read__fails),
@@ -121,10 +125,10 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_is_at__fails),
     cmocka_unit_test(test__f_file_is_at__returns_data_not),
+    cmocka_unit_test(test__f_file_is_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_is_at__returns_false),
     cmocka_unit_test(test__f_file_is_at__returns_true),
 
-    cmocka_unit_test(test__f_file_is_stat__fails),
     cmocka_unit_test(test__f_file_is_stat__returns_false),
     cmocka_unit_test(test__f_file_is_stat__returns_true),
 
@@ -134,6 +138,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_link_at__fails),
     cmocka_unit_test(test__f_file_link_at__returns_data_not),
+    cmocka_unit_test(test__f_file_link_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_link_at__works),
 
     cmocka_unit_test(test__f_file_link_hard__fails),
@@ -142,6 +147,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_link_hard_at__fails),
     cmocka_unit_test(test__f_file_link_hard_at__returns_data_not),
+    cmocka_unit_test(test__f_file_link_hard_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_link_hard_at__works),
 
     cmocka_unit_test(test__f_file_link_read__fails),
@@ -150,6 +156,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_link_read_at__fails),
     cmocka_unit_test(test__f_file_link_read_at__returns_data_not),
+    cmocka_unit_test(test__f_file_link_read_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_link_read_at__works),
 
     cmocka_unit_test(test__f_file_mode_determine__works_basic),
@@ -166,6 +173,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_mode_read_at__fails),
     cmocka_unit_test(test__f_file_mode_read_at__returns_data_not),
+    cmocka_unit_test(test__f_file_mode_read_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_mode_read_at__works),
 
     cmocka_unit_test(test__f_file_mode_set__fails),
@@ -174,6 +182,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_mode_set_at__fails),
     cmocka_unit_test(test__f_file_mode_set_at__returns_data_not),
+    cmocka_unit_test(test__f_file_mode_set_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_mode_set_at__works),
 
     cmocka_unit_test(test__f_file_mode_to_mode__works),
@@ -190,6 +199,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_open_at__fails),
     cmocka_unit_test(test__f_file_open_at__returns_data_not),
+    cmocka_unit_test(test__f_file_open_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_open_at__works),
 
     cmocka_unit_test(test__f_file_owner_read__fails),
@@ -197,15 +207,15 @@ int main(void) {
     cmocka_unit_test(test__f_file_owner_read__works),
 
     cmocka_unit_test(test__f_file_read__fails),
-    cmocka_unit_test(test__f_file_read__returns_file_closed),
+    cmocka_unit_test(test__f_file_read__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_read__works),
 
     cmocka_unit_test(test__f_file_read_block__fails),
-    cmocka_unit_test(test__f_file_read_block__returns_file_closed),
+    cmocka_unit_test(test__f_file_read_block__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_read_block__works),
 
     cmocka_unit_test(test__f_file_read_until__fails),
-    cmocka_unit_test(test__f_file_read_until__returns_file_closed),
+    cmocka_unit_test(test__f_file_read_until__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_read_until__works),
 
     cmocka_unit_test(test__f_file_remove__fails),
@@ -214,6 +224,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_remove_at__fails),
     cmocka_unit_test(test__f_file_remove_at__returns_data_not),
+    cmocka_unit_test(test__f_file_remove_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_remove_at__works),
 
     cmocka_unit_test(test__f_file_rename__fails),
@@ -222,6 +233,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_rename_at__fails),
     cmocka_unit_test(test__f_file_rename_at__returns_data_not),
+    cmocka_unit_test(test__f_file_rename_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_rename_at__works),
 
     cmocka_unit_test(test__f_file_role_change__fails_for_dereference),
@@ -233,10 +245,12 @@ int main(void) {
     cmocka_unit_test(test__f_file_role_change_at__fails_for_dereference),
     cmocka_unit_test(test__f_file_role_change_at__fails_for_reference),
     cmocka_unit_test(test__f_file_role_change_at__returns_data_not),
+    cmocka_unit_test(test__f_file_role_change_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_role_change_at__works_for_dereference),
     cmocka_unit_test(test__f_file_role_change_at__works_for_reference),
 
     cmocka_unit_test(test__f_file_seek__fails),
+    cmocka_unit_test(test__f_file_seek__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_seek__works),
 
     cmocka_unit_test(test__f_file_size__fails),
@@ -245,10 +259,11 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_size_at__fails),
     cmocka_unit_test(test__f_file_size_at__returns_data_not),
+    cmocka_unit_test(test__f_file_size_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_size_at__works),
 
-    cmocka_unit_test(test__f_file_size_by_id__fails),
-    cmocka_unit_test(test__f_file_size_by_id__returns_file_closed),
+    cmocka_unit_test(test__f_file_stat_by_id__fails),
+    cmocka_unit_test(test__f_file_size_by_id__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_size_by_id__works),
 
     cmocka_unit_test(test__f_file_stat__fails),
@@ -257,14 +272,15 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_stat_at__fails),
     cmocka_unit_test(test__f_file_stat_at__returns_data_not),
+    cmocka_unit_test(test__f_file_stat_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_stat_at__works),
 
     cmocka_unit_test(test__f_file_stat_by_id__fails),
-    cmocka_unit_test(test__f_file_stat_by_id__returns_file_closed),
+    cmocka_unit_test(test__f_file_stat_by_id__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_stat_by_id__works),
 
-    cmocka_unit_test(test__f_file_stream_close__fails_for_file_descriptor),
-    cmocka_unit_test(test__f_file_stream_close__fails_for_stream),
+    cmocka_unit_test(test__f_file_stream_close__fails),
+    cmocka_unit_test(test__f_file_stream_close__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_close__works),
 
     // __wrap_fdopen does not appear to be working.
@@ -276,15 +292,15 @@ int main(void) {
     cmocka_unit_test(test__f_file_stream_open__works),
 
     cmocka_unit_test(test__f_file_stream_read__fails),
-    cmocka_unit_test(test__f_file_stream_read__returns_file_closed),
+    cmocka_unit_test(test__f_file_stream_read__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_read__works),
 
     cmocka_unit_test(test__f_file_stream_read_block__fails),
-    cmocka_unit_test(test__f_file_stream_read_block__returns_file_closed),
+    cmocka_unit_test(test__f_file_stream_read_block__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_read_block__works),
 
     cmocka_unit_test(test__f_file_stream_read_until__fails),
-    cmocka_unit_test(test__f_file_stream_read_until__returns_file_closed),
+    cmocka_unit_test(test__f_file_stream_read_until__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_read_until__works),
 
     cmocka_unit_test(test__f_file_stream_reopen__fails),
@@ -292,23 +308,23 @@ int main(void) {
     cmocka_unit_test(test__f_file_stream_reopen__works),
 
     cmocka_unit_test(test__f_file_stream_write__fails),
-    cmocka_unit_test(test__f_file_stream_write__returns_file_closed),
     cmocka_unit_test(test__f_file_stream_write__returns_data_not),
+    cmocka_unit_test(test__f_file_stream_write__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_write__works),
 
     cmocka_unit_test(test__f_file_stream_write_block__fails),
-    cmocka_unit_test(test__f_file_stream_write_block__returns_file_closed),
     cmocka_unit_test(test__f_file_stream_write_block__returns_data_not),
+    cmocka_unit_test(test__f_file_stream_write_block__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_write_block__works),
 
     cmocka_unit_test(test__f_file_stream_write_range__fails),
-    cmocka_unit_test(test__f_file_stream_write_range__returns_file_closed),
     cmocka_unit_test(test__f_file_stream_write_range__returns_data_not),
+    cmocka_unit_test(test__f_file_stream_write_range__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_write_range__works),
 
     cmocka_unit_test(test__f_file_stream_write_until__fails),
-    cmocka_unit_test(test__f_file_stream_write_until__returns_file_closed),
     cmocka_unit_test(test__f_file_stream_write_until__returns_data_not),
+    cmocka_unit_test(test__f_file_stream_write_until__returns_stream_not),
     cmocka_unit_test(test__f_file_stream_write_until__works),
 
     cmocka_unit_test(test__f_file_touch__fails),
@@ -317,6 +333,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_touch_at__fails),
     cmocka_unit_test(test__f_file_touch_at__returns_data_not),
+    cmocka_unit_test(test__f_file_touch_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_touch_at__works),
 
     cmocka_unit_test(test__f_file_type__fails),
@@ -325,6 +342,7 @@ int main(void) {
 
     cmocka_unit_test(test__f_file_type_at__fails),
     cmocka_unit_test(test__f_file_type_at__returns_data_not),
+    cmocka_unit_test(test__f_file_type_at__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_type_at__works),
 
     cmocka_unit_test(test__f_file_umask_get__works),
@@ -332,22 +350,22 @@ int main(void) {
     cmocka_unit_test(test__f_file_umask_set__works),
 
     cmocka_unit_test(test__f_file_write__fails),
-    cmocka_unit_test(test__f_file_write__returns_file_closed),
+    cmocka_unit_test(test__f_file_write__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_write__returns_data_not),
     cmocka_unit_test(test__f_file_write__works),
 
     cmocka_unit_test(test__f_file_write_block__fails),
-    cmocka_unit_test(test__f_file_write_block__returns_file_closed),
+    cmocka_unit_test(test__f_file_write_block__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_write_block__returns_data_not),
     cmocka_unit_test(test__f_file_write_block__works),
 
     cmocka_unit_test(test__f_file_write_range__fails),
-    cmocka_unit_test(test__f_file_write_range__returns_file_closed),
+    cmocka_unit_test(test__f_file_write_range__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_write_range__returns_data_not),
     cmocka_unit_test(test__f_file_write_range__works),
 
     cmocka_unit_test(test__f_file_write_until__fails),
-    cmocka_unit_test(test__f_file_write_until__returns_file_closed),
+    cmocka_unit_test(test__f_file_write_until__returns_file_descriptor_not),
     cmocka_unit_test(test__f_file_write_until__returns_data_not),
     cmocka_unit_test(test__f_file_write_until__works),
 
@@ -356,7 +374,6 @@ int main(void) {
       // f_file_access_at() doesn't use parameter checking.
       // f_file_clone() doesn't use parameter checking.
       cmocka_unit_test(test__f_file_close__parameter_checking),
-      cmocka_unit_test(test__f_file_close_flush__parameter_checking),
       // f_file_copy() doesn't use parameter checking.
       // f_file_create() doesn't use parameter checking.
       // f_file_create_at() doesn't use parameter checking.
index 99f4062d8f52cf1665b79fcd5e6b35fba553ddd1..0b841d0f0e24795abff74e9894e77f8c8ae8cae9 100644 (file)
@@ -30,7 +30,6 @@
 #include "test-file-access_at.h"
 #include "test-file-clone.h"
 #include "test-file-close.h"
-#include "test-file-close_flush.h"
 #include "test-file-copy.h"
 #include "test-file-create.h"
 #include "test-file-create_at.h"
index 8d761ef8b7353ebf9f181d2711bfddd38aa53efe..b4d9dcd0521935d7aeed40bf999a23c1d592f31e 100644 (file)
@@ -17,6 +17,7 @@
 
 // Libc includes.
 #include <stdio.h>
+#include <fcntl.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -31,10 +32,118 @@ extern "C" {
  *   - read_size:  Default read size in bytes.
  *   - write_size: Default write size in bytes.
  */
-#ifndef _di_f_type_file_defaults_
-  #define F_file_default_read_size_d  8192
-  #define F_file_default_write_size_d 8192
-#endif // _di_f_type_file_defaults_
+#ifndef _di_f_type_file_defaults_d_
+  #define F_file_default_size_read_d  8192
+  #define F_file_default_size_write_d 8192
+#endif // _di_f_type_file_defaults_d_
+
+/**
+ * File flag related functionality.
+ */
+#ifndef _di_f_type_file_flag_d_
+
+  // This is not always defined, so ensure it is defined.
+  #ifndef O_PATH
+    #define O_PATH 010000000
+  #endif // O_PATH
+
+  // File open flags.
+  #define F_file_flag_append_d             O_APPEND
+  #define F_file_flag_asynchronous_d       O_ASYNC
+  #define F_file_flag_create_d             O_CREAT
+  #define F_file_flag_close_execute_d      O_CLOEXEC
+  #define F_file_flag_direct_d             O_DIRECT
+  #define F_file_flag_directory_d          O_DIRECTORY
+  #define F_file_flag_exclusive_d          O_EXCL
+  #define F_file_flag_large_file_d         O_LARGEFILE
+  #define F_file_flag_no_access_time_d     O_NOATIME
+  #define F_file_flag_no_follow_d          O_NOFOLLOW
+  #define F_file_flag_no_tty_d             O_NOCTTY
+  #define F_file_flag_non_blocking_d       O_NONBLOCK
+  #define F_file_flag_path_d               O_PATH
+  #define F_file_flag_read_only_d          O_RDONLY
+  #define F_file_flag_read_write_d         O_RDWR
+  #define F_file_flag_synchronous_d        O_SYNC
+  #define F_file_flag_synchronous_direct_d O_DSYNC
+  #define F_file_flag_temporary_d          O_TMPFILE
+  #define F_file_flag_truncate_d           O_TRUNC
+  #define F_file_flag_write_only_d         O_WRONLY
+
+  // File open flags pre-combined with create.
+  #define F_file_flag_create_ro_d (O_CREAT | O_RDONLY)
+  #define F_file_flag_create_wo_d (O_CREAT | O_WRONLY)
+  #define F_file_flag_create_rw_d (O_CREAT | O_RDRW)
+
+  // File open flags pre-combined will fail if file exists.
+  #define F_file_flag_create_new_ro_d (O_CREAT | O_EXCL | O_RDONLY)
+  #define F_file_flag_create_new_wo_d (O_CREAT | O_EXCL | O_WRONLY)
+  #define F_file_flag_create_new_rw_d (O_CREAT | O_EXCL | O_RDRW)
+
+  // File open flags pre-combined will truncate any existing files to 0.
+  #define F_file_flag_truncate_ro_d (O_CREAT | O_TRUNC | O_RDONLY)
+  #define F_file_flag_truncate_rw_d (O_CREAT | O_TRUNC | O_RDRW)
+  #define F_file_flag_truncate_wo_d (O_CREAT | O_TRUNC | O_WRONLY)
+
+  // File open flags pre-combined will truncate any existing files to 0.
+  #define F_file_flag_append_rw_d (O_CREAT | O_APPEND | O_RDRW)
+  #define F_file_flag_append_wo_d (O_CREAT | O_APPEND | O_WRONLY)
+
+  // File open flags pre-combined with synchronous io.
+  #define F_file_flag_sync_ro_d            (O_SYNC | O_RDONLY)
+  #define F_file_flag_sync_wo_d            (O_SYNC | O_WRONLY)
+  #define F_file_flag_sync_rw_d            (O_SYNC | O_RDRW)
+  #define F_file_flag_sync_create_ro_d     (O_SYNC | O_CREAT | O_RDONLY)
+  #define F_file_flag_sync_create_wo_d     (O_SYNC | O_CREAT | O_WRONLY)
+  #define F_file_flag_sync_create_rw_d     (O_SYNC | O_CREAT | O_RDRW)
+  #define F_file_flag_sync_create_new_ro_d (O_SYNC | O_CREAT | O_EXCL | O_RDONLY)
+  #define F_file_flag_sync_create_new_wo_d (O_SYNC | O_CREAT | O_EXCL | O_WRONLY)
+  #define F_file_flag_sync_create_new_rw_d (O_SYNC | O_CREAT | O_EXCL | O_RDRW)
+
+  // File open flags pre-combined with asynchronous io.
+  #define F_file_flag_async_ro_d            (O_ASYNC | O_RDONLY)
+  #define F_file_flag_async_wo_d            (O_ASYNC | O_WRONLY)
+  #define F_file_flag_async_rw_d            (O_ASYNC | O_RDRW)
+  #define F_file_flag_async_create_ro_d     (O_ASYNC | O_CREAT | O_RDONLY)
+  #define F_file_flag_async_create_wo_d     (O_ASYNC | O_CREAT | O_WRONLY)
+  #define F_file_flag_async_create_rw_d     (O_ASYNC | O_CREAT | O_RDRW)
+  #define F_file_flag_async_create_new_ro_d (O_ASYNC | O_CREAT | O_EXCL | O_RDONLY)
+  #define F_file_flag_async_create_new_wo_d (O_ASYNC | O_CREAT | O_EXCL | O_WRONLY)
+  #define F_file_flag_async_create_new_rw_d (O_ASYNC | O_CREAT | O_EXCL | O_RDRW)
+
+  // File open flags pre-combined with direct io (which works synchronously).
+  #define F_file_flag_direct_ro_d            (O_DIRECT | O_RDONLY)
+  #define F_file_flag_direct_wo_d            (O_DIRECT | O_WRONLY)
+  #define F_file_flag_direct_rw_d            (O_DIRECT | O_RDRW)
+  #define F_file_flag_direct_create_ro_d     (O_DIRECT | O_CREAT | O_RDONLY)
+  #define F_file_flag_direct_create_wo_d     (O_DIRECT | O_CREAT | O_WRONLY)
+  #define F_file_flag_direct_create_rw_d     (O_DIRECT | O_CREAT | O_RDRW)
+  #define F_file_flag_direct_create_new_ro_d (O_DIRECT | O_CREAT | O_EXCL | O_RDONLY)
+  #define F_file_flag_direct_create_new_wo_d (O_DIRECT | O_CREAT | O_EXCL | O_WRONLY)
+  #define F_file_flag_direct_create_new_rw_d (O_DIRECT | O_CREAT | O_EXCL | O_RDRW)
+
+  // File open flags pre-combined with large_file.
+  #define F_file_flag_large_ro_d                  (O_LARGEFILE | O_RDONLY)
+  #define F_file_flag_large_wo_d                  (O_LARGEFILE | O_WRONLY)
+  #define F_file_flag_large_rw_d                  (O_LARGEFILE | O_RDRW)
+  #define F_file_flag_large_sync_ro_d             (O_LARGEFILE | O_SYNC | O_RDONLY)
+  #define F_file_flag_large_sync_wo_d             (O_LARGEFILE | O_SYNC | O_WRONLY)
+  #define F_file_flag_large_sync_rw_d             (O_LARGEFILE | O_SYNC | O_RDRW)
+  #define F_file_flag_large_sync_create_ro_d      (O_LARGEFILE | O_SYNC | O_CREAT | O_RDONLY)
+  #define F_file_flag_large_sync_create_wo_d      (O_LARGEFILE | O_SYNC | O_CREAT | O_WRONLY)
+  #define F_file_flag_large_sync_create_rw_d      (O_LARGEFILE | O_SYNC | O_CREAT | O_RDRW)
+  #define F_file_flag_large_sync_create_new_ro_d  (O_LARGEFILE | O_SYNC | O_CREAT | O_EXCL | O_RDONLY)
+  #define F_file_flag_large_sync_create_new_wo_d  (O_LARGEFILE | O_SYNC | O_CREAT | O_EXCL | O_WRONLY)
+  #define F_file_flag_large_sync_create_new_rw_d  (O_LARGEFILE | O_SYNC | O_CREAT | O_EXCL | O_RDRW)
+  #define F_file_flag_large_async_ro_d            (O_LARGEFILE | O_ASYNC | O_RDONLY)
+  #define F_file_flag_large_async_wo_d            (O_LARGEFILE | O_ASYNC | O_WRONLY)
+  #define F_file_flag_large_async_rw_d            (O_LARGEFILE | O_ASYNC | O_RDRW)
+  #define F_file_flag_large_async_create_ro_d     (O_LARGEFILE | O_ASYNC | O_CREAT | O_RDONLY)
+  #define F_file_flag_large_async_create_wo_d     (O_LARGEFILE | O_ASYNC | O_CREAT | O_WRONLY)
+  #define F_file_flag_large_async_create_rw_d     (O_LARGEFILE | O_ASYNC | O_CREAT | O_RDRW)
+  #define F_file_flag_large_async_create_new_ro_d (O_LARGEFILE | O_ASYNC | O_CREAT | O_EXCL | O_RDONLY)
+  #define F_file_flag_large_async_create_new_wo_d (O_LARGEFILE | O_ASYNC | O_CREAT | O_EXCL | O_WRONLY)
+  #define F_file_flag_large_async_create_new_rw_d (O_LARGEFILE | O_ASYNC | O_CREAT | O_EXCL | O_RDRW)
+#endif // _di_f_type_file_flag_d_
 
 /**
  * Commonly used file related properties.
@@ -54,12 +163,12 @@ extern "C" {
     size_t size_write;
   } f_file_t;
 
-  #define f_file_t_initialize { 0, -1, O_RDONLY, F_file_default_read_size_d, F_file_default_write_size_d }
+  #define f_file_t_initialize { 0, -1, O_RDONLY, F_file_default_size_read_d, F_file_default_size_write_d }
 
   #define macro_f_file_t_initialize(stream, id, flag, read_size, write_size) { stream, id, flag, read_size, write_size }
-  #define macro_f_file_t_initialize2(stream, id, flag) { stream, id, flag, F_file_default_read_size_d, F_file_default_write_size_d }
-  #define macro_f_file_t_initialize_id(id) { 0, id, O_RDONLY, F_file_default_read_size_d, F_file_default_write_size_d }
-  #define macro_f_file_t_initialize_stream(stream) { stream, -1, O_RDONLY, F_file_default_read_size_d, F_file_default_write_size_d }
+  #define macro_f_file_t_initialize2(stream, id, flag) { stream, id, flag, F_file_default_size_read_d, F_file_default_size_write_d }
+  #define macro_f_file_t_initialize_id(id) { 0, id, O_RDONLY, F_file_default_size_read_d, F_file_default_size_write_d }
+  #define macro_f_file_t_initialize_stream(stream) { stream, -1, O_RDONLY, F_file_default_size_read_d, F_file_default_size_write_d }
 
   #define macro_f_file_t_clear(file) \
     file.stream = 0; \
@@ -72,8 +181,8 @@ extern "C" {
     file.stream = 0; \
     file.id = -1; \
     file.flag = O_RDONLY; \
-    file.size_read = F_file_default_read_size_d; \
-    file.size_write = F_file_default_write_size_d;
+    file.size_read = F_file_default_size_read_d; \
+    file.size_write = F_file_default_size_write_d;
 #endif // _di_f_file_t_
 
 #ifdef __cplusplus
index 18ae30e9d393af32e219ce2b647447e94c26ff0e..662ea3e20426601d003192e0940abfa314204bac 100644 (file)
@@ -288,7 +288,7 @@ extern "C" {
 
         fake_print_verbose_copying(&main->program.message, main->cache_2, main->cache_map.value);
 
-        main->setting.state.status = f_file_copy(main->cache_2, main->cache_map.value, mode, F_file_default_read_size_d, f_file_stat_flag_reference_e);
+        main->setting.state.status = f_file_copy(main->cache_2, main->cache_map.value, mode, F_file_default_size_read_d, f_file_stat_flag_reference_e);
 
         if (F_status_is_error(main->setting.state.status)) {
           fake_print_error_build_operation_file(&main->program.error, macro_fake_f(f_file_copy), f_file_operation_copy_s, main->cache_2, main->cache_map.value, f_file_operation_to_s, F_true);
index 8365f41cf87709ec16ac7ece7286ba01fd5cf755..13500638e3a61906e865589f3f5df9ccc1fc3465 100644 (file)
@@ -28,12 +28,12 @@ extern "C" {
         if (recurse->state.code & fake_state_code_clone_e) {
           fake_print_verbose_cloning(&local->main->program.message, *recurse->path_top, map->name);
 
-          recurse->state.status = f_file_clone(*recurse->path_top, map->name, F_file_default_write_size_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
+          recurse->state.status = f_file_clone(*recurse->path_top, map->name, F_file_default_size_write_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
         }
         else {
           fake_print_verbose_copying(&local->main->program.message, *recurse->path_top, map->name);
 
-          recurse->state.status = f_file_copy(*recurse->path_top, map->name, recurse->mode, F_file_default_write_size_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
+          recurse->state.status = f_file_copy(*recurse->path_top, map->name, recurse->mode, F_file_default_size_write_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
         }
 
         if (F_status_is_error(recurse->state.status)) {
@@ -86,12 +86,12 @@ extern "C" {
         if (recurse->state.code & fake_state_code_clone_e) {
           fake_print_verbose_cloning(&local->main->program.message, recurse->path, recurse->path_cache);
 
-          recurse->state.status = f_file_clone(recurse->path, recurse->path_cache, F_file_default_write_size_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
+          recurse->state.status = f_file_clone(recurse->path, recurse->path_cache, F_file_default_size_write_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
         }
         else {
           fake_print_verbose_copying(&local->main->program.message, recurse->path, recurse->path_cache);
 
-          recurse->state.status = f_file_copy(recurse->path, recurse->path_cache, recurse->mode, F_file_default_write_size_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
+          recurse->state.status = f_file_copy(recurse->path, recurse->path_cache, recurse->mode, F_file_default_size_write_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
         }
 
         if (F_status_is_error(recurse->state.status)) {
@@ -146,12 +146,12 @@ extern "C" {
     if (recurse->state.code & fake_state_code_clone_e) {
       fake_print_verbose_cloning(&local->main->program.message, recurse->path, map->value);
 
-      recurse->state.status = f_file_clone(recurse->path, map->value, F_file_default_write_size_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
+      recurse->state.status = f_file_clone(recurse->path, map->value, F_file_default_size_write_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
     }
     else {
       fake_print_verbose_copying(&local->main->program.message, recurse->path, map->value);
 
-      recurse->state.status = f_file_copy(recurse->path, map->value, recurse->mode, F_file_default_write_size_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
+      recurse->state.status = f_file_copy(recurse->path, map->value, recurse->mode, F_file_default_size_write_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
     }
 
     if (F_status_is_error(recurse->state.status)) {
index 9e3f93bab707f64af2cf50becb3525f726342551..c8cd0a9950e1c3d3178a20ebb7633d71455db6ca 100644 (file)
@@ -305,10 +305,10 @@ extern "C" {
         }
         else if (main->setting.state.status == F_false) {
           if (clone) {
-            main->setting.state.status = f_file_clone(main->cache_arguments.array[i], main->cache_map.name, F_file_default_write_size_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
+            main->setting.state.status = f_file_clone(main->cache_arguments.array[i], main->cache_map.name, F_file_default_size_write_d, f_file_stat_flag_group_e | f_file_stat_flag_owner_e | (f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e));
           }
           else {
-            main->setting.state.status = f_file_copy(main->cache_arguments.array[i], main->cache_map.name, main->cache_recurse_do.mode, F_file_default_write_size_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
+            main->setting.state.status = f_file_copy(main->cache_arguments.array[i], main->cache_map.name, main->cache_recurse_do.mode, F_file_default_size_write_d, f_directory_recurse_do_flag_dereference_e ? 0 : f_file_stat_flag_reference_e);
           }
 
           if (F_status_is_error(main->setting.state.status)) {
index 757006dd77cf24944aa83e6aecd833ff70e8af73..6fd51eb3ad62bb8735c1ecfd39d3e42510ff033b 100644 (file)
@@ -44,7 +44,7 @@ extern "C" {
     f_status_t valid = F_true;
 
     if (main->program.pipe & fll_program_data_pipe_input_e) {
-      const f_file_t file = macro_f_file_t_initialize(F_type_input_d, F_type_descriptor_input_d, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
+      const f_file_t file = macro_f_file_t_initialize(F_type_input_d, F_type_descriptor_input_d, F_file_flag_read_only_d, 32768, F_file_default_size_write_d);
 
       utf8_print_data_section_header_pipe(&main->program.output);
 
@@ -73,7 +73,7 @@ extern "C" {
 
     // Process "from" files.
     if (F_status_is_error_not(main->setting.state.status) && (main->setting.flag & utf8_main_flag_file_from_e)) {
-      f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
+      f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_size_write_d);
 
       for (f_array_length_t i = 0; i < main->setting.path_files_from.used && F_status_is_error_not(main->setting.state.status); ++i) {