]> Kevux Git Server - fll/commitdiff
Progress: Begin adding tests for f_file project and clean up the f_directory tests.
authorKevin Day <thekevinday@gmail.com>
Mon, 11 Apr 2022 02:28:27 +0000 (21:28 -0500)
committerKevin Day <thekevinday@gmail.com>
Mon, 11 Apr 2022 02:28:27 +0000 (21:28 -0500)
The f_directory tests has two unused mocked functions that are no longer needed (they are stale).

The size of the f_file project is huge.
The number of tests needed is huge.

This is my first pass and writing the unit tests for f_file.

162 files changed:
level_0/f_directory/tests/unit/c/mock-directory.c
level_0/f_directory/tests/unit/c/mock-directory.h
level_0/f_file/data/build/dependencies-tests [new file with mode: 0644]
level_0/f_file/data/build/settings-mocks [new file with mode: 0644]
level_0/f_file/data/build/settings-tests [new file with mode: 0644]
level_0/f_file/data/build/testfile [new file with mode: 0644]
level_0/f_file/tests/unit/c/mock-file.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/mock-file.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-access.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-access.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-access_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-access_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-clone.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-clone.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-close.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-close.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-close_flush.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-close_flush.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-copy.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-copy.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_device.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_device.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_device_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_device_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_fifo.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_fifo.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_fifo_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_fifo_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_node.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_node.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_node_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-create_node_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-descriptor.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-descriptor.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-exists.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-exists.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-exists_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-exists_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-flush.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-flush.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-group_read.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-group_read.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-is.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-is.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-is_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-is_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_hard.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_hard.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_hard_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_hard_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_read.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_read.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_read_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-link_read_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_determine.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_determine.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_from_string.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_from_string.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_read.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_read.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_read_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_read_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_set.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_set.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_set_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_set_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_to_mode.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-mode_to_mode.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-name_base.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-name_base.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-name_directory.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-name_directory.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-open.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-open.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-open_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-open_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-owner_read.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-owner_read.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-read.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-read.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-read_block.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-read_block.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-read_until.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-read_until.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-remove.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-remove.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-remove_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-remove_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-rename.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-rename.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-rename_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-rename_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-role_change.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-role_change.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-role_change_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-role_change_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-seek.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-seek.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-size.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-size.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-size_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-size_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-size_by_id.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-size_by_id.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stat.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stat.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stat_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stat_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stat_by_id.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stat_by_id.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_close.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_close.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_descriptor.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_descriptor.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_open.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_open.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_read.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_read.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_read_block.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_read_block.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_read_until.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_read_until.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_reopen.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_reopen.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write_block.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write_block.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write_range.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write_range.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write_until.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-stream_write_until.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-touch.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-touch.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-touch_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-touch_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-type.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-type.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-type_at.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-type_at.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-umask_get.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-umask_get.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-umask_set.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-umask_set.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write_block.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write_block.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write_range.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write_range.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write_until.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file-write_until.h [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file.c [new file with mode: 0644]
level_0/f_file/tests/unit/c/test-file.h [new file with mode: 0644]

index 16e6b64dfa51f54036b58cf5eaaa24e81a2b581e..9d0515cf8eb10d3fb5b94f1ae31d66a82905e41f 100644 (file)
@@ -168,16 +168,6 @@ int __wrap_stat(const char *pathname, struct stat *statbuf) {
   return mock_type(int);
 }
 
-int __wrap_strncmp(const char *s1, const char *s2, size_t n) {
-
-  return mock_type(size_t);
-}
-
-size_t __wrap_strnlen(const char *s, size_t maxlen) {
-
-  return mock_type(size_t);
-}
-
 int __wrap_utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags) {
 
   const bool failure = mock_type(bool);
index d714d1011a6e421c7441654b183a8520e068b65f..3d6afe75e37f30a45ee1f8b2de35b096117f18ad 100644 (file)
@@ -38,8 +38,6 @@ extern int __wrap_openat(int dirfd, const char *pathname, int flags);
 extern int __wrap_remove(const char *pathname);
 extern int __wrap_scandir(const char *dirp, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **));
 extern int __wrap_stat(const char *pathname, struct stat *statbuf);
-extern int __wrap_strncmp(const char *s1, const char *s2, size_t n);
-extern size_t __wrap_strnlen(const char *s, size_t maxlen);
 extern int __wrap_utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags);
 extern int __wrap_versionsort(const struct dirent **a, const struct dirent **b);
 
diff --git a/level_0/f_file/data/build/dependencies-tests b/level_0/f_file/data/build/dependencies-tests
new file mode 100644 (file)
index 0000000..dea3179
--- /dev/null
@@ -0,0 +1,3 @@
+# fss-0001
+
+cmocka 1.*
diff --git a/level_0/f_file/data/build/settings-mocks b/level_0/f_file/data/build/settings-mocks
new file mode 100644 (file)
index 0000000..27e594e
--- /dev/null
@@ -0,0 +1,96 @@
+# fss-0001
+#
+# Build the project with appropriate mocks linked in via the dynamic linker's "--wrap" functionality.
+#
+# The -Wl,--wrap does not work across shared files.
+# Therefore, this file is a work-around to inject the mocks into the library for testing purposes.
+# This should exactly match the "settings" file, except for the additional "-Wl,--wrap" parts and the additional mock source file.
+#
+# The flags -o0 must be passed to prevent the compiler from optimizing away any functions being mocked (which results in the mock not happening and a real function being called).
+# Alternatively, figure out which optimization that is disabled by -o0 and have that specific optimization disabled.
+#
+
+build_name f_file
+
+version_major 0
+version_minor 5
+version_micro 9
+version_file micro
+version_target minor
+
+modes individual clang test
+modes_default individual
+
+build_compiler gcc
+build_compiler-clang clang
+build_indexer ar
+build_indexer_arguments rcs
+build_language c
+
+build_libraries -lc
+build_libraries-individual -lf_memory -lf_string
+
+build_sources_library file.c file/common.c private-file.c ../../tests/unit/c/mock-file.c
+
+build_sources_headers file.h file/common.h file/type.h
+
+build_script yes
+build_shared yes
+build_static no
+
+path_headers fll/level_0
+path_library_script script
+path_library_shared shared
+path_library_static static
+
+has_path_standard yes
+preserve_path_headers yes
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+flags -O0 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses
+flags-clang -Wno-logical-op-parentheses
+flags-test -fstack-protector
+
+flags_library -fPIC
+close read write
+
+# Inject mocks.
+flags -Wl,--wrap=access
+flags -Wl,--wrap=chmod
+flags -Wl,--wrap=chown
+flags -Wl,--wrap=close
+flags -Wl,--wrap=faccessat
+flags -Wl,--wrap=fchmodat
+flags -Wl,--wrap=fchownat
+flags -Wl,--wrap=feof
+flags -Wl,--wrap=ferror
+flags -Wl,--wrap=flockfile
+flags -Wl,--wrap=fread_unlocked
+flags -Wl,--wrap=fstat
+flags -Wl,--wrap=fstatat
+flags -Wl,--wrap=fsync
+flags -Wl,--wrap=funlockfile
+flags -Wl,--wrap=fwrite
+flags -Wl,--wrap=lchown
+flags -Wl,--wrap=lstat
+flags -Wl,--wrap=makedev
+flags -Wl,--wrap=mkdir
+flags -Wl,--wrap=mkdirat
+flags -Wl,--wrap=mkfifo
+flags -Wl,--wrap=mkfifoat
+flags -Wl,--wrap=mknod
+flags -Wl,--wrap=mknodat
+flags -Wl,--wrap=open
+flags -Wl,--wrap=openat
+flags -Wl,--wrap=read
+flags -Wl,--wrap=readlink
+flags -Wl,--wrap=remove
+flags -Wl,--wrap=stat
+flags -Wl,--wrap=symlink
+flags -Wl,--wrap=symlinkat
+flags -Wl,--wrap=unlink
+flags -Wl,--wrap=unlinkat
+flags -Wl,--wrap=write
diff --git a/level_0/f_file/data/build/settings-tests b/level_0/f_file/data/build/settings-tests
new file mode 100644 (file)
index 0000000..ed6919e
--- /dev/null
@@ -0,0 +1,53 @@
+# fss-0001
+#
+# Builds a program that is links to the generated library and is executed to perform tests.
+#
+# Memory leaks in the test program can be checked for by running valgrind with this executable.
+#
+
+build_name test-f_file
+
+version_major 0
+version_minor 5
+version_micro 9
+version_file major
+version_target major
+
+modes individual clang test
+modes_default individual
+
+build_compiler gcc
+build_compiler-clang clang
+build_indexer ar
+build_indexer_arguments rcs
+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-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_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
+build_shared yes
+build_static no
+
+path_headers tests/unit/c
+path_sources tests/unit/c
+
+has_path_standard no
+preserve_path_headers yes
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+defines -Ibuild/includes
+defines_static -Lbuild/libraries/static
+defines_shared -Lbuild/libraries/shared
+
+flags -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses
+flags-clang -Wno-logical-op-parentheses
+flags-test -fstack-protector
+
+flags_program -fPIE
diff --git a/level_0/f_file/data/build/testfile b/level_0/f_file/data/build/testfile
new file mode 100644 (file)
index 0000000..143bd61
--- /dev/null
@@ -0,0 +1,45 @@
+# fss-0005 iki-0002
+
+settings:
+  load_build yes
+  fail exit
+
+  environment LD_LIBRARY_PATH
+
+main:
+  build settings-mocks
+  build settings-tests
+
+  operate ld_library_path
+
+  if exists build/programs/shared/test-f_file
+    shell build/programs/shared/test-f_file
+
+  if exists build/programs/static/test-f_file
+    shell build/programs/static/test-f_file
+
+  if not exists build/programs/shared/test-f_file
+  and not exists build/programs/static/test-f_file
+    operate not_created
+
+not_created:
+  print
+  print 'context:"error"Failed to test due to being unable to find either a shared or static test binary to perform tests. context:"reset"'
+
+  exit failure
+
+ld_library_path:
+  if defined environment LD_LIBRARY_PATH
+  and defined parameter work
+    define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"'
+
+  else
+  if defined environment LD_LIBRARY_PATH
+    define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"'
+
+  else
+  if defined parameter work
+    define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared'
+
+  else
+    define LD_LIBRARY_PATH build/libraries/shared
diff --git a/level_0/f_file/tests/unit/c/mock-file.c b/level_0/f_file/tests/unit/c/mock-file.c
new file mode 100644 (file)
index 0000000..8562467
--- /dev/null
@@ -0,0 +1,555 @@
+#include "mock-file.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __wrap_access(const char *pathname, int mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_chmod(const char *pathname, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_chown(const char *pathname, uid_t owner, gid_t group) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_close(int fd) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_faccessat(int dirfd, const char *pathname, int mode, int flags) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_fchmod(const char *pathname, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_fchmodat(int dirfd, const char *pathname, mode_t mode, int flags) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_fchown(int fd, uid_t owner, gid_t group) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_feof_unlocked(FILE *stream) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_ferror_unlocked(FILE *stream) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+void __wrap_flockfile(FILE *filehandle) {
+
+}
+
+size_t __wrap_fread_unlocked(void *ptr, size_t size, size_t nmemb, FILE *stream) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return 0;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_fstat(int fd, struct stat *statbuf) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  struct stat * const mocked_stat = mock_type(struct stat *);
+
+  statbuf->st_dev = mocked_stat->st_dev;
+  statbuf->st_ino = mocked_stat->st_ino;
+  statbuf->st_mode = mocked_stat->st_mode;
+  statbuf->st_nlink = mocked_stat->st_nlink;
+  statbuf->st_uid = mocked_stat->st_uid;
+  statbuf->st_gid = mocked_stat->st_gid;
+  statbuf->st_rdev = mocked_stat->st_rdev;
+  statbuf->st_size = mocked_stat->st_size;
+  statbuf->st_blksize = mocked_stat->st_blksize;
+  statbuf->st_blocks = mocked_stat->st_blocks;
+  statbuf->st_atime = mocked_stat->st_atime;
+  statbuf->st_mtime = mocked_stat->st_mtime;
+  statbuf->st_ctime = mocked_stat->st_ctime;
+
+  return mock_type(int);
+}
+
+int __wrap_fstatat(int dirfd, const char *pathname, struct stat *statbuf, int flags) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  struct stat * const mocked_stat = mock_type(struct stat *);
+
+  statbuf->st_dev = mocked_stat->st_dev;
+  statbuf->st_ino = mocked_stat->st_ino;
+  statbuf->st_mode = mocked_stat->st_mode;
+  statbuf->st_nlink = mocked_stat->st_nlink;
+  statbuf->st_uid = mocked_stat->st_uid;
+  statbuf->st_gid = mocked_stat->st_gid;
+  statbuf->st_rdev = mocked_stat->st_rdev;
+  statbuf->st_size = mocked_stat->st_size;
+  statbuf->st_blksize = mocked_stat->st_blksize;
+  statbuf->st_blocks = mocked_stat->st_blocks;
+  statbuf->st_atime = mocked_stat->st_atime;
+  statbuf->st_mtime = mocked_stat->st_mtime;
+  statbuf->st_ctime = mocked_stat->st_ctime;
+
+  return mock_type(int);
+}
+
+int __wrap_fsync(int fd) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+void __wrap_funlockfile(FILE *filehandle) {
+
+}
+
+size_t __wrap_fwrite_unlocked(const void *ptr, size_t size, size_t nmemb, FILE *stream) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return 0;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_lchown(const char *pathname, uid_t owner, gid_t group) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_lstat(const char *pathname, struct stat *statbuf) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  struct stat * const mocked_stat = mock_type(struct stat *);
+
+  statbuf->st_dev = mocked_stat->st_dev;
+  statbuf->st_ino = mocked_stat->st_ino;
+  statbuf->st_mode = mocked_stat->st_mode;
+  statbuf->st_nlink = mocked_stat->st_nlink;
+  statbuf->st_uid = mocked_stat->st_uid;
+  statbuf->st_gid = mocked_stat->st_gid;
+  statbuf->st_rdev = mocked_stat->st_rdev;
+  statbuf->st_size = mocked_stat->st_size;
+  statbuf->st_blksize = mocked_stat->st_blksize;
+  statbuf->st_blocks = mocked_stat->st_blocks;
+  statbuf->st_atime = mocked_stat->st_atime;
+  statbuf->st_mtime = mocked_stat->st_mtime;
+  statbuf->st_ctime = mocked_stat->st_ctime;
+
+  return mock_type(int);
+}
+
+int __wrap_mkdir(const char *pathname, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_mkdirat(int dirfd, const char *pathname, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_mkfifo(const char *pathname, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_mkfifoat(int dirfd, const char *pathname, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_mknod(const char *pathname, mode_t mode, dev_t dev) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_open(const char *pathname, int flags, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_openat(int dirfd, const char *pathname, int flags, mode_t mode) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+ssize_t __wrap_read(int fd, void *buf, size_t count) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  buf = mock_type(void *);
+
+  return mock_type(int);
+}
+
+ssize_t __wrap_readlink(const char *pathname, char *buf, size_t bufsiz) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  buf = mock_type(char *);
+
+  return mock_type(int);
+}
+
+ssize_t __wrap_readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  buf = mock_type(char *);
+
+  return mock_type(int);
+}
+
+int __wrap_remove(const char *pathname) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_stat(const char *pathname, struct stat *statbuf) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  struct stat * const mocked_stat = mock_type(struct stat *);
+
+  statbuf->st_dev = mocked_stat->st_dev;
+  statbuf->st_ino = mocked_stat->st_ino;
+  statbuf->st_mode = mocked_stat->st_mode;
+  statbuf->st_nlink = mocked_stat->st_nlink;
+  statbuf->st_uid = mocked_stat->st_uid;
+  statbuf->st_gid = mocked_stat->st_gid;
+  statbuf->st_rdev = mocked_stat->st_rdev;
+  statbuf->st_size = mocked_stat->st_size;
+  statbuf->st_blksize = mocked_stat->st_blksize;
+  statbuf->st_blocks = mocked_stat->st_blocks;
+  statbuf->st_atime = mocked_stat->st_atime;
+  statbuf->st_mtime = mocked_stat->st_mtime;
+  statbuf->st_ctime = mocked_stat->st_ctime;
+
+  return mock_type(int);
+}
+
+int __wrap_symlink(const char *target, const char *linkpath) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_symlinkat(const char *target, int newdirfd, const char *linkpath) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_unlink(const char *pathname) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+int __wrap_unlinkat(int dirfd, const char *pathname, int flags) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+ssize_t __wrap_write(int fd, const void *buf, size_t count) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  return mock_type(int);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/mock-file.h b/level_0/f_file/tests/unit/c/mock-file.h
new file mode 100644 (file)
index 0000000..92aa74f
--- /dev/null
@@ -0,0 +1,74 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _MOCK__file_h
+#define _MOCK__file_h
+
+// Libc includes.
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <stdint.h>
+
+// cmocka includes.
+#include <cmocka.h>
+
+// FLL-0 includes.
+#include <fll/level_0/directory.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const static int mock_errno_generic = 32767;
+
+extern int __wrap_access(const char *pathname, int mode);
+extern int __wrap_chmod(const char *pathname, mode_t mode);
+extern int __wrap_chown(const char *pathname, uid_t owner, gid_t group);
+extern int __wrap_close(int fd);
+extern int __wrap_faccessat(int dirfd, const char *pathname, int mode, int flags);
+extern int __wrap_fchmod(const char *pathname, mode_t mode);
+extern int __wrap_fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
+extern int __wrap_fchown(int fd, uid_t owner, gid_t group);
+extern int __wrap_fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags);
+extern int __wrap_feof_unlocked(FILE *stream);
+extern int __wrap_ferror_unlocked(FILE *stream);
+extern void __wrap_flockfile(FILE *filehandle);
+extern size_t __wrap_fread_unlocked(void *ptr, size_t size, size_t nmemb, FILE *stream);
+extern int __wrap_fstat(int fd, struct stat *statbuf);
+extern int __wrap_fstatat(int dirfd, const char *pathname, struct stat *statbuf, int flags);
+extern int __wrap_fsync(int fd);
+extern void __wrap_funlockfile(FILE *filehandle);
+extern size_t __wrap_fwrite_unlocked(const void *ptr, size_t size, size_t nmemb, FILE *stream);
+extern int __wrap_lchown(const char *pathname, uid_t owner, gid_t group);
+extern int __wrap_lstat(const char *pathname, struct stat *statbuf);
+extern int __wrap_mkdir(const char *pathname, mode_t mode);
+extern int __wrap_mkdirat(int dirfd, const char *pathname, mode_t mode);
+extern int __wrap_mkfifo(const char *pathname, mode_t mode);
+extern int __wrap_mkfifoat(int dirfd, const char *pathname, mode_t mode);
+extern int __wrap_mknod(const char *pathname, mode_t mode, dev_t dev);
+extern int __wrap_mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev);
+extern int __wrap_open(const char *pathname, int flags, mode_t mode);
+extern int __wrap_openat(int dirfd, const char *pathname, int flags, mode_t mode);
+extern ssize_t __wrap_read(int fd, void *buf, size_t count);
+extern ssize_t __wrap_readlink(const char *pathname, char *buf, size_t bufsiz);
+extern ssize_t __wrap_readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);
+extern int __wrap_remove(const char *pathname);
+extern int __wrap_stat(const char *pathname, struct stat *statbuf);
+extern int __wrap_symlink(const char *target, const char *linkpath);
+extern int __wrap_symlinkat(const char *target, int newdirfd, const char *linkpath);
+extern int __wrap_unlink(const char *pathname);
+extern int __wrap_unlinkat(int dirfd, const char *pathname, int flags);
+extern ssize_t __wrap_write(int fd, const void *buf, size_t count);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _MOCK__file_h
diff --git a/level_0/f_file/tests/unit/c/test-file-access.c b/level_0/f_file/tests/unit/c/test-file-access.c
new file mode 100644 (file)
index 0000000..1cd9f15
--- /dev/null
@@ -0,0 +1,119 @@
+#include "test-file.h"
+#include "test-file-access.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_access__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_status_set_error(F_access_denied),
+      F_status_set_error(F_buffer),
+      F_status_set_error(F_loop),
+      F_status_set_error(F_name),
+      F_false,
+      F_status_set_error(F_memory_not),
+      F_status_set_error(F_directory_not),
+      F_status_set_error(F_number_overflow),
+      F_status_set_error(F_failure),
+    };
+
+    for (int i = 0; i < 9; ++i) {
+
+      will_return(__wrap_access, true);
+      will_return(__wrap_access, errnos[i]);
+
+      const f_status_t status = f_file_access(path, F_file_access_mode_exist_d);
+
+      assert_int_equal(status, statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_false,
+      F_status_set_error(F_buffer),
+      F_status_set_error(F_loop),
+      F_status_set_error(F_name),
+      F_status_set_error(F_file_not),
+      F_status_set_error(F_memory_not),
+      F_status_set_error(F_directory_not),
+      F_status_set_error(F_number_overflow),
+      F_status_set_error(F_failure),
+    };
+
+    int modes[] = {
+      F_file_access_mode_read_d,
+      F_file_access_mode_write_d,
+      F_file_access_mode_execute_d,
+    };
+
+    for (int j = 0; j < 3; ++j){
+
+      for (int i = 0; i < 9; ++i) {
+
+        will_return(__wrap_access, true);
+        will_return(__wrap_access, errnos[i]);
+
+        const f_status_t status = f_file_access(path, modes[j]);
+
+        assert_int_equal(status, statuss[i]);
+      } // for
+    } // for
+  }
+}
+
+void test__f_file_access__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_access(f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_access__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    will_return(__wrap_access, false);
+    will_return(__wrap_access, 0);
+
+    const f_status_t status = f_file_access(path, F_file_access_mode_exist_d);
+
+    assert_int_equal(status, F_true);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-access.h b/level_0/f_file/tests/unit/c/test-file-access.h
new file mode 100644 (file)
index 0000000..3ade2cb
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_access_h
+#define _TEST__F_file_access_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_access()
+ */
+extern void test__f_file_access__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_access()
+ */
+extern void test__f_file_access__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_access()
+ */
+extern void test__f_file_access__works(void **state);
+
+#endif // _TEST__F_file_access_h
diff --git a/level_0/f_file/tests/unit/c/test-file-access_at.c b/level_0/f_file/tests/unit/c/test-file-access_at.c
new file mode 100644 (file)
index 0000000..62a8584
--- /dev/null
@@ -0,0 +1,127 @@
+#include "test-file.h"
+#include "test-file-access_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_access_at__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_status_set_error(F_access_denied),
+      F_status_set_error(F_directory_descriptor),
+      F_status_set_error(F_buffer),
+      F_status_set_error(F_parameter),
+      F_status_set_error(F_loop),
+      F_status_set_error(F_name),
+      F_false,
+      F_status_set_error(F_memory_not),
+      F_status_set_error(F_directory_not),
+      F_status_set_error(F_number_overflow),
+      F_status_set_error(F_failure),
+    };
+
+    for (int i = 0; i < 11; ++i) {
+
+      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);
+
+      assert_int_equal(status, statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_false,
+      F_status_set_error(F_directory_descriptor),
+      F_status_set_error(F_buffer),
+      F_status_set_error(F_parameter),
+      F_status_set_error(F_loop),
+      F_status_set_error(F_name),
+      F_status_set_error(F_file_not),
+      F_status_set_error(F_memory_not),
+      F_status_set_error(F_directory_not),
+      F_status_set_error(F_number_overflow),
+      F_status_set_error(F_failure),
+    };
+
+    int modes[] = {
+      F_file_access_mode_read_d,
+      F_file_access_mode_write_d,
+      F_file_access_mode_execute_d,
+    };
+
+    for (int j = 0; j < 3; ++j){
+
+      for (int i = 0; i < 11; ++i) {
+
+        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);
+
+        assert_int_equal(status, statuss[i]);
+      } // for
+    } // for
+  }
+}
+
+void test__f_file_access_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_access_at(0, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_access_at__works(void **state) {
+
+  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);
+
+    assert_int_equal(status, F_true);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-access_at.h b/level_0/f_file/tests/unit/c/test-file-access_at.h
new file mode 100644 (file)
index 0000000..ae7c6bb
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_access_at_h
+#define _TEST__F_file_access_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_access_at()
+ */
+extern void test__f_file_access_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_access_at()
+ */
+extern void test__f_file_access_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_access_at()
+ */
+extern void test__f_file_access_at__works(void **state);
+
+#endif // _TEST__F_file_access_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-clone.c b/level_0/f_file/tests/unit/c/test-file-clone.c
new file mode 100644 (file)
index 0000000..b02b90f
--- /dev/null
@@ -0,0 +1,1237 @@
+#include "test-file.h"
+#include "test-file-clone.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_clone__fails_during_read_write(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_read, false);
+    will_return(__wrap_read, (void *) buffer);
+    will_return(__wrap_read, 1);
+
+    will_return(__wrap_write, false);
+    will_return(__wrap_write, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 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_clone(path, path, F_false, 0, F_false);
+
+    assert_int_equal(F_status_set_fine(status), F_file_write);
+  }
+}
+
+void test__f_file_clone__fails_for_link(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFBIG,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINTR,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_interrupt,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 18; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_symlink, true);
+      will_return(__wrap_symlink, errnos[i]);
+
+      if (statuss[i] == F_file_found) {
+        will_return(__wrap_chmod, false);
+        will_return(__wrap_chmod, 0);
+      }
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_symlink, false);
+      will_return(__wrap_symlink, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_owner,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+    statistics.st_uid = 1;
+    statistics.st_gid = 1;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_symlink, false);
+      will_return(__wrap_symlink, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_lchown, true);
+      will_return(__wrap_lchown, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_true, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_group,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+    statistics.st_uid = 1;
+    statistics.st_gid = 1;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_symlink, false);
+      will_return(__wrap_symlink, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_lchown, false);
+      will_return(__wrap_lchown, 0);
+
+      will_return(__wrap_lchown, true);
+      will_return(__wrap_lchown, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_true, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+}
+
+void test__f_file_clone__fails_for_other(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int types[] = {
+      F_file_type_block_d,
+      F_file_type_character_d,
+      F_file_type_directory_d,
+      F_file_type_fifo_d,
+      F_file_type_mask_d,
+      F_file_type_socket_d,
+    };
+
+    f_status_t statuss[] = {
+      F_supported_not,
+      F_supported_not,
+      F_supported_not,
+      F_supported_not,
+      F_supported_not,
+      F_supported_not,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 6; ++i) {
+
+      statistics.st_mode = 1 | types[i];
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_true);
+
+      assert_int_equal(F_status_set_fine(status), F_supported_not);
+    } // for
+  }
+}
+
+void test__f_file_clone__fails_for_regular(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_number_overflow,
+      F_file_stat,
+    };
+
+    for (int i = 0; i < 9; ++i) {
+
+      will_return(__wrap_lstat, true);
+      will_return(__wrap_lstat, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EDQUOT,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 21; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, true);
+      will_return(__wrap_open, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EBADF,
+      EDQUOT,
+      EIO,
+      ENOSPC,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 6; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, true);
+      will_return(__wrap_fsync, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EBADF,
+      EDQUOT,
+      EINTR,
+      EIO,
+      ENOSPC,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_descriptor,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_input_output,
+      F_space_not,
+      F_file_close,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 6; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 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_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_owner,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_lchown, true);
+      will_return(__wrap_lchown, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_true, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_group,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_lchown, false);
+      will_return(__wrap_lchown, 0);
+
+      will_return(__wrap_lchown, true);
+      will_return(__wrap_lchown, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_true, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EDQUOT,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, true);
+      will_return(__wrap_open, errnos[i]);
+
+      const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EDQUOT,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_open, true);
+      will_return(__wrap_open, errnos[i]);
+
+      // The file gets closed on failure, and any error result is ignored.
+      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_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EAGAIN,
+      EBADF,
+      EFAULT,
+      EINTR,
+      EINVAL,
+      EIO,
+      EISDIR,
+      EWOULDBLOCK,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 9; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_read, true);
+      will_return(__wrap_read, errnos[i]);
+
+      // The file gets closed on failure, and any error result is ignored (for both source and destination files).
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 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_clone(path, path, F_false, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EAGAIN,
+      EBADF,
+      EDESTADDRREQ,
+      EDQUOT,
+      EFAULT,
+      EFBIG,
+      EINTR,
+      EINVAL,
+      EIO,
+      ENOSPC,
+      EPERM,
+      EPIPE,
+      EWOULDBLOCK,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 14; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_read, false);
+      will_return(__wrap_read, (void *) buffer);
+      will_return(__wrap_read, 1);
+
+      will_return(__wrap_write, true);
+      will_return(__wrap_write, errnos[i]);
+
+      // The file gets closed on failure, and any error result is ignored (for both source and destination files).
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 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_clone(path, path, F_false, 0, F_true);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+}
+
+void test__f_file_clone__returns_data_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    const f_status_t status = f_file_clone(f_string_empty_s, f_string_empty_s, F_false, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_clone(path, f_string_empty_s, F_false, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_clone(f_string_empty_s, path, F_false, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_clone__works_for_link(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_symlink, false);
+    will_return(__wrap_symlink, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    const f_status_t status = f_file_clone(path, path, F_false, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+void test__f_file_clone__works_for_regular(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_read, false);
+    will_return(__wrap_read, (void *) buffer);
+    will_return(__wrap_read, 1);
+
+    will_return(__wrap_write, false);
+    will_return(__wrap_write, 1);
+
+    will_return(__wrap_read, false);
+    will_return(__wrap_read, (void *) buffer);
+    will_return(__wrap_read, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 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_clone(path, path, F_false, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-clone.h b/level_0/f_file/tests/unit/c/test-file-clone.h
new file mode 100644 (file)
index 0000000..9113282
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_clone_h
+#define _TEST__F_file_clone_h
+
+/**
+ * Test that function fails when performing read and write.
+ *
+ * @see f_file_clone()
+ */
+extern void test__f_file_clone__fails_during_read_write(void **state);
+
+/**
+ * Test that function fails for files of type link.
+ *
+ * @see f_file_clone()
+ */
+extern void test__f_file_clone__fails_for_link(void **state);
+
+/**
+ * Test that function fails for non-regular and non-link file of types.
+ *
+ * @see f_file_clone()
+ */
+extern void test__f_file_clone__fails_for_other(void **state);
+
+/**
+ * Test that function fails for files of type regular.
+ *
+ * @see f_file_clone()
+ */
+extern void test__f_file_clone__fails_for_regular(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_clone()
+ */
+extern void test__f_file_clone__returns_data_not(void **state);
+
+/**
+ * Test that function works for files of type link.
+ *
+ * @see f_file_clone()
+ */
+extern void test__f_file_clone__works_for_link(void **state);
+
+/**
+ * Test that function works for files of type regular.
+ *
+ * @see f_file_clone()
+ */
+extern void test__f_file_clone__works_for_regular(void **state);
+
+#endif // _TEST__F_file_clone_h
diff --git a/level_0/f_file/tests/unit/c/test-file-close.c b/level_0/f_file/tests/unit/c/test-file-close.c
new file mode 100644 (file)
index 0000000..61c6da8
--- /dev/null
@@ -0,0 +1,90 @@
+#include "test-file.h"
+#include "test-file-close.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_close__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_close, true);
+      will_return(__wrap_close, errnos[i]);
+
+      const f_status_t status = f_file_close(&id);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+
+      if (errnos[i] == EBADF || errnos[i] == EINTR) {
+        assert_int_equal(id, 0);
+      }
+      else {
+        assert_int_equal(id, -1);
+      }
+    } // for
+  }
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_close__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_close(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_close__works(void **state) {
+
+  {
+    int id = 0;
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 0);
+
+    const f_status_t status = f_file_close(&id);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(id, -1);
+  }
+}
+
+void test__f_file_close__works_already_closed(void **state) {
+
+  {
+    int id = -1;
+
+    const f_status_t status = f_file_close(&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.h b/level_0/f_file/tests/unit/c/test-file-close.h
new file mode 100644 (file)
index 0000000..95d7740
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_close_h
+#define _TEST__F_file_close_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_close()
+ */
+extern void test__f_file_close__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_close()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_close__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_close()
+ */
+extern void test__f_file_close__works(void **state);
+
+/**
+ * Test that function works when already closed.
+ *
+ * @see f_file_close()
+ */
+extern void test__f_file_close__works_already_closed(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
new file mode 100644 (file)
index 0000000..f3a0496
--- /dev/null
@@ -0,0 +1,96 @@
+#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(F_status_set_fine(status), statuss[i]);
+
+      if (errnos[i] == EBADF || errnos[i] == EINTR) {
+        assert_int_equal(id, 0);
+      }
+      else {
+        assert_int_equal(id, -1);
+      }
+    } // for
+  }
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_close_flush__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_close_flush(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+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
new file mode 100644 (file)
index 0000000..cdcbad4
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * 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()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_close_flush__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * 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
diff --git a/level_0/f_file/tests/unit/c/test-file-copy.c b/level_0/f_file/tests/unit/c/test-file-copy.c
new file mode 100644 (file)
index 0000000..908012d
--- /dev/null
@@ -0,0 +1,1749 @@
+#include "test-file.h"
+#include "test-file-copy.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_copy__fails_during_read_write(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_read, false);
+    will_return(__wrap_read, (void *) buffer);
+    will_return(__wrap_read, 1);
+
+    will_return(__wrap_write, false);
+    will_return(__wrap_write, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 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_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(F_status_set_fine(status), F_file_write);
+  }
+}
+
+void test__f_file_copy__fails_for_block(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_block_d;
+
+    for (int i = 0; i < 15; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mknod, true);
+      will_return(__wrap_mknod, errnos[i]);
+
+      if (statuss[i] == F_file_found) {
+        will_return(__wrap_chmod, false);
+        will_return(__wrap_chmod, 0);
+      }
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_block_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mknod, false);
+      will_return(__wrap_mknod, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+}
+
+void test__f_file_copy__fails_for_character(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_character_d;
+
+    for (int i = 0; i < 15; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mknod, true);
+      will_return(__wrap_mknod, errnos[i]);
+
+      if (statuss[i] == F_file_found) {
+        will_return(__wrap_chmod, false);
+        will_return(__wrap_chmod, 0);
+      }
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_character_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mknod, false);
+      will_return(__wrap_mknod, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+}
+
+void test__f_file_copy__fails_for_directory(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      EMLINK,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_directory_link_max,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_directory_d;
+
+    for (int i = 0; i < 15; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mkdir, true);
+      will_return(__wrap_mkdir, errnos[i]);
+
+      if (statuss[i] == F_file_found) {
+        will_return(__wrap_chmod, false);
+        will_return(__wrap_chmod, 0);
+      }
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_directory_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mkdir, false);
+      will_return(__wrap_mkdir, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+}
+
+void test__f_file_copy__fails_for_fifo(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_name,
+      F_file_found_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_fifo_d;
+
+    for (int i = 0; i < 10; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mkfifo, true);
+      will_return(__wrap_mkfifo, errnos[i]);
+
+      if (statuss[i] == F_file_found) {
+        will_return(__wrap_chmod, false);
+        will_return(__wrap_chmod, 0);
+      }
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_fifo_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mkfifo, false);
+      will_return(__wrap_mkfifo, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+}
+
+void test__f_file_copy__fails_for_link(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EINVAL,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_parameter,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+
+    for (int i = 0; i < 10; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_readlink, true);
+      will_return(__wrap_readlink, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFBIG,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINTR,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_interrupt,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 18; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_readlink, false);
+      will_return(__wrap_readlink, (void *) buffer);
+      will_return(__wrap_readlink, 0);
+
+      will_return(__wrap_symlink, true);
+      will_return(__wrap_symlink, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+}
+
+void test__f_file_copy__fails_for_regular(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_number_overflow,
+      F_file_stat,
+    };
+
+    for (int i = 0; i < 9; ++i) {
+
+      will_return(__wrap_lstat, true);
+      will_return(__wrap_lstat, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EDQUOT,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 21; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, true);
+      will_return(__wrap_open, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EBADF,
+      EDQUOT,
+      EIO,
+      ENOSPC,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 6; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, true);
+      will_return(__wrap_fsync, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    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,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 6; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 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_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EDQUOT,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, true);
+      will_return(__wrap_open, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EDQUOT,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_open, true);
+      will_return(__wrap_open, errnos[i]);
+
+      // The file gets closed on failure, and any error result is ignored.
+      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_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EAGAIN,
+      EBADF,
+      EFAULT,
+      EINTR,
+      EINVAL,
+      EIO,
+      EISDIR,
+      EWOULDBLOCK,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+      F_file_read,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 9; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_read, true);
+      will_return(__wrap_read, errnos[i]);
+
+      // The file gets closed on failure, and any error result is ignored (for both source and destination files).
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 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_copy(path, path, mode, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EAGAIN,
+      EBADF,
+      EDESTADDRREQ,
+      EDQUOT,
+      EFAULT,
+      EFBIG,
+      EINTR,
+      EINVAL,
+      EIO,
+      ENOSPC,
+      EPERM,
+      EPIPE,
+      EWOULDBLOCK,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+      F_file_write,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 14; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 0);
+
+      will_return(__wrap_chmod, false);
+      will_return(__wrap_chmod, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_read, false);
+      will_return(__wrap_read, (void *) buffer);
+      will_return(__wrap_read, 1);
+
+      will_return(__wrap_write, true);
+      will_return(__wrap_write, errnos[i]);
+
+      // The file gets closed on failure, and any error result is ignored (for both source and destination files).
+      will_return(__wrap_fsync, false);
+      will_return(__wrap_fsync, 0);
+
+      will_return(__wrap_close, false);
+      will_return(__wrap_close, 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_copy(path, path, mode, 0, F_true);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+}
+
+void test__f_file_copy__fails_for_socket(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_socket_d;
+
+    for (int i = 0; i < 15; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mknod, true);
+      will_return(__wrap_mknod, errnos[i]);
+
+      if (statuss[i] == F_file_found) {
+        will_return(__wrap_chmod, false);
+        will_return(__wrap_chmod, 0);
+      }
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      EIO,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_input_output,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_directory_not,
+      F_access_mode,
+      F_read_only,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_socket_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_lstat, false);
+      will_return(__wrap_lstat, &statistics);
+      will_return(__wrap_lstat, 0);
+
+      will_return(__wrap_mknod, false);
+      will_return(__wrap_mknod, 0);
+
+      will_return(__wrap_chmod, true);
+      will_return(__wrap_chmod, errnos[i]);
+
+      const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+      if (statuss[i] == F_file_found) {
+        assert_int_equal(status, F_none);
+      }
+      else {
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      }
+    } // for
+  }
+}
+
+void test__f_file_copy__returns_data_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    const f_status_t status = f_file_copy(f_string_empty_s, f_string_empty_s, mode, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_copy(path, f_string_empty_s, mode, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_copy(f_string_empty_s, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_copy__works_for_block(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_block_d;
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_mknod, false);
+    will_return(__wrap_mknod, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+void test__f_file_copy__works_for_character(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_character_d;
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_mknod, false);
+    will_return(__wrap_mknod, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+void test__f_file_copy__works_for_directory(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_directory_d;
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_mkdir, false);
+    will_return(__wrap_mkdir, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+void test__f_file_copy__works_for_fifo(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_fifo_d;
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_mkfifo, false);
+    will_return(__wrap_mkfifo, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+void test__f_file_copy__works_for_link(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_link_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_readlink, false);
+    will_return(__wrap_readlink, (void *) buffer);
+    will_return(__wrap_readlink, 0);
+
+    will_return(__wrap_symlink, false);
+    will_return(__wrap_symlink, 0);
+
+    const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+void test__f_file_copy__works_for_regular(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_regular_d;
+
+    f_char_t buffer[1];
+
+    memset(buffer, 0, sizeof(f_char_t));
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 0);
+
+    will_return(__wrap_read, false);
+    will_return(__wrap_read, (void *) buffer);
+    will_return(__wrap_read, 1);
+
+    will_return(__wrap_write, false);
+    will_return(__wrap_write, 1);
+
+    will_return(__wrap_read, false);
+    will_return(__wrap_read, (void *) buffer);
+    will_return(__wrap_read, 0);
+
+    will_return(__wrap_fsync, false);
+    will_return(__wrap_fsync, 0);
+
+    will_return(__wrap_close, false);
+    will_return(__wrap_close, 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_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+void test__f_file_copy__works_for_socket(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+  const f_mode_t mode = f_mode_t_initialize;
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_socket_d;
+
+    will_return(__wrap_lstat, false);
+    will_return(__wrap_lstat, &statistics);
+    will_return(__wrap_lstat, 0);
+
+    will_return(__wrap_mknod, false);
+    will_return(__wrap_mknod, 0);
+
+    will_return(__wrap_chmod, false);
+    will_return(__wrap_chmod, 0);
+
+    const f_status_t status = f_file_copy(path, path, mode, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-copy.h b/level_0/f_file/tests/unit/c/test-file-copy.h
new file mode 100644 (file)
index 0000000..a6586c4
--- /dev/null
@@ -0,0 +1,125 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_copy_h
+#define _TEST__F_file_copy_h
+
+/**
+ * Test that function fails when performing read and write.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_during_read_write(void **state);
+
+/**
+ * Test that function fails for files of type block.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_for_block(void **state);
+
+/**
+ * Test that function fails for files of type character.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_for_character(void **state);
+
+/**
+ * Test that function fails for files of type directory.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_for_directory(void **state);
+
+/**
+ * Test that function fails for files of type file-in/file-out.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_for_fifo(void **state);
+
+/**
+ * Test that function fails for files of type link.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_for_link(void **state);
+
+/**
+ * Test that function fails for files of type regular.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_for_regular(void **state);
+
+/**
+ * Test that function fails for files of type socket.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__fails_for_socket(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__returns_data_not(void **state);
+
+/**
+ * Test that function works for files of type block.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__works_for_block(void **state);
+
+/**
+ * Test that function works for files of type character.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__works_for_character(void **state);
+
+/**
+ * Test that function works for files of type directory.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__works_for_directory(void **state);
+
+/**
+ * Test that function works for files of type file-in/file-out.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__works_for_fifo(void **state);
+
+/**
+ * Test that function works for files of type link.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__works_for_link(void **state);
+
+/**
+ * Test that function works for files of type regular.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__works_for_regular(void **state);
+
+/**
+ * Test that function works for files of type socket.
+ *
+ * @see f_file_copy()
+ */
+extern void test__f_file_copy__works_for_socket(void **state);
+
+#endif // _TEST__F_file_copy_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create.c b/level_0/f_file/tests/unit/c/test-file-create.c
new file mode 100644 (file)
index 0000000..e11fc49
--- /dev/null
@@ -0,0 +1,173 @@
+#include "test-file.h"
+#include "test-file-create.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    for (int i = 0; i < 21; ++i) {
+
+      will_return(__wrap_open, true);
+      will_return(__wrap_open, errnos[i]);
+
+      const f_status_t status = f_file_create(path, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EBADF,
+      EDQUOT,
+      EIO,
+      ENOSPC,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+    };
+
+    for (int i = 0; i < 6; ++i) {
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 0);
+
+      will_return(__wrap_fsync, true);
+      will_return(__wrap_fsync, errnos[i]);
+
+      const f_status_t status = f_file_create(path, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EBADF,
+      EDQUOT,
+      EINTR,
+      EIO,
+      ENOSPC,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_descriptor,
+      F_filesystem_quota_block,
+      F_interrupt,
+      F_input_output,
+      F_space_not,
+      F_file_close,
+    };
+
+    for (int i = 0; i < 6; ++i) {
+
+      will_return(__wrap_open, false);
+      will_return(__wrap_open, 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_create(path, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+}
+
+void test__f_file_create__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create(f_string_empty_s, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 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_create(path, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create.h b/level_0/f_file/tests/unit/c/test-file-create.h
new file mode 100644 (file)
index 0000000..1818083
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_h
+#define _TEST__F_file_create_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create()
+ */
+extern void test__f_file_create__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create()
+ */
+extern void test__f_file_create__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create()
+ */
+extern void test__f_file_create__works(void **state);
+
+#endif // _TEST__F_file_create_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create_at.c b/level_0/f_file/tests/unit/c/test-file-create_at.c
new file mode 100644 (file)
index 0000000..d398f18
--- /dev/null
@@ -0,0 +1,175 @@
+#include "test-file.h"
+#include "test-file-create_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create_at__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EFBIG,
+      EINTR,
+      EINVAL,
+      EISDIR,
+      ELOOP,
+      ENAMETOOLONG,
+      ENFILE,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EOPNOTSUPP,
+      EOVERFLOW,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_directory_descriptor,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_number_overflow,
+      F_interrupt,
+      F_parameter,
+      F_directory,
+      F_loop,
+      F_name,
+      F_file_open_max,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_type_not_directory,
+      F_supported_not,
+      F_number_overflow,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    for (int i = 0; i < 22; ++i) {
+
+      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);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EBADF,
+      EDQUOT,
+      EIO,
+      ENOSPC,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+      F_file_synchronize,
+    };
+
+    for (int i = 0; i < 6; ++i) {
+
+      will_return(__wrap_openat, false);
+      will_return(__wrap_openat, 0);
+
+      will_return(__wrap_fsync, true);
+      will_return(__wrap_fsync, errnos[i]);
+
+      const f_status_t status = f_file_create_at(0, path, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    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) {
+
+      will_return(__wrap_openat, false);
+      will_return(__wrap_openat, 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_create_at(0, path, 0, F_false);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+}
+
+void test__f_file_create_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create_at(0, f_string_empty_s, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create_at__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    will_return(__wrap_openat, false);
+    will_return(__wrap_openat, 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_create_at(0, path, 0, F_false);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create_at.h b/level_0/f_file/tests/unit/c/test-file-create_at.h
new file mode 100644 (file)
index 0000000..d9ab464
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_at_h
+#define _TEST__F_file_create_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create_at()
+ */
+extern void test__f_file_create_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create_at()
+ */
+extern void test__f_file_create_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create_at()
+ */
+extern void test__f_file_create_at__works(void **state);
+
+#endif // _TEST__F_file_create_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create_device.c b/level_0/f_file/tests/unit/c/test-file-create_device.c
new file mode 100644 (file)
index 0000000..9ba1c24
--- /dev/null
@@ -0,0 +1,126 @@
+#include "test-file.h"
+#include "test-file-create_device.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create_device__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    const int modes[] = {
+      F_file_type_block_d,
+      F_file_type_character_d,
+      F_file_type_fifo_d,
+    };
+
+    for (uint8_t j = 0; j < 3; ++j) {
+
+      for (int i = 0; i < 15; ++i) {
+
+        will_return(__wrap_mknod, true);
+        will_return(__wrap_mknod, errnos[i]);
+
+        const f_status_t status = f_file_create_device(path, modes[j], 1, 1);
+
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      } // for
+    } // for
+  }
+}
+
+void test__f_file_create_device__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create_device(f_string_empty_s, 0, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create_device__returns_supported_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_directory_d,
+    F_file_type_link_d,
+    F_file_type_mask_d,
+    F_file_type_regular_d,
+    F_file_type_socket_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 5; ++i) {
+
+      const f_status_t status = f_file_create_device(path, modes[i], 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_supported_not);
+    } // for
+  }
+}
+
+void test__f_file_create_device__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_block_d,
+    F_file_type_character_d,
+    F_file_type_fifo_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 3; ++i) {
+
+      will_return(__wrap_mknod, false);
+      will_return(__wrap_mknod, 0);
+
+      const f_status_t status = f_file_create_device(path, modes[i], 1, 1);
+
+      assert_int_equal(status, F_none);
+    } // for
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create_device.h b/level_0/f_file/tests/unit/c/test-file-create_device.h
new file mode 100644 (file)
index 0000000..ee43e45
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_device_h
+#define _TEST__F_file_create_device_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create_device()
+ */
+extern void test__f_file_create_device__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create_device()
+ */
+extern void test__f_file_create_device__returns_data_not(void **state);
+
+/**
+ * Test that function works but the file type is not supported (specified via mode).
+ *
+ * @see f_file_create_device()
+ */
+extern void test__f_file_create_device__returns_supported_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create_device()
+ */
+extern void test__f_file_create_device__works(void **state);
+
+#endif // _TEST__F_file_create_device_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create_device_at.c b/level_0/f_file/tests/unit/c/test-file-create_device_at.c
new file mode 100644 (file)
index 0000000..60bd48e
--- /dev/null
@@ -0,0 +1,128 @@
+#include "test-file.h"
+#include "test-file-create_device_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create_device_at__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_directory_descriptor,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    const int modes[] = {
+      F_file_type_block_d,
+      F_file_type_character_d,
+      F_file_type_fifo_d,
+    };
+
+    for (uint8_t j = 0; j < 3; ++j) {
+
+      for (int i = 0; i < 16; ++i) {
+
+        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);
+
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      } // for
+    } // for
+  }
+}
+
+void test__f_file_create_device_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create_device_at(0, f_string_empty_s, 0, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create_device_at__returns_supported_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_directory_d,
+    F_file_type_link_d,
+    F_file_type_mask_d,
+    F_file_type_regular_d,
+    F_file_type_socket_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 5; ++i) {
+
+      const f_status_t status = f_file_create_device_at(0, path, modes[i], 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_supported_not);
+    } // for
+  }
+}
+
+void test__f_file_create_device_at__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_block_d,
+    F_file_type_character_d,
+    F_file_type_fifo_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 3; ++i) {
+
+      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);
+
+      assert_int_equal(status, F_none);
+    } // for
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create_device_at.h b/level_0/f_file/tests/unit/c/test-file-create_device_at.h
new file mode 100644 (file)
index 0000000..73b15d1
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_device_at_h
+#define _TEST__F_file_create_device_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create_device_at()
+ */
+extern void test__f_file_create_device_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create_device_at()
+ */
+extern void test__f_file_create_device_at__returns_data_not(void **state);
+
+/**
+ * Test that function works but the file type is not supported (specified via mode).
+ *
+ * @see f_file_create_device_at()
+ */
+extern void test__f_file_create_device_at__returns_supported_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create_device_at()
+ */
+extern void test__f_file_create_device_at__works(void **state);
+
+#endif // _TEST__F_file_create_device_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create_fifo.c b/level_0/f_file/tests/unit/c/test-file-create_fifo.c
new file mode 100644 (file)
index 0000000..d4d50b8
--- /dev/null
@@ -0,0 +1,77 @@
+#include "test-file.h"
+#include "test-file-create_fifo.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create_fifo__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_name,
+      F_file_found_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_failure,
+    };
+
+    for (int i = 0; i < 10; ++i) {
+
+      will_return(__wrap_mkfifo, true);
+      will_return(__wrap_mkfifo, errnos[i]);
+
+      const f_status_t status = f_file_create_fifo(path, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+}
+
+void test__f_file_create_fifo__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create_fifo(f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create_fifo__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  for (uint8_t i = 0; i < 3; ++i) {
+
+    will_return(__wrap_mkfifo, false);
+    will_return(__wrap_mkfifo, 0);
+
+    const f_status_t status = f_file_create_fifo(path, 0);
+
+    assert_int_equal(status, F_none);
+  } // for
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create_fifo.h b/level_0/f_file/tests/unit/c/test-file-create_fifo.h
new file mode 100644 (file)
index 0000000..b04f433
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_fifo_h
+#define _TEST__F_file_create_fifo_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create_fifo()
+ */
+extern void test__f_file_create_fifo__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create_fifo()
+ */
+extern void test__f_file_create_fifo__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create_fifo()
+ */
+extern void test__f_file_create_fifo__works(void **state);
+
+#endif // _TEST__F_file_create_fifo_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create_fifo_at.c b/level_0/f_file/tests/unit/c/test-file-create_fifo_at.c
new file mode 100644 (file)
index 0000000..d15fb66
--- /dev/null
@@ -0,0 +1,79 @@
+#include "test-file.h"
+#include "test-file-create_fifo_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create_fifo_at__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EDQUOT,
+      EEXIST,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_directory_descriptor,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_name,
+      F_file_found_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_failure,
+    };
+
+    for (int i = 0; i < 11; ++i) {
+
+      will_return(__wrap_mkfifoat, true);
+      will_return(__wrap_mkfifoat, errnos[i]);
+
+      const f_status_t status = f_file_create_fifo_at(0, path, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+}
+
+void test__f_file_create_fifo_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create_fifo_at(0, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create_fifo_at__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  for (uint8_t i = 0; i < 3; ++i) {
+
+    will_return(__wrap_mkfifoat, false);
+    will_return(__wrap_mkfifoat, 0);
+
+    const f_status_t status = f_file_create_fifo_at(0, path, 0);
+
+    assert_int_equal(status, F_none);
+  } // for
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create_fifo_at.h b/level_0/f_file/tests/unit/c/test-file-create_fifo_at.h
new file mode 100644 (file)
index 0000000..1320011
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_fifo_at_h
+#define _TEST__F_file_create_fifo_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create_fifo_at()
+ */
+extern void test__f_file_create_fifo_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create_fifo_at()
+ */
+extern void test__f_file_create_fifo_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create_fifo_at()
+ */
+extern void test__f_file_create_fifo_at__works(void **state);
+
+#endif // _TEST__F_file_create_fifo_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create_node.c b/level_0/f_file/tests/unit/c/test-file-create_node.c
new file mode 100644 (file)
index 0000000..b10821f
--- /dev/null
@@ -0,0 +1,126 @@
+#include "test-file.h"
+#include "test-file-create_node.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create_node__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    const int modes[] = {
+      F_file_type_block_d,
+      F_file_type_character_d,
+      F_file_type_fifo_d,
+    };
+
+    for (uint8_t j = 0; j < 3; ++j) {
+
+      for (int i = 0; i < 15; ++i) {
+
+        will_return(__wrap_mknod, true);
+        will_return(__wrap_mknod, errnos[i]);
+
+        const f_status_t status = f_file_create_node(path, modes[j], 1);
+
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      } // for
+    } // for
+  }
+}
+
+void test__f_file_create_node__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create_node(f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create_node__returns_supported_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_directory_d,
+    F_file_type_link_d,
+    F_file_type_mask_d,
+    F_file_type_regular_d,
+    F_file_type_socket_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 5; ++i) {
+
+      const f_status_t status = f_file_create_node(path, modes[i], 0);
+
+      assert_int_equal(F_status_set_fine(status), F_supported_not);
+    } // for
+  }
+}
+
+void test__f_file_create_node__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_block_d,
+    F_file_type_character_d,
+    F_file_type_fifo_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 3; ++i) {
+
+      will_return(__wrap_mknod, false);
+      will_return(__wrap_mknod, 0);
+
+      const f_status_t status = f_file_create_node(path, modes[i], 1);
+
+      assert_int_equal(status, F_none);
+    } // for
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create_node.h b/level_0/f_file/tests/unit/c/test-file-create_node.h
new file mode 100644 (file)
index 0000000..1f35641
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_node_h
+#define _TEST__F_file_create_node_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create_node()
+ */
+extern void test__f_file_create_node__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create_node()
+ */
+extern void test__f_file_create_node__returns_data_not(void **state);
+
+/**
+ * Test that function works but the file type is not supported (specified via mode).
+ *
+ * @see f_file_create_node()
+ */
+extern void test__f_file_create_node__returns_supported_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create_node()
+ */
+extern void test__f_file_create_node__works(void **state);
+
+#endif // _TEST__F_file_create_node_h
diff --git a/level_0/f_file/tests/unit/c/test-file-create_node_at.c b/level_0/f_file/tests/unit/c/test-file-create_node_at.c
new file mode 100644 (file)
index 0000000..cb5ba74
--- /dev/null
@@ -0,0 +1,128 @@
+#include "test-file.h"
+#include "test-file-create_node_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_create_node_at__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ETXTBSY,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_directory_descriptor,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_directory_not,
+      F_prohibited,
+      F_read_only,
+      F_busy,
+      F_failure,
+    };
+
+    const int modes[] = {
+      F_file_type_block_d,
+      F_file_type_character_d,
+      F_file_type_fifo_d,
+    };
+
+    for (uint8_t j = 0; j < 3; ++j) {
+
+      for (int i = 0; i < 16; ++i) {
+
+        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);
+
+        assert_int_equal(F_status_set_fine(status), statuss[i]);
+      } // for
+    } // for
+  }
+}
+
+void test__f_file_create_node_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_create_node_at(0, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_create_node_at__returns_supported_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_directory_d,
+    F_file_type_link_d,
+    F_file_type_mask_d,
+    F_file_type_regular_d,
+    F_file_type_socket_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 5; ++i) {
+
+      const f_status_t status = f_file_create_node_at(0, path, modes[i], 0);
+
+      assert_int_equal(F_status_set_fine(status), F_supported_not);
+    } // for
+  }
+}
+
+void test__f_file_create_node_at__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  const int modes[] = {
+    F_file_type_block_d,
+    F_file_type_character_d,
+    F_file_type_fifo_d,
+  };
+
+  {
+    for (uint8_t i = 0; i < 3; ++i) {
+
+      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);
+
+      assert_int_equal(status, F_none);
+    } // for
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-create_node_at.h b/level_0/f_file/tests/unit/c/test-file-create_node_at.h
new file mode 100644 (file)
index 0000000..9cefb99
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_create_node_at_h
+#define _TEST__F_file_create_node_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_create_node_at()
+ */
+extern void test__f_file_create_node_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_create_node_at()
+ */
+extern void test__f_file_create_node_at__returns_data_not(void **state);
+
+/**
+ * Test that function works but the file type is not supported (specified via mode).
+ *
+ * @see f_file_create_node_at()
+ */
+extern void test__f_file_create_node_at__returns_supported_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_create_node_at()
+ */
+extern void test__f_file_create_node_at__works(void **state);
+
+#endif // _TEST__F_file_create_node_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-descriptor.c b/level_0/f_file/tests/unit/c/test-file-descriptor.c
new file mode 100644 (file)
index 0000000..fa9a021
--- /dev/null
@@ -0,0 +1,64 @@
+#include "test-file.h"
+#include "test-file-descriptor.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_descriptor__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_descriptor(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_descriptor__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_descriptor(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_descriptor__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_descriptor(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_descriptor__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_descriptor();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-descriptor.h b/level_0/f_file/tests/unit/c/test-file-descriptor.h
new file mode 100644 (file)
index 0000000..c233ffe
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_descriptor_h
+#define _TEST__F_file_descriptor_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_descriptor()
+ */
+extern void test__f_file_descriptor__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_descriptor()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_descriptor__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_descriptor()
+ */
+extern void test__f_file_descriptor__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_descriptor()
+ */
+extern void test__f_file_descriptor__works(void **state);
+
+#endif // _TEST__F_file_descriptor_h
diff --git a/level_0/f_file/tests/unit/c/test-file-exists.c b/level_0/f_file/tests/unit/c/test-file-exists.c
new file mode 100644 (file)
index 0000000..83b58de
--- /dev/null
@@ -0,0 +1,98 @@
+#include "test-file.h"
+#include "test-file-exists.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_exists__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    EACCES,
+    EFAULT,
+    ELOOP,
+    ENAMETOOLONG,
+    ENOENT,
+    ENOMEM,
+    ENOTDIR,
+    EOVERFLOW,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_access_denied,
+    F_buffer,
+    F_loop,
+    F_name,
+    F_file_found_not,
+    F_memory_not,
+    F_false,
+    F_number_overflow,
+    F_file_stat,
+  };
+
+  for (int i = 0; i < 9; ++i) {
+
+    will_return(__wrap_stat, true);
+    will_return(__wrap_stat, errnos[i]);
+
+    const f_status_t status = f_file_exists(path);
+
+    assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_exists__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_exists(f_string_empty_s);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_exists__returns_false(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  {
+    will_return(__wrap_stat, false);
+    will_return(__wrap_stat, &statistics);
+    will_return(__wrap_stat, 0);
+
+    const f_status_t status = f_file_exists(path);
+
+    assert_int_equal(status, F_false);
+  }
+}
+
+void test__f_file_exists__returns_true(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  statistics.st_mode = 1 | F_file_type_directory_d;
+
+  {
+    will_return(__wrap_stat, false);
+    will_return(__wrap_stat, &statistics);
+    will_return(__wrap_stat, 0);
+
+    const f_status_t status = f_file_exists(path);
+
+    assert_int_equal(status, F_true);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-exists.h b/level_0/f_file/tests/unit/c/test-file-exists.h
new file mode 100644 (file)
index 0000000..fdf6ffe
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_exists_h
+#define _TEST__F_file_exists_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_exists()
+ */
+extern void test__f_file_exists__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_exists()
+ */
+extern void test__f_file_exists__returns_data_not(void **state);
+
+/**
+ * Test that function works and returns F_false.
+ *
+ * @see f_file_exists()
+ */
+extern void test__f_file_exists__returns_false(void **state);
+
+/**
+ * Test that function works and returns F_true.
+ *
+ * @see f_file_exists()
+ */
+extern void test__f_file_exists__returns_true(void **state);
+
+#endif // _TEST__F_file_exists_h
diff --git a/level_0/f_file/tests/unit/c/test-file-exists_at.c b/level_0/f_file/tests/unit/c/test-file-exists_at.c
new file mode 100644 (file)
index 0000000..e37a868
--- /dev/null
@@ -0,0 +1,100 @@
+#include "test-file.h"
+#include "test-file-exists_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_exists_at__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    EACCES,
+    EBADF,
+    EFAULT,
+    ELOOP,
+    ENAMETOOLONG,
+    ENOENT,
+    ENOMEM,
+    ENOTDIR,
+    EOVERFLOW,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_access_denied,
+    F_file_descriptor,
+    F_buffer,
+    F_loop,
+    F_name,
+    F_file_found_not,
+    F_memory_not,
+    F_false,
+    F_number_overflow,
+    F_file_stat,
+  };
+
+  for (int i = 0; i < 10; ++i) {
+
+    will_return(__wrap_fstatat, true);
+    will_return(__wrap_fstatat, errnos[i]);
+
+    const f_status_t status = f_file_exists_at(0, path, 0);
+
+    assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_exists_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_exists_at(0, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_exists_at__returns_false(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  {
+    will_return(__wrap_fstatat, false);
+    will_return(__wrap_fstatat, &statistics);
+    will_return(__wrap_fstatat, 0);
+
+    const f_status_t status = f_file_exists_at(0, path, 0);
+
+    assert_int_equal(status, F_false);
+  }
+}
+
+void test__f_file_exists_at__returns_true(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  statistics.st_mode = 1 | F_file_type_directory_d;
+
+  {
+    will_return(__wrap_fstatat, false);
+    will_return(__wrap_fstatat, &statistics);
+    will_return(__wrap_fstatat, 0);
+
+    const f_status_t status = f_file_exists_at(0, path, 0);
+
+    assert_int_equal(status, F_true);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-exists_at.h b/level_0/f_file/tests/unit/c/test-file-exists_at.h
new file mode 100644 (file)
index 0000000..c0e2483
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_exists_at_h
+#define _TEST__F_file_exists_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_exists_at()
+ */
+extern void test__f_file_exists_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_exists_at()
+ */
+extern void test__f_file_exists_at__returns_data_not(void **state);
+
+/**
+ * Test that function works and returns F_false.
+ *
+ * @see f_file_exists_at()
+ */
+extern void test__f_file_exists_at__returns_false(void **state);
+
+/**
+ * Test that function works and returns F_true.
+ *
+ * @see f_file_exists_at()
+ */
+extern void test__f_file_exists_at__returns_true(void **state);
+
+#endif // _TEST__F_file_exists_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-flush.c b/level_0/f_file/tests/unit/c/test-file-flush.c
new file mode 100644 (file)
index 0000000..95ebb5d
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-flush.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_flush__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_flush(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_flush__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_flush(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_flush__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_flush();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-flush.h b/level_0/f_file/tests/unit/c/test-file-flush.h
new file mode 100644 (file)
index 0000000..082c1a4
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_flush_h
+#define _TEST__F_file_flush_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_flush()
+ */
+extern void test__f_file_flush__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_flush()
+ */
+extern void test__f_file_flush__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_flush()
+ */
+extern void test__f_file_flush__works(void **state);
+
+#endif // _TEST__F_file_flush_h
diff --git a/level_0/f_file/tests/unit/c/test-file-group_read.c b/level_0/f_file/tests/unit/c/test-file-group_read.c
new file mode 100644 (file)
index 0000000..01c4d71
--- /dev/null
@@ -0,0 +1,70 @@
+#include "test-file.h"
+#include "test-file-group_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_group_read__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_group_read(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_group_read__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_group_read(f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_group_read__returns_data_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    //const f_status_t status = f_file_group_read(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_group_read__works(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_group_read();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-group_read.h b/level_0/f_file/tests/unit/c/test-file-group_read.h
new file mode 100644 (file)
index 0000000..ce36ca5
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_group_read_h
+#define _TEST__F_file_group_read_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_group_read()
+ */
+extern void test__f_file_group_read__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_group_read()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_group_read__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_group_read()
+ */
+extern void test__f_file_group_read__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_group_read()
+ */
+extern void test__f_file_group_read__works(void **state);
+
+#endif // _TEST__F_file_group_read_h
diff --git a/level_0/f_file/tests/unit/c/test-file-is.c b/level_0/f_file/tests/unit/c/test-file-is.c
new file mode 100644 (file)
index 0000000..27d3d17
--- /dev/null
@@ -0,0 +1,104 @@
+#include "test-file.h"
+#include "test-file-is.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_is__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    EACCES,
+    EFAULT,
+    ELOOP,
+    ENAMETOOLONG,
+    ENOENT,
+    ENOMEM,
+    ENOTDIR,
+    EOVERFLOW,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_access_denied,
+    F_buffer,
+    F_loop,
+    F_name,
+    F_file_found_not,
+    F_memory_not,
+    F_false,
+    F_number_overflow,
+    F_file_stat,
+  };
+
+  // @todo an outer loop is needed to run this against all types.
+  f_status_t types[] = {
+  };
+
+  for (int i = 0; i < 9; ++i) {
+
+    //will_return(__wrap_stat, true);
+    //will_return(__wrap_stat, errnos[i]);
+
+    //const f_status_t status = f_file_is(path);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_is__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_is(f_string_empty_s, 0, F_false);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_is__returns_false(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  {
+    will_return(__wrap_stat, false);
+    will_return(__wrap_stat, &statistics);
+    will_return(__wrap_stat, 0);
+
+    const f_status_t status = f_file_is(path);
+
+    assert_int_equal(status, F_false);
+  }
+  */
+}
+
+void test__f_file_is__returns_true(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  statistics.st_mode = 1 | F_file_type_directory_d;
+
+  {
+    will_return(__wrap_stat, false);
+    will_return(__wrap_stat, &statistics);
+    will_return(__wrap_stat, 0);
+
+    const f_status_t status = f_file_is(path);
+
+    assert_int_equal(status, F_true);
+  }
+  */
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-is.h b/level_0/f_file/tests/unit/c/test-file-is.h
new file mode 100644 (file)
index 0000000..6b4f9ed
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_is_h
+#define _TEST__F_file_is_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_is()
+ */
+extern void test__f_file_is__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_is()
+ */
+extern void test__f_file_is__returns_data_not(void **state);
+
+/**
+ * Test that function works and returns F_false.
+ *
+ * @see f_file_is()
+ */
+extern void test__f_file_is__returns_false(void **state);
+
+/**
+ * Test that function works and returns F_true.
+ *
+ * @see f_file_is()
+ */
+extern void test__f_file_is__returns_true(void **state);
+
+#endif // _TEST__F_file_is_h
diff --git a/level_0/f_file/tests/unit/c/test-file-is_at.c b/level_0/f_file/tests/unit/c/test-file-is_at.c
new file mode 100644 (file)
index 0000000..aeb5ab7
--- /dev/null
@@ -0,0 +1,103 @@
+#include "test-file.h"
+#include "test-file-is_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_is_at__fails(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    EACCES,
+    EBADF,
+    EFAULT,
+    ELOOP,
+    ENAMETOOLONG,
+    ENOENT,
+    ENOMEM,
+    ENOTDIR,
+    EOVERFLOW,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_access_denied,
+    F_file_descriptor,
+    F_buffer,
+    F_loop,
+    F_name,
+    F_file_found_not,
+    F_memory_not,
+    F_false,
+    F_number_overflow,
+    F_file_stat,
+  };
+
+  for (int i = 0; i < 10; ++i) {
+
+    will_return(__wrap_fstatat, true);
+    will_return(__wrap_fstatat, errnos[i]);
+
+    const f_status_t status = f_file_is_at(0, path, 0);
+
+    assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+  */
+}
+
+void test__f_file_is_at__returns_data_not(void **state) {
+/*
+  {
+    const f_status_t status = f_file_is_at(0, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+  */
+}
+
+void test__f_file_is_at__returns_false(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  {
+    will_return(__wrap_fstatat, false);
+    will_return(__wrap_fstatat, &statistics);
+    will_return(__wrap_fstatat, 0);
+
+    const f_status_t status = f_file_is_at(0, path, 0);
+
+    assert_int_equal(status, F_false);
+  }
+}
+
+void test__f_file_is_at__returns_true(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  struct stat statistics;
+
+  memset(&statistics, 0, sizeof (struct stat));
+
+  statistics.st_mode = 1 | F_file_type_directory_d;
+
+  {
+    will_return(__wrap_fstatat, false);
+    will_return(__wrap_fstatat, &statistics);
+    will_return(__wrap_fstatat, 0);
+
+    const f_status_t status = f_file_is_at(0, path, 0);
+
+    assert_int_equal(status, F_true);
+  }
+  */
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-is_at.h b/level_0/f_file/tests/unit/c/test-file-is_at.h
new file mode 100644 (file)
index 0000000..82248fe
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_is_at_h
+#define _TEST__F_file_is_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_is_at()
+ */
+extern void test__f_file_is_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_is_at()
+ */
+extern void test__f_file_is_at__returns_data_not(void **state);
+
+/**
+ * Test that function works and returns F_false.
+ *
+ * @see f_file_is_at()
+ */
+extern void test__f_file_is_at__returns_false(void **state);
+
+/**
+ * Test that function works and returns F_true.
+ *
+ * @see f_file_is_at()
+ */
+extern void test__f_file_is_at__returns_true(void **state);
+
+#endif // _TEST__F_file_is_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-link.c b/level_0/f_file/tests/unit/c/test-file-link.c
new file mode 100644 (file)
index 0000000..9ce9e2f
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-link.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_link__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_link(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_link__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_link(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_link__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_link();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-link.h b/level_0/f_file/tests/unit/c/test-file-link.h
new file mode 100644 (file)
index 0000000..7e1beee
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_link_h
+#define _TEST__F_file_link_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_link()
+ */
+extern void test__f_file_link__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_link()
+ */
+extern void test__f_file_link__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_link()
+ */
+extern void test__f_file_link__works(void **state);
+
+#endif // _TEST__F_file_link_h
diff --git a/level_0/f_file/tests/unit/c/test-file-link_at.c b/level_0/f_file/tests/unit/c/test-file-link_at.c
new file mode 100644 (file)
index 0000000..a5d0c81
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-link_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_link_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_link_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_link_at__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_link_at(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_link_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_link_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-link_at.h b/level_0/f_file/tests/unit/c/test-file-link_at.h
new file mode 100644 (file)
index 0000000..5cd5297
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_link_at_h
+#define _TEST__F_file_link_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_link_at()
+ */
+extern void test__f_file_link_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_link_at()
+ */
+extern void test__f_file_link_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_link_at()
+ */
+extern void test__f_file_link_at__works(void **state);
+
+#endif // _TEST__F_file_link_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-link_hard.c b/level_0/f_file/tests/unit/c/test-file-link_hard.c
new file mode 100644 (file)
index 0000000..99f7c23
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-link_hard.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_link_hard__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_link_hard(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_link_hard__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_link_hard(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_link_hard__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_link_hard();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-link_hard.h b/level_0/f_file/tests/unit/c/test-file-link_hard.h
new file mode 100644 (file)
index 0000000..3b91800
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_link_hard_h
+#define _TEST__F_file_link_hard_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_link_hard()
+ */
+extern void test__f_file_link_hard__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_link_hard()
+ */
+extern void test__f_file_link_hard__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_link_hard()
+ */
+extern void test__f_file_link_hard__works(void **state);
+
+#endif // _TEST__F_file_link_hard_h
diff --git a/level_0/f_file/tests/unit/c/test-file-link_hard_at.c b/level_0/f_file/tests/unit/c/test-file-link_hard_at.c
new file mode 100644 (file)
index 0000000..d6c9b39
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-link_hard_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_link_hard_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_link_hard_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_link_hard_at__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_link_hard_at(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_link_hard_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_link_hard_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-link_hard_at.h b/level_0/f_file/tests/unit/c/test-file-link_hard_at.h
new file mode 100644 (file)
index 0000000..451ea61
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_link_hard_at_h
+#define _TEST__F_file_link_hard_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_link_hard_at()
+ */
+extern void test__f_file_link_hard_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_link_hard_at()
+ */
+extern void test__f_file_link_hard_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_link_hard_at()
+ */
+extern void test__f_file_link_hard_at__works(void **state);
+
+#endif // _TEST__F_file_link_hard_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-link_read.c b/level_0/f_file/tests/unit/c/test-file-link_read.c
new file mode 100644 (file)
index 0000000..a642475
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-file.h"
+#include "test-file-link_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_link_read__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_link_read(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_link_read__parameter_checking(void **state) {
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof(struct stat));
+
+    {
+      const f_status_t status = f_file_link_read(f_string_empty_s, statistics, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_link_read__returns_data_not(void **state) {
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof(struct stat));
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_link_read(f_string_empty_s, statistics, &string);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_link_read__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_link_read();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-link_read.h b/level_0/f_file/tests/unit/c/test-file-link_read.h
new file mode 100644 (file)
index 0000000..f10a59a
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_link_read_h
+#define _TEST__F_file_link_read_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_link_read()
+ */
+extern void test__f_file_link_read__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_link_read()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_link_read__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_link_read()
+ */
+extern void test__f_file_link_read__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_link_read()
+ */
+extern void test__f_file_link_read__works(void **state);
+
+#endif // _TEST__F_file_link_read_h
diff --git a/level_0/f_file/tests/unit/c/test-file-link_read_at.c b/level_0/f_file/tests/unit/c/test-file-link_read_at.c
new file mode 100644 (file)
index 0000000..98b5d3b
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-file.h"
+#include "test-file-link_read_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_link_read_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_link_read_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_link_read_at__parameter_checking(void **state) {
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof(struct stat));
+
+    {
+      const f_status_t status = f_file_link_read_at(0, f_string_empty_s, statistics, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_link_read_at__returns_data_not(void **state) {
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof(struct stat));
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_link_read_at(0, f_string_empty_s, statistics, &string);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_link_read_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_link_read_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-link_read_at.h b/level_0/f_file/tests/unit/c/test-file-link_read_at.h
new file mode 100644 (file)
index 0000000..e0e6a7c
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_link_read_at_h
+#define _TEST__F_file_link_read_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_link_read_at()
+ */
+extern void test__f_file_link_read_at__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_link_read_at()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_link_read_at__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_link_read_at()
+ */
+extern void test__f_file_link_read_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_link_read_at()
+ */
+extern void test__f_file_link_read_at__works(void **state);
+
+#endif // _TEST__F_file_link_read_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_determine.c b/level_0/f_file/tests/unit/c/test-file-mode_determine.c
new file mode 100644 (file)
index 0000000..e6122e4
--- /dev/null
@@ -0,0 +1,58 @@
+#include "test-file.h"
+#include "test-file-mode_determine.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_mode_determine__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_mode_determine(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_mode_determine__parameter_checking(void **state) {
+
+    const mode_t mode_file = 0;
+    const f_file_mode_t mode_change = f_file_mode_t_initialize;
+
+    {
+      const f_status_t status = f_file_mode_determine(mode_file, mode_change, 0, F_false, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_mode_determine__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_mode_determine();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_determine.h b/level_0/f_file/tests/unit/c/test-file-mode_determine.h
new file mode 100644 (file)
index 0000000..cb444d9
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_mode_determine_h
+#define _TEST__F_file_mode_determine_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_mode_determine()
+ */
+extern void test__f_file_mode_determine__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_mode_determine()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_mode_determine__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_mode_determine()
+ */
+extern void test__f_file_mode_determine__works(void **state);
+
+#endif // _TEST__F_file_mode_determine_h
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_from_string.c b/level_0/f_file/tests/unit/c/test-file-mode_from_string.c
new file mode 100644 (file)
index 0000000..90950df
--- /dev/null
@@ -0,0 +1,80 @@
+#include "test-file.h"
+#include "test-file-mode_from_string.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_mode_from_string__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_mode_from_string(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_mode_from_string__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_mode_from_string(f_string_empty_s, 0, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      f_file_mode_t mode_file = f_file_mode_t_initialize;
+
+      const f_status_t status = f_file_mode_from_string(f_string_empty_s, 0, &mode_file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      uint8_t replace = 0;
+
+      const f_status_t status = f_file_mode_from_string(f_string_empty_s, 0, 0, &replace);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_mode_from_string__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_mode_from_string(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_mode_from_string__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_mode_from_string();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_from_string.h b/level_0/f_file/tests/unit/c/test-file-mode_from_string.h
new file mode 100644 (file)
index 0000000..c11d137
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_mode_from_string_h
+#define _TEST__F_file_mode_from_string_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_mode_from_string()
+ */
+extern void test__f_file_mode_from_string__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_mode_from_string()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_mode_from_string__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_mode_from_string()
+ */
+extern void test__f_file_mode_from_string__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_mode_from_string()
+ */
+extern void test__f_file_mode_from_string__works(void **state);
+
+#endif // _TEST__F_file_mode_from_string_h
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_read.c b/level_0/f_file/tests/unit/c/test-file-mode_read.c
new file mode 100644 (file)
index 0000000..341abc5
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-mode_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_mode_read__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_mode_read(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_mode_read__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_mode_read(f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_mode_read__returns_data_not(void **state) {
+
+  {
+    mode_t mode = 0;
+
+    const f_status_t status = f_file_mode_read(f_string_empty_s, &mode);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_mode_read__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_mode_read();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_read.h b/level_0/f_file/tests/unit/c/test-file-mode_read.h
new file mode 100644 (file)
index 0000000..0052f17
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_mode_read_h
+#define _TEST__F_file_mode_read_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_mode_read()
+ */
+extern void test__f_file_mode_read__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_mode_read()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_mode_read__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_mode_read()
+ */
+extern void test__f_file_mode_read__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_mode_read()
+ */
+extern void test__f_file_mode_read__works(void **state);
+
+#endif // _TEST__F_file_mode_read_h
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_read_at.c b/level_0/f_file/tests/unit/c/test-file-mode_read_at.c
new file mode 100644 (file)
index 0000000..1038248
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-mode_read_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_mode_read_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_mode_read_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_mode_read_at__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_mode_read_at(0, f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_mode_read_at__returns_data_not(void **state) {
+
+  {
+    mode_t mode = 0;
+
+    const f_status_t status = f_file_mode_read_at(0, f_string_empty_s, &mode);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_mode_read_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_mode_read_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_read_at.h b/level_0/f_file/tests/unit/c/test-file-mode_read_at.h
new file mode 100644 (file)
index 0000000..647003d
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_mode_read_at_h
+#define _TEST__F_file_mode_read_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_mode_read_at()
+ */
+extern void test__f_file_mode_read_at__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_mode_read_at()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_mode_read_at__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_mode_read_at()
+ */
+extern void test__f_file_mode_read_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_mode_read_at()
+ */
+extern void test__f_file_mode_read_at__works(void **state);
+
+#endif // _TEST__F_file_mode_read_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_set.c b/level_0/f_file/tests/unit/c/test-file-mode_set.c
new file mode 100644 (file)
index 0000000..c73d612
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-mode_set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_mode_set__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_mode_set(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_mode_set__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_mode_set(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_mode_set__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_mode_set();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_set.h b/level_0/f_file/tests/unit/c/test-file-mode_set.h
new file mode 100644 (file)
index 0000000..4134c3f
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_mode_set_h
+#define _TEST__F_file_mode_set_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_mode_set()
+ */
+extern void test__f_file_mode_set__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_mode_set()
+ */
+extern void test__f_file_mode_set__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_mode_set()
+ */
+extern void test__f_file_mode_set__works(void **state);
+
+#endif // _TEST__F_file_mode_set_h
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_set_at.c b/level_0/f_file/tests/unit/c/test-file-mode_set_at.c
new file mode 100644 (file)
index 0000000..f5a0116
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-mode_set_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_mode_set_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_mode_set_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_mode_set_at__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_mode_set_at(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_mode_set_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_mode_set_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_set_at.h b/level_0/f_file/tests/unit/c/test-file-mode_set_at.h
new file mode 100644 (file)
index 0000000..14b920f
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_mode_set_at_h
+#define _TEST__F_file_mode_set_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_mode_set_at()
+ */
+extern void test__f_file_mode_set_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_mode_set_at()
+ */
+extern void test__f_file_mode_set_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_mode_set_at()
+ */
+extern void test__f_file_mode_set_at__works(void **state);
+
+#endif // _TEST__F_file_mode_set_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_to_mode.c b/level_0/f_file/tests/unit/c/test-file-mode_to_mode.c
new file mode 100644 (file)
index 0000000..8f7cc5a
--- /dev/null
@@ -0,0 +1,57 @@
+#include "test-file.h"
+#include "test-file-mode_to_mode.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_mode_to_mode__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_mode_to_mode(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_mode_to_mode__parameter_checking(void **state) {
+
+    const f_file_mode_t mode = f_file_mode_t_initialize;
+
+    {
+      const f_status_t status = f_file_mode_to_mode(mode, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_mode_to_mode__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_mode_to_mode();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-mode_to_mode.h b/level_0/f_file/tests/unit/c/test-file-mode_to_mode.h
new file mode 100644 (file)
index 0000000..006f8e4
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_mode_to_mode_h
+#define _TEST__F_file_mode_to_mode_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_mode_to_mode()
+ */
+extern void test__f_file_mode_to_mode__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_mode_to_mode()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_mode_to_mode__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_mode_to_mode()
+ */
+extern void test__f_file_mode_to_mode__works(void **state);
+
+#endif // _TEST__F_file_mode_to_mode_h
diff --git a/level_0/f_file/tests/unit/c/test-file-name_base.c b/level_0/f_file/tests/unit/c/test-file-name_base.c
new file mode 100644 (file)
index 0000000..b1fbafe
--- /dev/null
@@ -0,0 +1,64 @@
+#include "test-file.h"
+#include "test-file-name_base.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_name_base__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_name_base(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_name_base__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_name_base(f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_name_base__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_name_base(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_name_base__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_name_base();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-name_base.h b/level_0/f_file/tests/unit/c/test-file-name_base.h
new file mode 100644 (file)
index 0000000..16fe388
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_name_base_h
+#define _TEST__F_file_name_base_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_name_base()
+ */
+extern void test__f_file_name_base__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_name_base()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_name_base__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_name_base()
+ */
+extern void test__f_file_name_base__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_name_base()
+ */
+extern void test__f_file_name_base__works(void **state);
+
+#endif // _TEST__F_file_name_base_h
diff --git a/level_0/f_file/tests/unit/c/test-file-name_directory.c b/level_0/f_file/tests/unit/c/test-file-name_directory.c
new file mode 100644 (file)
index 0000000..0ad533c
--- /dev/null
@@ -0,0 +1,64 @@
+#include "test-file.h"
+#include "test-file-name_directory.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_name_directory__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_name_directory(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_name_directory__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_name_directory(f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_name_directory__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_name_directory(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_name_directory__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_name_directory();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-name_directory.h b/level_0/f_file/tests/unit/c/test-file-name_directory.h
new file mode 100644 (file)
index 0000000..7992858
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_name_directory_h
+#define _TEST__F_file_name_directory_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_name_directory()
+ */
+extern void test__f_file_name_directory__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_name_directory()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_name_directory__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_name_directory()
+ */
+extern void test__f_file_name_directory__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_name_directory()
+ */
+extern void test__f_file_name_directory__works(void **state);
+
+#endif // _TEST__F_file_name_directory_h
diff --git a/level_0/f_file/tests/unit/c/test-file-open.c b/level_0/f_file/tests/unit/c/test-file-open.c
new file mode 100644 (file)
index 0000000..33e0db6
--- /dev/null
@@ -0,0 +1,117 @@
+#include "test-file.h"
+#include "test-file-open.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_open__fails(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    EACCES,
+    EEXIST,
+    EFAULT,
+    EFBIG,
+    EDQUOT,
+    EINTR,
+    EINVAL,
+    EISDIR,
+    ELOOP,
+    ENAMETOOLONG,
+    ENFILE,
+    ENOENT,
+    ENOMEM,
+    ENOSPC,
+    ENOTDIR,
+    EOPNOTSUPP,
+    EOVERFLOW,
+    EPERM,
+    EROFS,
+    ETXTBSY,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_access_denied,
+    F_file_found,
+    F_buffer,
+    F_number_overflow,
+    F_filesystem_quota_block,
+    F_interrupt,
+    F_parameter,
+    F_directory,
+    F_loop,
+    F_name,
+    F_file_open_max,
+    F_file_found_not,
+    F_memory_not,
+    F_space_not,
+    F_file_type_not_directory,
+    F_supported_not,
+    F_number_overflow,
+    F_prohibited,
+    F_read_only,
+    F_busy,
+    F_failure,
+  };
+
+  for (int i = 0; i < 21; ++i) {
+
+    f_file_t file = f_file_t_initialize;
+
+    will_return(__wrap_open, true);
+    will_return(__wrap_open, errnos[i]);
+
+    const f_status_t status = f_file_open(path, 0, &file);
+
+    assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_open__parameter_checking(void **state) {
+
+    const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+    {
+      const f_status_t status = f_file_open(path, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_open__returns_data_not(void **state) {
+
+  {
+    f_file_t file = f_file_t_initialize;
+
+    const f_status_t status = f_file_open(f_string_empty_s, 0, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_open__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;
+
+    will_return(__wrap_open, false);
+    will_return(__wrap_open, 5);
+
+    const f_status_t status = f_file_open(path, 0, &file);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(id, 5);
+  }
+  */
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-open.h b/level_0/f_file/tests/unit/c/test-file-open.h
new file mode 100644 (file)
index 0000000..66fa65a
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_open_h
+#define _TEST__F_file_open_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_open()
+ */
+extern void test__f_file_open__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_open()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_open__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_open()
+ */
+extern void test__f_file_open__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_open()
+ */
+extern void test__f_file_open__works(void **state);
+
+#endif // _TEST__F_file_open_h
diff --git a/level_0/f_file/tests/unit/c/test-file-open_at.c b/level_0/f_file/tests/unit/c/test-file-open_at.c
new file mode 100644 (file)
index 0000000..64b7bc8
--- /dev/null
@@ -0,0 +1,121 @@
+#include "test-file.h"
+#include "test-file-open_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_open_at__fails(void **state) {
+/*
+  const int at = 1;
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    EACCES,
+    EEXIST,
+    EFAULT,
+    EFBIG,
+    EDQUOT,
+    EINTR,
+    EINVAL,
+    EISDIR,
+    ELOOP,
+    ENAMETOOLONG,
+    ENFILE,
+    ENOENT,
+    ENOMEM,
+    ENOSPC,
+    ENOTDIR,
+    EOPNOTSUPP,
+    EOVERFLOW,
+    EPERM,
+    EROFS,
+    ETXTBSY,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_access_denied,
+    F_file_found,
+    F_buffer,
+    F_number_overflow,
+    F_filesystem_quota_block,
+    F_interrupt,
+    F_parameter,
+    F_directory,
+    F_loop,
+    F_name,
+    F_file_open_max,
+    F_file_found_not,
+    F_memory_not,
+    F_space_not,
+    F_file_type_not_directory,
+    F_supported_not,
+    F_number_overflow,
+    F_prohibited,
+    F_read_only,
+    F_busy,
+    F_failure,
+  };
+
+  for (int i = 0; i < 17; ++i) {
+
+    int id = 0;
+
+    will_return(__wrap_openat, true);
+    will_return(__wrap_openat, errnos[i]);
+
+    const f_status_t status = f_file_open_at(at, path, F_false, &id);
+
+    assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+  */
+}
+
+#ifndef _di_level_0_parameter_checking_
+  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);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_open_at__returns_data_not(void **state) {
+
+  const int at = 1;
+
+  {
+    f_file_t file = f_file_t_initialize;
+
+    const f_status_t status = f_file_open_at(at, f_string_empty_s, 0, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_open_at__works(void **state) {
+/*
+  const int at = 1;
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int id = 0;
+
+    will_return(__wrap_openat, false);
+    will_return(__wrap_openat, 5);
+
+    const f_status_t status = f_file_open_at(at, path, F_false, &id);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(id, 5);
+  }
+  */
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-open_at.h b/level_0/f_file/tests/unit/c/test-file-open_at.h
new file mode 100644 (file)
index 0000000..231b8ba
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_open_at_h
+#define _TEST__F_file_open_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_open_at()
+ */
+extern void test__f_file_open_at__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_open_at()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_open_at__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_open_at()
+ */
+extern void test__f_file_open_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_open_at()
+ */
+extern void test__f_file_open_at__works(void **state);
+
+#endif // _TEST__F_file_open_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-owner_read.c b/level_0/f_file/tests/unit/c/test-file-owner_read.c
new file mode 100644 (file)
index 0000000..45dd70c
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-owner_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_owner_read__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_owner_read(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_owner_read__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_owner_read(f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_owner_read__returns_data_not(void **state) {
+
+  {
+    uid_t id = 0;
+
+    const f_status_t status = f_file_owner_read(f_string_empty_s, &id);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_owner_read__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_owner_read();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-owner_read.h b/level_0/f_file/tests/unit/c/test-file-owner_read.h
new file mode 100644 (file)
index 0000000..da3a849
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_owner_read_h
+#define _TEST__F_file_owner_read_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_owner_read()
+ */
+extern void test__f_file_owner_read__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_owner_read()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_owner_read__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_owner_read()
+ */
+extern void test__f_file_owner_read__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_owner_read()
+ */
+extern void test__f_file_owner_read__works(void **state);
+
+#endif // _TEST__F_file_owner_read_h
diff --git a/level_0/f_file/tests/unit/c/test-file-read.c b/level_0/f_file/tests/unit/c/test-file-read.c
new file mode 100644 (file)
index 0000000..20eee79
--- /dev/null
@@ -0,0 +1,86 @@
+#include "test-file.h"
+#include "test-file-read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_read__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_read(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_read__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+
+    {
+      const f_status_t status = f_file_read(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    file.size_read = 0;
+
+    {
+      const f_status_t status = f_file_read(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+      const f_status_t status = f_file_read(file, &string);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_read__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_read(file, &string);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_read__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_read();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-read.h b/level_0/f_file/tests/unit/c/test-file-read.h
new file mode 100644 (file)
index 0000000..e6b89d9
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_read_h
+#define _TEST__F_file_read_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_read()
+ */
+extern void test__f_file_read__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_read()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_read__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file is closed.
+ *
+ * @see f_file_read()
+ */
+extern void test__f_file_read__returns_file_closed(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_read()
+ */
+extern void test__f_file_read__works(void **state);
+
+#endif // _TEST__F_file_read_h
diff --git a/level_0/f_file/tests/unit/c/test-file-read_block.c b/level_0/f_file/tests/unit/c/test-file-read_block.c
new file mode 100644 (file)
index 0000000..0bfc613
--- /dev/null
@@ -0,0 +1,86 @@
+#include "test-file.h"
+#include "test-file-read_block.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_read_block__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_read_block(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_read_block__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+
+    {
+      const f_status_t status = f_file_read_block(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    file.size_read = 0;
+
+    {
+      const f_status_t status = f_file_read_block(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+      const f_status_t status = f_file_read_block(file, &string);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_read_block__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_read_block(file, &string);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_read_block__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_read_block();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-read_block.h b/level_0/f_file/tests/unit/c/test-file-read_block.h
new file mode 100644 (file)
index 0000000..dfc11e5
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_read_block_h
+#define _TEST__F_file_read_block_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_read_block()
+ */
+extern void test__f_file_read_block__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_read_block()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_read_block__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file is closed.
+ *
+ * @see f_file_read_block()
+ */
+extern void test__f_file_read_block__returns_file_closed(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_read_block()
+ */
+extern void test__f_file_read_block__works(void **state);
+
+#endif // _TEST__F_file_read_block_h
diff --git a/level_0/f_file/tests/unit/c/test-file-read_until.c b/level_0/f_file/tests/unit/c/test-file-read_until.c
new file mode 100644 (file)
index 0000000..9af5839
--- /dev/null
@@ -0,0 +1,86 @@
+#include "test-file.h"
+#include "test-file-read_until.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_read_until__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_read_until(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_read_until__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+
+    {
+      const f_status_t status = f_file_read_until(file, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    file.size_read = 0;
+
+    {
+      const f_status_t status = f_file_read_until(file, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+      const f_status_t status = f_file_read_until(file, 0, &string);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_read_until__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_read_until(file, 0, &string);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_read_until__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_read_until();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-read_until.h b/level_0/f_file/tests/unit/c/test-file-read_until.h
new file mode 100644 (file)
index 0000000..88de066
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_read_until_h
+#define _TEST__F_file_read_until_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_read_until()
+ */
+extern void test__f_file_read_until__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_read_until()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_read_until__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file is closed.
+ *
+ * @see f_file_read_until()
+ */
+extern void test__f_file_read_until__returns_file_closed(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_read_until()
+ */
+extern void test__f_file_read_until__works(void **state);
+
+#endif // _TEST__F_file_read_until_h
diff --git a/level_0/f_file/tests/unit/c/test-file-remove.c b/level_0/f_file/tests/unit/c/test-file-remove.c
new file mode 100644 (file)
index 0000000..251627f
--- /dev/null
@@ -0,0 +1,92 @@
+#include "test-file.h"
+#include "test-file-remove.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_remove__fails(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  int errnos[] = {
+    EACCES,
+    EBUSY,
+    EFAULT,
+    EINVAL,
+    EIO,
+    EISDIR,
+    ELOOP,
+    EMFILE,
+    ENAMETOOLONG,
+    ENFILE,
+    ENOENT,
+    ENOMEM,
+    ENOTDIR,
+    ENOTEMPTY,
+    EPERM,
+    EROFS,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_access_denied,
+    F_busy,
+    F_buffer,
+    F_parameter,
+    F_input_output,
+    F_file_type_directory,
+    F_loop,
+    F_file_descriptor_max,
+    F_name,
+    F_file_open_max,
+    F_file_found_not,
+    F_memory_not,
+    F_file_not,
+    F_file_empty_not,
+    F_prohibited,
+    F_read_only,
+    F_failure,
+  };
+
+  {
+    for (int i = 0; i < 17; ++i) {
+
+      will_return(__wrap_remove, true);
+      will_return(__wrap_remove, errnos[i]);
+
+      const f_status_t status = f_file_remove(path);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+  */
+}
+
+void test__f_file_remove__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_remove(f_string_empty_s);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_remove__works(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    will_return(__wrap_remove, false);
+    will_return(__wrap_remove, 0);
+
+    const f_status_t status = f_file_remove(path);
+
+    assert_int_equal(status, F_none);
+  }
+  */
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-remove.h b/level_0/f_file/tests/unit/c/test-file-remove.h
new file mode 100644 (file)
index 0000000..a47aa22
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_remove_h
+#define _TEST__F_file_remove_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_remove()
+ */
+extern void test__f_file_remove__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_remove()
+ */
+extern void test__f_file_remove__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_remove()
+ */
+extern void test__f_file_remove__works(void **state);
+
+#endif // _TEST__F_file_remove_h
diff --git a/level_0/f_file/tests/unit/c/test-file-remove_at.c b/level_0/f_file/tests/unit/c/test-file-remove_at.c
new file mode 100644 (file)
index 0000000..71df150
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-remove_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_remove_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_remove_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_remove_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_remove_at(0, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_remove_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_remove_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-remove_at.h b/level_0/f_file/tests/unit/c/test-file-remove_at.h
new file mode 100644 (file)
index 0000000..a8c6da7
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_remove_at_h
+#define _TEST__F_file_remove_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_remove_at()
+ */
+extern void test__f_file_remove_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_remove_at()
+ */
+extern void test__f_file_remove_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_remove_at()
+ */
+extern void test__f_file_remove_at__works(void **state);
+
+#endif // _TEST__F_file_remove_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-rename.c b/level_0/f_file/tests/unit/c/test-file-rename.c
new file mode 100644 (file)
index 0000000..1922d39
--- /dev/null
@@ -0,0 +1,67 @@
+#include "test-file.h"
+#include "test-file-rename.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_rename__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_rename(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_rename__returns_data_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    const f_status_t status = f_file_rename(f_string_empty_s, f_string_empty_s);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_rename(path, f_string_empty_s);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_rename(f_string_empty_s, path);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_rename__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_rename();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-rename.h b/level_0/f_file/tests/unit/c/test-file-rename.h
new file mode 100644 (file)
index 0000000..40d5f3a
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_rename_h
+#define _TEST__F_file_rename_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_rename()
+ */
+extern void test__f_file_rename__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_rename()
+ */
+extern void test__f_file_rename__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_rename()
+ */
+extern void test__f_file_rename__works(void **state);
+
+#endif // _TEST__F_file_rename_h
diff --git a/level_0/f_file/tests/unit/c/test-file-rename_at.c b/level_0/f_file/tests/unit/c/test-file-rename_at.c
new file mode 100644 (file)
index 0000000..123f913
--- /dev/null
@@ -0,0 +1,67 @@
+#include "test-file.h"
+#include "test-file-rename_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_rename_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_rename_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_rename_at__returns_data_not(void **state) {
+
+  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);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_rename_at(0, 0, path, f_string_empty_s);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_rename_at(0, 0, f_string_empty_s, path);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_rename_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_rename_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-rename_at.h b/level_0/f_file/tests/unit/c/test-file-rename_at.h
new file mode 100644 (file)
index 0000000..1f60343
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_rename_at_h
+#define _TEST__F_file_rename_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_rename_at()
+ */
+extern void test__f_file_rename_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_rename_at()
+ */
+extern void test__f_file_rename_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_rename_at()
+ */
+extern void test__f_file_rename_at__works(void **state);
+
+#endif // _TEST__F_file_rename_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-role_change.c b/level_0/f_file/tests/unit/c/test-file-role_change.c
new file mode 100644 (file)
index 0000000..43aec90
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-role_change.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_role_change__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_role_change(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_role_change__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_role_change(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_role_change__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_role_change();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-role_change.h b/level_0/f_file/tests/unit/c/test-file-role_change.h
new file mode 100644 (file)
index 0000000..37e16f9
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_role_change_h
+#define _TEST__F_file_role_change_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_role_change()
+ */
+extern void test__f_file_role_change__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_role_change()
+ */
+extern void test__f_file_role_change__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_role_change()
+ */
+extern void test__f_file_role_change__works(void **state);
+
+#endif // _TEST__F_file_role_change_h
diff --git a/level_0/f_file/tests/unit/c/test-file-role_change_at.c b/level_0/f_file/tests/unit/c/test-file-role_change_at.c
new file mode 100644 (file)
index 0000000..74a9a05
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-role_change_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_role_change_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_role_change_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_role_change_at__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_role_change_at(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_role_change_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_role_change_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-role_change_at.h b/level_0/f_file/tests/unit/c/test-file-role_change_at.h
new file mode 100644 (file)
index 0000000..c4e8f48
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_role_change_at_h
+#define _TEST__F_file_role_change_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_role_change_at()
+ */
+extern void test__f_file_role_change_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_role_change_at()
+ */
+extern void test__f_file_role_change_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_role_change_at()
+ */
+extern void test__f_file_role_change_at__works(void **state);
+
+#endif // _TEST__F_file_role_change_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-seek.c b/level_0/f_file/tests/unit/c/test-file-seek.c
new file mode 100644 (file)
index 0000000..0e2e2e4
--- /dev/null
@@ -0,0 +1,55 @@
+#include "test-file.h"
+#include "test-file-seek.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_seek__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_seek(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_seek__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_seek(0, 0, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_seek__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_seek();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-seek.h b/level_0/f_file/tests/unit/c/test-file-seek.h
new file mode 100644 (file)
index 0000000..32938d5
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_seek_h
+#define _TEST__F_file_seek_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_seek()
+ */
+extern void test__f_file_seek__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_seek()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_seek__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_seek()
+ */
+extern void test__f_file_seek__works(void **state);
+
+#endif // _TEST__F_file_seek_h
diff --git a/level_0/f_file/tests/unit/c/test-file-size.c b/level_0/f_file/tests/unit/c/test-file-size.c
new file mode 100644 (file)
index 0000000..a09198b
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-size.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_size__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_size(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_size__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_size(f_string_empty_s, F_false, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_size__returns_data_not(void **state) {
+
+  {
+    off_t size = 0;
+
+    const f_status_t status = f_file_size(f_string_empty_s, F_false, &size);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_size__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_size();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-size.h b/level_0/f_file/tests/unit/c/test-file-size.h
new file mode 100644 (file)
index 0000000..a753a4f
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_size_h
+#define _TEST__F_file_size_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_size()
+ */
+extern void test__f_file_size__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_size()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_size__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_size()
+ */
+extern void test__f_file_size__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_size()
+ */
+extern void test__f_file_size__works(void **state);
+
+#endif // _TEST__F_file_size_h
diff --git a/level_0/f_file/tests/unit/c/test-file-size_at.c b/level_0/f_file/tests/unit/c/test-file-size_at.c
new file mode 100644 (file)
index 0000000..551ab06
--- /dev/null
@@ -0,0 +1,64 @@
+#include "test-file.h"
+#include "test-file-size_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_size_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_size_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_size_at__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_size_at(0, f_string_empty_s, F_false, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_size_at__returns_data_not(void **state) {
+
+  {
+    const f_status_t status = f_file_size_at(0, f_string_empty_s, F_false, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_size_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_size_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-size_at.h b/level_0/f_file/tests/unit/c/test-file-size_at.h
new file mode 100644 (file)
index 0000000..83b5314
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_size_at_h
+#define _TEST__F_file_size_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_size_at()
+ */
+extern void test__f_file_size_at__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_size_at()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_size_at__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_size_at()
+ */
+extern void test__f_file_size_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_size_at()
+ */
+extern void test__f_file_size_at__works(void **state);
+
+#endif // _TEST__F_file_size_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-size_by_id.c b/level_0/f_file/tests/unit/c/test-file-size_by_id.c
new file mode 100644 (file)
index 0000000..d54be26
--- /dev/null
@@ -0,0 +1,55 @@
+#include "test-file.h"
+#include "test-file-size_by_id.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_size_by_id__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_size_by_id(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_size_by_id__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_size_by_id(0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_size_by_id__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_size_by_id();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-size_by_id.h b/level_0/f_file/tests/unit/c/test-file-size_by_id.h
new file mode 100644 (file)
index 0000000..bc095b2
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_size_by_id_h
+#define _TEST__F_file_size_by_id_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_size_by_id()
+ */
+extern void test__f_file_size_by_id__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_size_by_id()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_size_by_id__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_size_by_id()
+ */
+extern void test__f_file_size_by_id__works(void **state);
+
+#endif // _TEST__F_file_size_by_id_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stat.c b/level_0/f_file/tests/unit/c/test-file-stat.c
new file mode 100644 (file)
index 0000000..edc1396
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-stat.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stat__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stat(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stat__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_stat(f_string_empty_s, F_false, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stat__returns_data_not(void **state) {
+
+  {
+    struct stat statistics;
+
+    const f_status_t status = f_file_stat(f_string_empty_s, F_false, &statistics);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_stat__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stat();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stat.h b/level_0/f_file/tests/unit/c/test-file-stat.h
new file mode 100644 (file)
index 0000000..ddb361c
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stat_h
+#define _TEST__F_file_stat_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stat()
+ */
+extern void test__f_file_stat__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stat()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stat__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stat()
+ */
+extern void test__f_file_stat__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stat()
+ */
+extern void test__f_file_stat__works(void **state);
+
+#endif // _TEST__F_file_stat_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stat_at.c b/level_0/f_file/tests/unit/c/test-file-stat_at.c
new file mode 100644 (file)
index 0000000..06d25bc
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-stat_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stat_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stat_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stat_at__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_stat_at(0, f_string_empty_s, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stat_at__returns_data_not(void **state) {
+
+  {
+    struct stat statistics;
+
+    const f_status_t status = f_file_stat_at(0, f_string_empty_s, 0, &statistics);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_stat_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stat_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stat_at.h b/level_0/f_file/tests/unit/c/test-file-stat_at.h
new file mode 100644 (file)
index 0000000..733aebe
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stat_at_h
+#define _TEST__F_file_stat_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stat_at()
+ */
+extern void test__f_file_stat_at__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stat_at()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stat_at__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stat_at()
+ */
+extern void test__f_file_stat_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stat_at()
+ */
+extern void test__f_file_stat_at__works(void **state);
+
+#endif // _TEST__F_file_stat_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stat_by_id.c b/level_0/f_file/tests/unit/c/test-file-stat_by_id.c
new file mode 100644 (file)
index 0000000..2730563
--- /dev/null
@@ -0,0 +1,55 @@
+#include "test-file.h"
+#include "test-file-stat_by_id.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stat_by_id__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stat_by_id(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stat_by_id__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_stat_by_id(0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stat_by_id__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stat_by_id();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stat_by_id.h b/level_0/f_file/tests/unit/c/test-file-stat_by_id.h
new file mode 100644 (file)
index 0000000..c845894
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stat_by_id_h
+#define _TEST__F_file_stat_by_id_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stat_by_id()
+ */
+extern void test__f_file_stat_by_id__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stat_by_id()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stat_by_id__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stat_by_id()
+ */
+extern void test__f_file_stat_by_id__works(void **state);
+
+#endif // _TEST__F_file_stat_by_id_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_close.c b/level_0/f_file/tests/unit/c/test-file-stream_close.c
new file mode 100644 (file)
index 0000000..07360c5
--- /dev/null
@@ -0,0 +1,55 @@
+#include "test-file.h"
+#include "test-file-stream_close.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_close__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_close(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_close__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_stream_close(F_false, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_close__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_close();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_close.h b/level_0/f_file/tests/unit/c/test-file-stream_close.h
new file mode 100644 (file)
index 0000000..52baafe
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_close_h
+#define _TEST__F_file_stream_close_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_close()
+ */
+extern void test__f_file_stream_close__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_close()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_close__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_close()
+ */
+extern void test__f_file_stream_close__works(void **state);
+
+#endif // _TEST__F_file_stream_close_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_descriptor.c b/level_0/f_file/tests/unit/c/test-file-stream_descriptor.c
new file mode 100644 (file)
index 0000000..303e6f4
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-stream_descriptor.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_descriptor__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_descriptor(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_descriptor__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_stream_descriptor(f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_descriptor__returns_data_not(void **state) {
+
+  {
+    f_file_t file = f_file_t_initialize;
+
+    const f_status_t status = f_file_stream_descriptor(f_string_empty_s, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_stream_descriptor__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_descriptor();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_descriptor.h b/level_0/f_file/tests/unit/c/test-file-stream_descriptor.h
new file mode 100644 (file)
index 0000000..66b5058
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_descriptor_h
+#define _TEST__F_file_stream_descriptor_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_descriptor()
+ */
+extern void test__f_file_stream_descriptor__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_descriptor()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_descriptor__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stream_descriptor()
+ */
+extern void test__f_file_stream_descriptor__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_descriptor()
+ */
+extern void test__f_file_stream_descriptor__works(void **state);
+
+#endif // _TEST__F_file_stream_descriptor_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_open.c b/level_0/f_file/tests/unit/c/test-file-stream_open.c
new file mode 100644 (file)
index 0000000..67ba5ed
--- /dev/null
@@ -0,0 +1,84 @@
+#include "test-file.h"
+#include "test-file-stream_open.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_open__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_open(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_open__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_stream_open(f_string_empty_s, f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_open__returns_data_not(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;
+
+    const f_status_t status = f_file_stream_open(f_string_empty_s, f_string_empty_s, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_file_t file = f_file_t_initialize;
+
+    const f_status_t status = f_file_stream_open(path, f_string_empty_s, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_file_t file = f_file_t_initialize;
+
+    const f_status_t status = f_file_stream_open(f_string_empty_s, path, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_stream_open__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_open();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_open.h b/level_0/f_file/tests/unit/c/test-file-stream_open.h
new file mode 100644 (file)
index 0000000..21772b4
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_open_h
+#define _TEST__F_file_stream_open_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_open()
+ */
+extern void test__f_file_stream_open__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_open()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_open__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stream_open()
+ */
+extern void test__f_file_stream_open__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_open()
+ */
+extern void test__f_file_stream_open__works(void **state);
+
+#endif // _TEST__F_file_stream_open_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read.c b/level_0/f_file/tests/unit/c/test-file-stream_read.c
new file mode 100644 (file)
index 0000000..797d96f
--- /dev/null
@@ -0,0 +1,86 @@
+#include "test-file.h"
+#include "test-file-stream_read.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_read__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_read(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_read__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+
+    {
+      const f_status_t status = f_file_stream_read(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    file.size_read = 0;
+
+    {
+      const f_status_t status = f_file_stream_read(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+      const f_status_t status = f_file_stream_read(file, &string);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_read__returns_file_closed(void **state) {
+
+    const f_file_t file = f_file_t_initialize;
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_stream_read(file, &string);
+
+    assert_int_equal(F_status_set_fine(status), F_file_closed);
+  }
+}
+
+void test__f_file_stream_read__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_read();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read.h b/level_0/f_file/tests/unit/c/test-file-stream_read.h
new file mode 100644 (file)
index 0000000..5c88393
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_read_h
+#define _TEST__F_file_stream_read_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_read()
+ */
+extern void test__f_file_stream_read__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_read()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_read__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file stream is closed.
+ *
+ * @see f_file_stream_read()
+ */
+extern void test__f_file_stream_read__returns_file_closed(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_read()
+ */
+extern void test__f_file_stream_read__works(void **state);
+
+#endif // _TEST__F_file_stream_read_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_block.c b/level_0/f_file/tests/unit/c/test-file-stream_read_block.c
new file mode 100644 (file)
index 0000000..c1e6a98
--- /dev/null
@@ -0,0 +1,86 @@
+#include "test-file.h"
+#include "test-file-stream_read_block.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_read_block__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_read_block(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_read_block__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+
+    {
+      const f_status_t status = f_file_stream_read_block(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    file.size_read = 0;
+
+    {
+      const f_status_t status = f_file_stream_read_block(file, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+      const f_status_t status = f_file_stream_read_block(file, &string);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_read_block__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_stream_read_block(file, &string);
+
+    assert_int_equal(F_status_set_fine(status), F_file_closed);
+  }
+}
+
+void test__f_file_stream_read_block__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_read_block();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_block.h b/level_0/f_file/tests/unit/c/test-file-stream_read_block.h
new file mode 100644 (file)
index 0000000..aeea39f
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_read_block_h
+#define _TEST__F_file_stream_read_block_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_read_block()
+ */
+extern void test__f_file_stream_read_block__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_read_block()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_read_block__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file stream is closed.
+ *
+ * @see f_file_stream_read_block()
+ */
+extern void test__f_file_stream_read_block__returns_file_closed(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_read_block()
+ */
+extern void test__f_file_stream_read_block__works(void **state);
+
+#endif // _TEST__F_file_stream_read_block_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_until.c b/level_0/f_file/tests/unit/c/test-file-stream_read_until.c
new file mode 100644 (file)
index 0000000..4a1f318
--- /dev/null
@@ -0,0 +1,86 @@
+#include "test-file.h"
+#include "test-file-stream_read_until.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_read_until__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_read_until(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_read_until__parameter_checking(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+
+    {
+      const f_status_t status = f_file_stream_read_until(file, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    file.size_read = 0;
+
+    {
+      const f_status_t status = f_file_stream_read_until(file, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+      const f_status_t status = f_file_stream_read_until(file, 0, &string);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_read_until__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+
+  {
+    f_string_dynamic_t string = f_string_dynamic_t_initialize;
+
+    const f_status_t status = f_file_stream_read_until(file, 0, &string);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_stream_read_until__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_read_until();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_until.h b/level_0/f_file/tests/unit/c/test-file-stream_read_until.h
new file mode 100644 (file)
index 0000000..c7d811f
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_read_until_h
+#define _TEST__F_file_stream_read_until_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_read_until()
+ */
+extern void test__f_file_stream_read_until__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_read_until()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_read_until__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file stream is closed.
+ *
+ * @see f_file_stream_read_until()
+ */
+extern void test__f_file_stream_read_until__returns_file_closed(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_read_until()
+ */
+extern void test__f_file_stream_read_until__works(void **state);
+
+#endif // _TEST__F_file_stream_read_until_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_reopen.c b/level_0/f_file/tests/unit/c/test-file-stream_reopen.c
new file mode 100644 (file)
index 0000000..cf55fe7
--- /dev/null
@@ -0,0 +1,84 @@
+#include "test-file.h"
+#include "test-file-stream_reopen.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_reopen__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_reopen(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_reopen__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_stream_reopen(f_string_empty_s, f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_reopen__returns_data_not(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;
+
+    const f_status_t status = f_file_stream_reopen(f_string_empty_s, f_string_empty_s, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_file_t file = f_file_t_initialize;
+
+    const f_status_t status = f_file_stream_reopen(path, f_string_empty_s, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_file_t file = f_file_t_initialize;
+
+    const f_status_t status = f_file_stream_reopen(f_string_empty_s, path, &file);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_stream_reopen__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_reopen();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_reopen.h b/level_0/f_file/tests/unit/c/test-file-stream_reopen.h
new file mode 100644 (file)
index 0000000..abd5768
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_reopen_h
+#define _TEST__F_file_stream_reopen_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_reopen()
+ */
+extern void test__f_file_stream_reopen__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_reopen()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_reopen__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stream_reopen()
+ */
+extern void test__f_file_stream_reopen__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_reopen()
+ */
+extern void test__f_file_stream_reopen__works(void **state);
+
+#endif // _TEST__F_file_stream_reopen_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write.c b/level_0/f_file/tests/unit/c/test-file-stream_write.c
new file mode 100644 (file)
index 0000000..c2475bb
--- /dev/null
@@ -0,0 +1,91 @@
+#include "test-file.h"
+#include "test-file-stream_write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_write__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_write(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_write__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    {
+      const f_status_t status = f_file_stream_write(file, f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_write__returns_file_closed(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);
+  }
+}
+
+void test__f_file_stream_write__returns_data_not(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+  FILE file_stucture;
+  file.stream = &file_stucture;
+
+  {
+    const f_status_t status = f_file_stream_write(file, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write(file, f_string_empty_s, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_stream_write__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_write();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write.h b/level_0/f_file/tests/unit/c/test-file-stream_write.h
new file mode 100644 (file)
index 0000000..d28a941
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_write_h
+#define _TEST__F_file_stream_write_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_write()
+ */
+extern void test__f_file_stream_write__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_write()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_write__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file stream is closed.
+ *
+ * @see f_file_stream_write()
+ */
+extern void test__f_file_stream_write__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stream_write()
+ */
+extern void test__f_file_stream_write__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_write()
+ */
+extern void test__f_file_stream_write__works(void **state);
+
+#endif // _TEST__F_file_stream_write_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_block.c b/level_0/f_file/tests/unit/c/test-file-stream_write_block.c
new file mode 100644 (file)
index 0000000..7f1a142
--- /dev/null
@@ -0,0 +1,91 @@
+#include "test-file.h"
+#include "test-file-stream_write_block.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_write_block__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_write_block(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_write_block__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    {
+      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_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_write_block__returns_file_closed(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);
+  }
+}
+
+void test__f_file_stream_write_block__returns_data_not(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+  FILE file_stucture;
+  file.stream = &file_stucture;
+
+  {
+    const f_status_t status = f_file_stream_write_block(file, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write_block(file, f_string_empty_s, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_stream_write_block__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_write_block();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_block.h b/level_0/f_file/tests/unit/c/test-file-stream_write_block.h
new file mode 100644 (file)
index 0000000..0125d97
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_write_block_h
+#define _TEST__F_file_stream_write_block_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_write_block()
+ */
+extern void test__f_file_stream_write_block__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_write_block()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_write_block__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file stream is closed.
+ *
+ * @see f_file_stream_write_block()
+ */
+extern void test__f_file_stream_write_block__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stream_write_block()
+ */
+extern void test__f_file_stream_write_block__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_write_block()
+ */
+extern void test__f_file_stream_write_block__works(void **state);
+
+#endif // _TEST__F_file_stream_write_block_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_range.c b/level_0/f_file/tests/unit/c/test-file-stream_write_range.c
new file mode 100644 (file)
index 0000000..0307e24
--- /dev/null
@@ -0,0 +1,138 @@
+#include "test-file.h"
+#include "test-file-stream_write_range.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_write_range__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_write_range(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_write_range__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    const f_string_range_t range = f_string_range_t_initialize;
+
+    {
+      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_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_write_range__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+  const f_string_range_t range = f_string_range_t_initialize;
+
+  {
+    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);
+  }
+}
+
+void test__f_file_stream_write_range__returns_data_not(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+  FILE file_stucture;
+  file.stream = &file_stucture;
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+
+    const f_status_t status = f_file_stream_write_range(file, f_string_empty_s, range, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+    const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+    const f_status_t status = f_file_stream_write_range(file, path, range, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_string_range_t range = macro_f_string_range_t_initialize(0, 0);
+
+    const f_status_t status = f_file_stream_write_range(file, f_string_empty_s, range, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write_range(file, f_string_empty_s, range, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+    const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write_range(file, path, range, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    const f_string_range_t range = macro_f_string_range_t_initialize(0, 0);
+
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write_range(file, f_string_empty_s, range, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_stream_write_range__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_write_range();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_range.h b/level_0/f_file/tests/unit/c/test-file-stream_write_range.h
new file mode 100644 (file)
index 0000000..ac9d392
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_write_range_h
+#define _TEST__F_file_stream_write_range_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_write_range()
+ */
+extern void test__f_file_stream_write_range__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_write_range()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_write_range__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file stream is closed.
+ *
+ * @see f_file_stream_write_range()
+ */
+extern void test__f_file_stream_write_range__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stream_write_range()
+ */
+extern void test__f_file_stream_write_range__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_write_range()
+ */
+extern void test__f_file_stream_write_range__works(void **state);
+
+#endif // _TEST__F_file_stream_write_range_h
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_until.c b/level_0/f_file/tests/unit/c/test-file-stream_write_until.c
new file mode 100644 (file)
index 0000000..873ef8e
--- /dev/null
@@ -0,0 +1,124 @@
+#include "test-file.h"
+#include "test-file-stream_write_until.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_stream_write_until__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_stream_write_until(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_stream_write_until__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    {
+      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_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_stream_write_until__returns_file_closed(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+  file.stream = 0;
+
+  {
+    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);
+  }
+}
+
+void test__f_file_stream_write_until__returns_data_not(void **state) {
+
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  f_file_t file = f_file_t_initialize;
+  FILE file_stucture;
+  file.stream = &file_stucture;
+
+  {
+    const f_status_t status = f_file_stream_write_until(file, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_stream_write_until(file, path, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_stream_write_until(file, f_string_empty_s, 1, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write_until(file, f_string_empty_s, 0, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write_until(file, path, 0, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_stream_write_until(file, f_string_empty_s, 1, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_stream_write_until__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_stream_write_until();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-stream_write_until.h b/level_0/f_file/tests/unit/c/test-file-stream_write_until.h
new file mode 100644 (file)
index 0000000..48b9092
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_stream_write_until_h
+#define _TEST__F_file_stream_write_until_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_stream_write_until()
+ */
+extern void test__f_file_stream_write_until__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_stream_write_until()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_stream_write_until__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file stream is closed.
+ *
+ * @see f_file_stream_write_until()
+ */
+extern void test__f_file_stream_write_until__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_stream_write_until()
+ */
+extern void test__f_file_stream_write_until__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_stream_write_until()
+ */
+extern void test__f_file_stream_write_until__works(void **state);
+
+#endif // _TEST__F_file_stream_write_until_h
diff --git a/level_0/f_file/tests/unit/c/test-file-touch.c b/level_0/f_file/tests/unit/c/test-file-touch.c
new file mode 100644 (file)
index 0000000..c84b687
--- /dev/null
@@ -0,0 +1,196 @@
+#include "test-file.h"
+#include "test-file-touch.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_touch__fails(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_loop,
+      F_name,
+      F_memory_not,
+      F_file_not,
+      F_number_overflow,
+      F_file_stat,
+    };
+
+    for (int i = 0; i < 8; ++i) {
+
+      will_return(__wrap_stat, true);
+      will_return(__wrap_stat, errnos[i]);
+
+      const f_status_t status = f_file_touch(path, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      EMLINK,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_file_link_max,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_not,
+      F_prohibited,
+      F_read_only,
+      F_failure,
+    };
+
+    for (int i = 0; i < 15; ++i) {
+
+      will_return(__wrap_stat, true);
+      will_return(__wrap_stat, ENOENT);
+      will_return(__wrap_mkdir, true);
+      will_return(__wrap_mkdir, errnos[i]);
+
+      const f_status_t status = f_file_touch(path, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  } // for
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ESRCH,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_descriptor,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_file_not,
+      F_prohibited,
+      F_read_only,
+      F_search,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_directory_d;
+
+    for (int i = 0; i < 12; ++i) {
+
+      will_return(__wrap_stat, false);
+      will_return(__wrap_stat, &statistics);
+      will_return(__wrap_stat, 0);
+      will_return(__wrap_utimensat, true);
+      will_return(__wrap_utimensat, errnos[i]);
+
+      const f_status_t status = f_file_touch(path, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+  */
+}
+
+void test__f_file_touch__returns_data_not(void **state) {
+/*
+  {
+    const f_status_t status = f_file_touch(f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+  */
+}
+
+void test__f_file_touch__works(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_directory_d;
+
+    will_return(__wrap_stat, false);
+    will_return(__wrap_stat, &statistics);
+    will_return(__wrap_stat, 0);
+    will_return(__wrap_utimensat, false);
+    will_return(__wrap_utimensat, 0);
+
+    const f_status_t status = f_file_touch(path, 0);
+
+    assert_int_equal(status, F_none);
+  }
+
+  {
+    will_return(__wrap_stat, true);
+    will_return(__wrap_stat, ENOENT);
+    will_return(__wrap_mkdir, false);
+    will_return(__wrap_mkdir, 0);
+
+    const f_status_t status = f_file_touch(path, 0);
+
+    assert_int_equal(status, F_none);
+  }
+  */
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-touch.h b/level_0/f_file/tests/unit/c/test-file-touch.h
new file mode 100644 (file)
index 0000000..4759ede
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_touch_h
+#define _TEST__F_file_touch_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_touch()
+ */
+extern void test__f_file_touch__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_touch()
+ */
+extern void test__f_file_touch__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_touch()
+ */
+extern void test__f_file_touch__works(void **state);
+
+#endif // _TEST__F_file_touch_h
diff --git a/level_0/f_file/tests/unit/c/test-file-touch_at.c b/level_0/f_file/tests/unit/c/test-file-touch_at.c
new file mode 100644 (file)
index 0000000..3a7a72e
--- /dev/null
@@ -0,0 +1,196 @@
+#include "test-file.h"
+#include "test-file-touch_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_touch_at__fails(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    int errnos[] = {
+      EACCES,
+      EFAULT,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOMEM,
+      ENOTDIR,
+      EOVERFLOW,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_buffer,
+      F_loop,
+      F_name,
+      F_memory_not,
+      F_file_not,
+      F_number_overflow,
+      F_file_stat,
+    };
+
+    for (int i = 0; i < 8; ++i) {
+
+      will_return(__wrap_fstatat, true);
+      will_return(__wrap_fstatat, errnos[i]);
+
+      const f_status_t status = f_file_touch_at(1, path, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+
+  {
+    int errnos[] = {
+      EACCES,
+      EDQUOT,
+      EEXIST,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      EMLINK,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOMEM,
+      ENOSPC,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_filesystem_quota_block,
+      F_file_found,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_file_link_max,
+      F_name,
+      F_file_found_not,
+      F_memory_not,
+      F_space_not,
+      F_file_not,
+      F_prohibited,
+      F_read_only,
+      F_failure,
+    };
+
+    for (int i = 0; i < 15; ++i) {
+
+      will_return(__wrap_fstatat, true);
+      will_return(__wrap_fstatat, ENOENT);
+      will_return(__wrap_mkdirat, true);
+      will_return(__wrap_mkdirat, errnos[i]);
+
+      const f_status_t status = f_file_touch_at(1, path, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  } // for
+
+  {
+    int errnos[] = {
+      EACCES,
+      EBADF,
+      EFAULT,
+      EINVAL,
+      ELOOP,
+      ENAMETOOLONG,
+      ENOENT,
+      ENOTDIR,
+      EPERM,
+      EROFS,
+      ESRCH,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_access_denied,
+      F_file_descriptor,
+      F_buffer,
+      F_parameter,
+      F_loop,
+      F_name,
+      F_file_found_not,
+      F_file_not,
+      F_prohibited,
+      F_read_only,
+      F_search,
+      F_failure,
+    };
+
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_directory_d;
+
+    for (int i = 0; i < 12; ++i) {
+
+      will_return(__wrap_fstatat, false);
+      will_return(__wrap_fstatat, &statistics);
+      will_return(__wrap_fstatat, 0);
+      will_return(__wrap_utimensat, true);
+      will_return(__wrap_utimensat, errnos[i]);
+
+      const f_status_t status = f_file_touch_at(1, path, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  }
+  */
+}
+
+void test__f_file_touch_at__returns_data_not(void **state) {
+/*
+  {
+    const f_status_t status = f_file_touch_at(1, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+  */
+}
+
+void test__f_file_touch_at__works(void **state) {
+/*
+  const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+  {
+    struct stat statistics;
+
+    memset(&statistics, 0, sizeof (struct stat));
+
+    statistics.st_mode = 1 | F_file_type_directory_d;
+
+    will_return(__wrap_fstatat, false);
+    will_return(__wrap_fstatat, &statistics);
+    will_return(__wrap_fstatat, 0);
+    will_return(__wrap_utimensat, false);
+    will_return(__wrap_utimensat, 0);
+
+    const f_status_t status = f_file_touch_at(1, path, 0, 0);
+
+    assert_int_equal(status, F_none);
+  }
+
+  {
+    will_return(__wrap_fstatat, true);
+    will_return(__wrap_fstatat, ENOENT);
+    will_return(__wrap_mkdirat, false);
+    will_return(__wrap_mkdirat, 0);
+
+    const f_status_t status = f_file_touch_at(1, path, 0, 0);
+
+    assert_int_equal(status, F_none);
+  }
+  */
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-touch_at.h b/level_0/f_file/tests/unit/c/test-file-touch_at.h
new file mode 100644 (file)
index 0000000..eab869a
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_touch_at_h
+#define _TEST__F_file_touch_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_touch_at()
+ */
+extern void test__f_file_touch_at__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_touch_at()
+ */
+extern void test__f_file_touch_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_touch_at()
+ */
+extern void test__f_file_touch_at__works(void **state);
+
+#endif // _TEST__F_file_touch_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-type.c b/level_0/f_file/tests/unit/c/test-file-type.c
new file mode 100644 (file)
index 0000000..19dd554
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_type__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_type(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_type__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_type(f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_type__returns_data_not(void **state) {
+
+  {
+    int type = 0;
+
+    const f_status_t status = f_file_type(f_string_empty_s, &type);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_type__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_type();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-type.h b/level_0/f_file/tests/unit/c/test-file-type.h
new file mode 100644 (file)
index 0000000..da8004d
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_type_h
+#define _TEST__F_file_type_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_type()
+ */
+extern void test__f_file_type__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_type()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_type__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_type()
+ */
+extern void test__f_file_type__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_type()
+ */
+extern void test__f_file_type__works(void **state);
+
+#endif // _TEST__F_file_type_h
diff --git a/level_0/f_file/tests/unit/c/test-file-type_at.c b/level_0/f_file/tests/unit/c/test-file-type_at.c
new file mode 100644 (file)
index 0000000..bf9d700
--- /dev/null
@@ -0,0 +1,66 @@
+#include "test-file.h"
+#include "test-file-type_at.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_type_at__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_type_at(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_type_at__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_file_type_at(0, f_string_empty_s, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_type_at__returns_data_not(void **state) {
+
+  {
+    int type = 0;
+
+    const f_status_t status = f_file_type_at(0, f_string_empty_s, 0, &type);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_type_at__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_type_at();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-type_at.h b/level_0/f_file/tests/unit/c/test-file-type_at.h
new file mode 100644 (file)
index 0000000..69b0dc5
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_type_at_h
+#define _TEST__F_file_type_at_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_type_at()
+ */
+extern void test__f_file_type_at__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_type_at()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_type_at__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_type_at()
+ */
+extern void test__f_file_type_at__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_type_at()
+ */
+extern void test__f_file_type_at__works(void **state);
+
+#endif // _TEST__F_file_type_at_h
diff --git a/level_0/f_file/tests/unit/c/test-file-umask_get.c b/level_0/f_file/tests/unit/c/test-file-umask_get.c
new file mode 100644 (file)
index 0000000..c31f88d
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-umask_get.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_umask_get__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_umask_get(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_umask_get__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_umask_get(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_umask_get__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_umask_get();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-umask_get.h b/level_0/f_file/tests/unit/c/test-file-umask_get.h
new file mode 100644 (file)
index 0000000..664517e
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_umask_get_h
+#define _TEST__F_file_umask_get_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_umask_get()
+ */
+extern void test__f_file_umask_get__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_umask_get()
+ */
+extern void test__f_file_umask_get__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_umask_get()
+ */
+extern void test__f_file_umask_get__works(void **state);
+
+#endif // _TEST__F_file_umask_get_h
diff --git a/level_0/f_file/tests/unit/c/test-file-umask_set.c b/level_0/f_file/tests/unit/c/test-file-umask_set.c
new file mode 100644 (file)
index 0000000..1ba5e86
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-file.h"
+#include "test-file-umask_set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_umask_set__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_umask_set(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+void test__f_file_umask_set__returns_data_not(void **state) {
+
+  {
+    //const f_status_t status = f_file_umask_set(f_string_empty_s);
+
+    //assert_int_equal(status, F_data_not);
+  }
+}
+
+void test__f_file_umask_set__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_umask_set();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-umask_set.h b/level_0/f_file/tests/unit/c/test-file-umask_set.h
new file mode 100644 (file)
index 0000000..e177fdb
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_umask_set_h
+#define _TEST__F_file_umask_set_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_umask_set()
+ */
+extern void test__f_file_umask_set__fails(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_umask_set()
+ */
+extern void test__f_file_umask_set__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_umask_set()
+ */
+extern void test__f_file_umask_set__works(void **state);
+
+#endif // _TEST__F_file_umask_set_h
diff --git a/level_0/f_file/tests/unit/c/test-file-write.c b/level_0/f_file/tests/unit/c/test-file-write.c
new file mode 100644 (file)
index 0000000..4b1158e
--- /dev/null
@@ -0,0 +1,90 @@
+#include "test-file.h"
+#include "test-file-write.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_write__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_write(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_write__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    {
+      const f_status_t status = f_file_write(file, f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_write__returns_file_closed(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);
+  }
+}
+
+void test__f_file_write__returns_data_not(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+  file.id = 0;
+
+  {
+    const f_status_t status = f_file_write(file, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write(file, f_string_empty_s, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_write__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_write();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-write.h b/level_0/f_file/tests/unit/c/test-file-write.h
new file mode 100644 (file)
index 0000000..39f3fd9
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_write_h
+#define _TEST__F_file_write_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_write()
+ */
+extern void test__f_file_write__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_write()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_write__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file is closed.
+ *
+ * @see f_file_write()
+ */
+extern void test__f_file_write__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_write()
+ */
+extern void test__f_file_write__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_write()
+ */
+extern void test__f_file_write__works(void **state);
+
+#endif // _TEST__F_file_write_h
diff --git a/level_0/f_file/tests/unit/c/test-file-write_block.c b/level_0/f_file/tests/unit/c/test-file-write_block.c
new file mode 100644 (file)
index 0000000..a821e43
--- /dev/null
@@ -0,0 +1,90 @@
+#include "test-file.h"
+#include "test-file-write_block.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_write_block__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_write_block(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_write_block__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    {
+      const f_status_t status = f_file_write_block(file, f_string_empty_s, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_write_block__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+
+  {
+    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);
+  }
+}
+
+void test__f_file_write_block__returns_data_not(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+  file.id = 0;
+
+  {
+    const f_status_t status = f_file_write_block(file, f_string_empty_s, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write_block(file, f_string_empty_s, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_write_block__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_write_block();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-write_block.h b/level_0/f_file/tests/unit/c/test-file-write_block.h
new file mode 100644 (file)
index 0000000..efebb31
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_write_block_h
+#define _TEST__F_file_write_block_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_write_block()
+ */
+extern void test__f_file_write_block__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_write_block()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_write_block__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file is closed.
+ *
+ * @see f_file_write_block()
+ */
+extern void test__f_file_write_block__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_write_block()
+ */
+extern void test__f_file_write_block__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_write_block()
+ */
+extern void test__f_file_write_block__works(void **state);
+
+#endif // _TEST__F_file_write_block_h
diff --git a/level_0/f_file/tests/unit/c/test-file-write_range.c b/level_0/f_file/tests/unit/c/test-file-write_range.c
new file mode 100644 (file)
index 0000000..3ad8423
--- /dev/null
@@ -0,0 +1,137 @@
+#include "test-file.h"
+#include "test-file-write_range.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_write_range__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_write_range(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_write_range__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    const f_string_range_t range = f_string_range_t_initialize;
+
+    {
+      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_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_write_range__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+  const f_string_range_t range = f_string_range_t_initialize;
+
+  {
+    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);
+  }
+}
+
+void test__f_file_write_range__returns_data_not(void **state) {
+
+  f_file_t file = f_file_t_initialize;
+  file.id = 0;
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+
+    const f_status_t status = f_file_write_range(file, f_string_empty_s, range, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+    const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+    const f_status_t status = f_file_write_range(file, path, range, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_string_range_t range = macro_f_string_range_t_initialize(0, 0);
+
+    const f_status_t status = f_file_write_range(file, f_string_empty_s, range, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write_range(file, f_string_empty_s, range, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    const f_string_range_t range = f_string_range_t_initialize;
+    const f_string_static_t path = macro_f_string_static_t_initialize("test", 0, 4);
+
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write_range(file, path, range, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    const f_string_range_t range = macro_f_string_range_t_initialize(0, 0);
+
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write_range(file, f_string_empty_s, range, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_write_range__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_write_range();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-write_range.h b/level_0/f_file/tests/unit/c/test-file-write_range.h
new file mode 100644 (file)
index 0000000..ee6b223
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_write_range_h
+#define _TEST__F_file_write_range_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_write_range()
+ */
+extern void test__f_file_write_range__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_write_range()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_write_range__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file is closed.
+ *
+ * @see f_file_write_range()
+ */
+extern void test__f_file_write_range__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_write_range()
+ */
+extern void test__f_file_write_range__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_write_range()
+ */
+extern void test__f_file_write_range__works(void **state);
+
+#endif // _TEST__F_file_write_range_h
diff --git a/level_0/f_file/tests/unit/c/test-file-write_until.c b/level_0/f_file/tests/unit/c/test-file-write_until.c
new file mode 100644 (file)
index 0000000..70412e1
--- /dev/null
@@ -0,0 +1,122 @@
+#include "test-file.h"
+#include "test-file-write_until.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_file_write_until__fails(void **state) {
+
+  int errnos[] = {
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_failure,
+  };
+
+  for (int i = 0; i < 1; ++i) {
+
+    //will_return(__wrap_open, true);
+    //will_return(__wrap_open, errnos[i]);
+
+    //const f_status_t status = f_file_write_until(path, F_false, &id);
+
+    //assert_int_equal(F_status_set_fine(status), statuss[i]);
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_file_write_until__parameter_checking(void **state) {
+
+    f_file_t file = f_file_t_initialize;
+    file.size_write = 0;
+
+    {
+      const f_status_t status = f_file_write_until(file, f_string_empty_s, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_file_write_until__returns_file_closed(void **state) {
+
+  const f_file_t file = f_file_t_initialize;
+
+  {
+    const f_status_t status = f_file_write_until(file, f_string_empty_s, 0, 0);
+
+    assert_int_equal(F_status_set_fine(status), F_file_closed);
+  }
+}
+
+void test__f_file_write_until__returns_data_not(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;
+  file.id = 0;
+
+  {
+    const f_status_t status = f_file_write_until(file, f_string_empty_s, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_write_until(file, path, 0, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    const f_status_t status = f_file_write_until(file, f_string_empty_s, 1, 0);
+
+    assert_int_equal(status, F_data_not);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write_until(file, f_string_empty_s, 0, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write_until(file, path, 0, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+
+  {
+    f_array_length_t written = 1;
+
+    const f_status_t status = f_file_write_until(file, f_string_empty_s, 1, &written);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(written, 0);
+  }
+}
+
+void test__f_file_write_until__works(void **state) {
+
+  {
+    //will_return(__wrap_open, false);
+    //will_return(__wrap_open, 5);
+
+    //const f_status_t status = f_file_write_until();
+
+    //assert_int_equal(status, F_none);
+    //assert_int_equal(id, 5);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file-write_until.h b/level_0/f_file/tests/unit/c/test-file-write_until.h
new file mode 100644 (file)
index 0000000..03e9df7
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_write_until_h
+#define _TEST__F_file_write_until_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_file_write_until()
+ */
+extern void test__f_file_write_until__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_file_write_until()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_file_write_until__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works but the file is closed.
+ *
+ * @see f_file_write_until()
+ */
+extern void test__f_file_write_until__returns_file_closed(void **state);
+
+/**
+ * Test that function works but the path is empty.
+ *
+ * @see f_file_write_until()
+ */
+extern void test__f_file_write_until__returns_data_not(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_file_write_until()
+ */
+extern void test__f_file_write_until__works(void **state);
+
+#endif // _TEST__F_file_write_until_h
diff --git a/level_0/f_file/tests/unit/c/test-file.c b/level_0/f_file/tests/unit/c/test-file.c
new file mode 100644 (file)
index 0000000..1a00b1e
--- /dev/null
@@ -0,0 +1,344 @@
+#include "test-file.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int setup(void **state) {
+
+  return 0;
+}
+
+int setdown(void **state) {
+
+  errno = 0;
+
+  return 0;
+}
+
+int main(void) {
+
+  const struct CMUnitTest tests[] = {
+    cmocka_unit_test(test__f_file_access__fails),
+    cmocka_unit_test(test__f_file_access__returns_data_not),
+    cmocka_unit_test(test__f_file_access__works),
+
+    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__works),
+
+    cmocka_unit_test(test__f_file_clone__fails_during_read_write),
+    cmocka_unit_test(test__f_file_clone__fails_for_link),
+    cmocka_unit_test(test__f_file_clone__fails_for_other),
+    cmocka_unit_test(test__f_file_clone__fails_for_regular),
+    cmocka_unit_test(test__f_file_clone__returns_data_not),
+    cmocka_unit_test(test__f_file_clone__works_for_regular),
+    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__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),
+    cmocka_unit_test(test__f_file_copy__fails_for_character),
+    cmocka_unit_test(test__f_file_copy__fails_for_directory),
+    cmocka_unit_test(test__f_file_copy__fails_for_fifo),
+    cmocka_unit_test(test__f_file_copy__fails_for_link),
+    cmocka_unit_test(test__f_file_copy__fails_for_regular),
+    cmocka_unit_test(test__f_file_copy__fails_for_socket),
+    cmocka_unit_test(test__f_file_copy__returns_data_not),
+    cmocka_unit_test(test__f_file_copy__works_for_block),
+    cmocka_unit_test(test__f_file_copy__works_for_character),
+    cmocka_unit_test(test__f_file_copy__works_for_directory),
+    cmocka_unit_test(test__f_file_copy__works_for_fifo),
+    cmocka_unit_test(test__f_file_copy__works_for_link),
+    cmocka_unit_test(test__f_file_copy__works_for_regular),
+    cmocka_unit_test(test__f_file_copy__works_for_socket),
+
+    cmocka_unit_test(test__f_file_create__fails),
+    cmocka_unit_test(test__f_file_create__returns_data_not),
+    cmocka_unit_test(test__f_file_create__works),
+
+    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__works),
+
+    cmocka_unit_test(test__f_file_create_device__fails),
+    cmocka_unit_test(test__f_file_create_device__returns_data_not),
+    cmocka_unit_test(test__f_file_create_device__returns_supported_not),
+    cmocka_unit_test(test__f_file_create_device__works),
+
+    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_supported_not),
+    cmocka_unit_test(test__f_file_create_device_at__works),
+
+    cmocka_unit_test(test__f_file_create_fifo__fails),
+    cmocka_unit_test(test__f_file_create_fifo__returns_data_not),
+    cmocka_unit_test(test__f_file_create_fifo__works),
+
+    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__works),
+
+    cmocka_unit_test(test__f_file_create_node__fails),
+    cmocka_unit_test(test__f_file_create_node__returns_data_not),
+    cmocka_unit_test(test__f_file_create_node__returns_supported_not),
+    cmocka_unit_test(test__f_file_create_node__works),
+
+    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_supported_not),
+    cmocka_unit_test(test__f_file_create_node_at__works),
+/*
+    cmocka_unit_test(test__f_file_create__fails),
+    cmocka_unit_test(test__f_file_create__returns_data_not),
+    cmocka_unit_test(test__f_file_create__works),
+
+    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__works),
+
+    // f_file_create_device
+
+    // f_file_create_device_at
+
+    // f_file_descriptor
+
+    cmocka_unit_test(test__f_file_exists__fails),
+    cmocka_unit_test(test__f_file_exists__returns_data_not),
+    cmocka_unit_test(test__f_file_exists__returns_false),
+    cmocka_unit_test(test__f_file_exists__returns_true),
+
+    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_false),
+    cmocka_unit_test(test__f_file_exists_at__returns_true),
+
+    // f_file_flush
+
+    // f_file_group_read
+
+    cmocka_unit_test(test__f_file_is__fails),
+    cmocka_unit_test(test__f_file_is__returns_data_not),
+    cmocka_unit_test(test__f_file_is__returns_false),
+    cmocka_unit_test(test__f_file_is__returns_true),
+
+    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_false),
+    cmocka_unit_test(test__f_file_is_at__returns_true),
+
+    // f_file_link
+
+    // f_file_link_at
+
+    // f_file_link_hard
+
+    // f_file_link_hard_at
+
+    // f_file_link_read
+
+    // f_file_link_read_at
+
+    // f_file_mode_determine
+
+    // f_file_mode_from_string
+
+    // f_file_mode_read
+
+    // f_file_mode_read_at
+
+    // f_file_mode_set
+
+    // f_file_mode_set_at
+
+    // f_file_mode_to_mode
+
+    // f_file_name_base
+
+    // f_file_name_directory
+
+    cmocka_unit_test(test__f_file_open__fails),
+    cmocka_unit_test(test__f_file_open__returns_data_not),
+    cmocka_unit_test(test__f_file_open__works),
+
+    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__works),
+
+    // f_file_owner_read
+
+    // f_file_read
+
+    // f_file_read_block
+
+    // f_file_read_until
+
+    cmocka_unit_test(test__f_file_remove__fails),
+    cmocka_unit_test(test__f_file_remove__returns_data_not),
+    cmocka_unit_test(test__f_file_remove__works),
+
+    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__works),
+
+    // f_file_rename
+
+    // f_file_rename_at
+
+    // f_file_role_change
+
+    // f_file_role_change_at
+
+    // f_file_seek
+
+    // f_file_size
+
+    // f_file_size_at
+
+    // f_file_size_by_id
+
+    // f_file_stat
+
+    // f_file_stat_at
+
+    // f_file_stat_by_id
+
+    // f_file_stream_close
+
+    // f_file_stream_descriptor
+
+    // f_file_stream_open
+
+    // f_file_stream_read
+
+    // f_file_stream_read_block
+
+    // f_file_stream_read_until
+
+    // f_file_stream_reopen
+
+    // f_file_stream_write
+
+    // f_file_stream_write_block
+
+    // f_file_stream_write_until
+
+    // f_file_stream_write_range
+
+    cmocka_unit_test(test__f_file_touch__fails),
+    cmocka_unit_test(test__f_file_touch__returns_data_not),
+    cmocka_unit_test(test__f_file_touch__works),
+
+    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__works),
+
+    // f_file_type
+
+    // f_file_type_at
+
+    // f_file_umask_get
+
+    // f_file_umask_set
+
+    // f_file_write
+
+    // f_file_write_block
+
+    // f_file_write_until
+
+    // f_file_write_range
+*/
+    #ifndef _di_level_0_parameter_checking_
+      // f_file_access() doesn't use parameter checking.
+      // 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.
+      // f_file_create_device() doesn't use parameter checking.
+      // f_file_create_device_at() doesn't use parameter checking.
+      // f_file_create_fifo() doesn't use parameter checking.
+      // f_file_create_fifo_at() doesn't use parameter checking.
+      // f_file_create_node() doesn't use parameter checking.
+      // f_file_create_node_at() doesn't use parameter checking.
+      cmocka_unit_test(test__f_file_descriptor__parameter_checking),
+      // f_file_exists() doesn't use parameter checking.
+      // f_file_exists_at() doesn't use parameter checking.
+      // f_file_flush() doesn't use parameter checking.
+      cmocka_unit_test(test__f_file_group_read__parameter_checking),
+      // f_file_is() doesn't use parameter checking.
+      // f_file_is_at() doesn't use parameter checking.
+      // f_file_link() doesn't use parameter checking.
+      // f_file_link_at() doesn't use parameter checking.
+      // f_file_link_hard() doesn't use parameter checking.
+      // f_file_link_hard_at() doesn't use parameter checking.
+      cmocka_unit_test(test__f_file_link_read__parameter_checking),
+      cmocka_unit_test(test__f_file_link_read_at__parameter_checking),
+      cmocka_unit_test(test__f_file_mode_determine__parameter_checking),
+      cmocka_unit_test(test__f_file_mode_from_string__parameter_checking),
+      cmocka_unit_test(test__f_file_mode_read__parameter_checking),
+      cmocka_unit_test(test__f_file_mode_read_at__parameter_checking),
+      // f_file_mode_set() doesn't use parameter checking.
+      // f_file_mode_set_at() doesn't use parameter checking.
+      cmocka_unit_test(test__f_file_mode_to_mode__parameter_checking),
+      cmocka_unit_test(test__f_file_name_base__parameter_checking),
+      cmocka_unit_test(test__f_file_name_directory__parameter_checking),
+      cmocka_unit_test(test__f_file_open__parameter_checking),
+      cmocka_unit_test(test__f_file_open_at__parameter_checking),
+      cmocka_unit_test(test__f_file_owner_read__parameter_checking),
+      cmocka_unit_test(test__f_file_read__parameter_checking),
+      cmocka_unit_test(test__f_file_read_block__parameter_checking),
+      cmocka_unit_test(test__f_file_read_until__parameter_checking),
+      // f_file_remove() doesn't use parameter checking.
+      // f_file_remove_at() doesn't use parameter checking.
+      // f_file_rename() doesn't use parameter checking.
+      // f_file_rename_at() doesn't use parameter checking.
+      // f_file_role_change() doesn't use parameter checking.
+      // f_file_role_change_at() doesn't use parameter checking.
+      cmocka_unit_test(test__f_file_seek__parameter_checking),
+      cmocka_unit_test(test__f_file_size__parameter_checking),
+      cmocka_unit_test(test__f_file_size_at__parameter_checking),
+      cmocka_unit_test(test__f_file_size_by_id__parameter_checking),
+      cmocka_unit_test(test__f_file_stat__parameter_checking),
+      cmocka_unit_test(test__f_file_stat_at__parameter_checking),
+      cmocka_unit_test(test__f_file_stat_by_id__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_close__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_descriptor__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_open__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_read__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_read_block__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_read_until__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_reopen__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_write__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_write_block__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_write_until__parameter_checking),
+      cmocka_unit_test(test__f_file_stream_write_range__parameter_checking),
+      // f_file_touch() doesn't use parameter checking.
+      // f_file_touch_at() doesn't use parameter checking.
+      cmocka_unit_test(test__f_file_type__parameter_checking),
+      cmocka_unit_test(test__f_file_type_at__parameter_checking),
+      // f_file_umask_get() doesn't use parameter checking.
+      // f_file_umask_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_file_write__parameter_checking),
+      cmocka_unit_test(test__f_file_write_block__parameter_checking),
+      cmocka_unit_test(test__f_file_write_until__parameter_checking),
+      cmocka_unit_test(test__f_file_write_range__parameter_checking),
+    #endif // _di_level_0_parameter_checking_
+  };
+
+  return cmocka_run_group_tests(tests, setup, setdown);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_file/tests/unit/c/test-file.h b/level_0/f_file/tests/unit/c/test-file.h
new file mode 100644 (file)
index 0000000..1969b64
--- /dev/null
@@ -0,0 +1,147 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: File
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the file project.
+ */
+#ifndef _TEST__F_file_h
+#define _TEST__F_file_h
+
+// Libc includes.
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <stdint.h>
+
+// cmocka includes.
+#include <cmocka.h>
+
+// FLL-0 includes.
+#include <fll/level_0/file.h>
+
+// Mock includes.
+#include "mock-file.h"
+
+// Test includes.
+#include "test-file-access.h"
+#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"
+#include "test-file-create_device.h"
+#include "test-file-create_device_at.h"
+#include "test-file-create_fifo.h"
+#include "test-file-create_fifo_at.h"
+#include "test-file-create_node.h"
+#include "test-file-create_node_at.h"
+#include "test-file-descriptor.h"
+#include "test-file-exists.h"
+#include "test-file-exists_at.h"
+#include "test-file-flush.h"
+#include "test-file-group_read.h"
+#include "test-file-is.h"
+#include "test-file-is_at.h"
+#include "test-file-link.h"
+#include "test-file-link_at.h"
+#include "test-file-link_hard.h"
+#include "test-file-link_hard_at.h"
+#include "test-file-link_read.h"
+#include "test-file-link_read_at.h"
+#include "test-file-mode_determine.h"
+#include "test-file-mode_from_string.h"
+#include "test-file-mode_read.h"
+#include "test-file-mode_read_at.h"
+#include "test-file-mode_set.h"
+#include "test-file-mode_set_at.h"
+#include "test-file-mode_to_mode.h"
+#include "test-file-name_base.h"
+#include "test-file-name_directory.h"
+#include "test-file-open.h"
+#include "test-file-open_at.h"
+#include "test-file-owner_read.h"
+#include "test-file-read.h"
+#include "test-file-read_block.h"
+#include "test-file-read_until.h"
+#include "test-file-remove.h"
+#include "test-file-remove_at.h"
+#include "test-file-rename.h"
+#include "test-file-rename_at.h"
+#include "test-file-role_change.h"
+#include "test-file-role_change_at.h"
+#include "test-file-seek.h"
+#include "test-file-size.h"
+#include "test-file-size_at.h"
+#include "test-file-size_by_id.h"
+#include "test-file-stat.h"
+#include "test-file-stat_at.h"
+#include "test-file-stat_by_id.h"
+#include "test-file-stream_close.h"
+#include "test-file-stream_descriptor.h"
+#include "test-file-stream_open.h"
+#include "test-file-stream_read.h"
+#include "test-file-stream_read_block.h"
+#include "test-file-stream_read_until.h"
+#include "test-file-stream_reopen.h"
+#include "test-file-stream_write.h"
+#include "test-file-stream_write_block.h"
+#include "test-file-stream_write_until.h"
+#include "test-file-stream_write_range.h"
+#include "test-file-touch.h"
+#include "test-file-touch_at.h"
+#include "test-file-type.h"
+#include "test-file-type_at.h"
+#include "test-file-umask_get.h"
+#include "test-file-umask_set.h"
+#include "test-file-write.h"
+#include "test-file-write_block.h"
+#include "test-file-write_until.h"
+#include "test-file-write_range.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Perform any setup operations.
+ *
+ * @param state
+ *   The test state.
+ *
+ * @return
+ *   The status of this function, where 0 means success.
+ */
+extern int setup(void **state);
+
+/**
+ * Peform any setdown operations.
+ *
+ * @param state
+ *   The test state.
+ *
+ * @return
+ *   The status of this function, where 0 means success.
+ */
+extern int setdown(void **state);
+
+/**
+ * Run all tests.
+ *
+ * @return
+ *   The final result of the tests.
+ *
+ * @see cmocka_run_group_tests()
+ * @see cmocka_unit_test()
+ */
+extern int main(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _TEST__F_file_h