]> Kevux Git Server - fll/commitdiff
Update: Add unit tests for f_files_t and f_filess_t.
authorKevin Day <kevin@kevux.org>
Tue, 27 Jun 2023 02:41:15 +0000 (21:41 -0500)
committerKevin Day <kevin@kevux.org>
Tue, 27 Jun 2023 02:41:15 +0000 (21:41 -0500)
I forgot to add the unit tests with the commit fc1d33e993e99e8ff34d82be7fabadf7608d9c6d.

This also addresses a define name design problem where I have two cases that _F_type_array_file_h would be defined.
For now, just rename the _F_type_array_file_h to _F_type_array__file_h for the top-level file.

38 files changed:
level_0/f_type_array/c/type_array_file.h
level_0/f_type_array/data/build/settings-mocks
level_0/f_type_array/data/build/settings-tests
level_0/f_type_array/tests/unit/c/mock-type_array.h
level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_append.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_append.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_increase.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_increase.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_resize.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-files_resize.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_append.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_append.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.c [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.h [new file with mode: 0644]
level_0/f_type_array/tests/unit/c/test-type_array.c
level_0/f_type_array/tests/unit/c/test-type_array.h

index c7829b8fe0fa4c611fc104fa68a5dfd8abbbe8b6..df38550f188f5d9b836c813e8ffde2ab034f8861 100644 (file)
@@ -4,14 +4,9 @@
  * Project: Type
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
- *
- * Provides an extension to the Type project (f_type) that depends on f_memory (linking to the f_memory library).
- *
- * As an exceptional case, this is an extension to f_type to avoid circular dependency issues with f_memory.
- * The functions and macros in this project therefore are prefixed with 'f_type_' instead of 'f_type_array_'.
  */
-#ifndef _F_type_array_file_h
-#define _F_type_array_file_h
+#ifndef _F_type_array__file_h
+#define _F_type_array__file_h
 
 // FLL-0 includes.
 #include <fll/level_0/type.h>
@@ -30,4 +25,4 @@ extern "C" {
 } // extern "C"
 #endif
 
-#endif // _F_type_array_file_h
+#endif // _F_type_array__file_h
index 1f0f92025ad000e2b26e04ea8b7d5202ae5f97f6..be983b85c673355495604b1c3948b632ac69a528 100644 (file)
@@ -30,11 +30,11 @@ build_language c
 build_libraries -lc
 build_libraries-individual -lf_memory
 
-build_sources_library type_array/cell.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_unsigned.c type_array/poll.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c
-build_sources_library type_array/private-cell.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-number_unsigned.c type_array/private-poll.c type_array/private-state.c type_array/private-status.c type_array/private-uint8.c type_array/private-uint16.c type_array/private-uint32.c type_array/private-uint64.c type_array/private-uint128.c
+build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_unsigned.c type_array/poll.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c
+build_sources_library type_array/private-cell.c type_array/private-file.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-number_unsigned.c type_array/private-poll.c type_array/private-state.c type_array/private-status.c type_array/private-uint8.c type_array/private-uint16.c type_array/private-uint32.c type_array/private-uint64.c type_array/private-uint128.c
 build_sources_library ../../tests/unit/c/mock-type_array.c
 
-build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_unsigned.h type_array/poll.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h
+build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_unsigned.h type_array/poll.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h
 
 build_script yes
 build_shared yes
index 32bf164107a9d067ee93ddd69bf0188599e69e9d..bb0f84e993393930e2dd0e28fe822ae1d644ffe2 100644 (file)
@@ -23,6 +23,8 @@ build_language c
 build_libraries -lc -lcmocka
 build_libraries-individual -lf_memory -lf_type_array
 
+build_sources_program test-type_array-files_adjust.c test-type_array-files_append.c test-type_array-files_append_all.c test-type_array-files_decimate_by.c test-type_array-files_decrease_by.c test-type_array-files_increase.c test-type_array-files_increase_by.c test-type_array-files_resize.c
+build_sources_program test-type_array-filess_adjust.c test-type_array-filess_append.c test-type_array-filess_append_all.c test-type_array-filess_decimate_by.c test-type_array-filess_decrease_by.c test-type_array-filess_increase.c test-type_array-filess_increase_by.c test-type_array-filess_resize.c
 build_sources_program test-type_array-fll_ids_adjust.c test-type_array-fll_ids_append.c test-type_array-fll_ids_append_all.c test-type_array-fll_ids_decimate_by.c test-type_array-fll_ids_decrease_by.c test-type_array-fll_ids_increase.c test-type_array-fll_ids_increase_by.c test-type_array-fll_ids_resize.c
 build_sources_program test-type_array-fll_idss_adjust.c test-type_array-fll_idss_append.c test-type_array-fll_idss_append_all.c test-type_array-fll_idss_decimate_by.c test-type_array-fll_idss_decrease_by.c test-type_array-fll_idss_increase.c test-type_array-fll_idss_increase_by.c test-type_array-fll_idss_resize.c
 build_sources_program test-type_array-cells_adjust.c test-type_array-cells_append.c test-type_array-cells_append_all.c test-type_array-cells_decimate_by.c test-type_array-cells_decrease_by.c test-type_array-cells_increase.c test-type_array-cells_increase_by.c test-type_array-cells_resize.c
index 534130c63948af62f71236b5042269fc1d184c8d..061feda88173778af5cb2bcb65914fe75e0ce22e 100644 (file)
@@ -22,6 +22,7 @@
 // FLL-0 includes.
 #include <fll/level_0/type.h>
 #include <fll/level_0/type_array.h>
+#include <fll/level_0/type_array_file.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.c
new file mode 100644 (file)
index 0000000..2898b85
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-type_array.h"
+#include "test-type_array-files_adjust.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_adjust__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_adjust(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_files_adjust__works(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_adjust(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.h
new file mode 100644 (file)
index 0000000..29d4b64
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_adjust
+#define _TEST__F_type_array__files_adjust
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_adjust()
+ */
+extern void test__f_type_array_files_adjust__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_adjust()
+ */
+extern void test__f_type_array_files_adjust__works(void **state);
+
+#endif // _TEST__F_type_array__files_adjust
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_append.c
new file mode 100644 (file)
index 0000000..60e088c
--- /dev/null
@@ -0,0 +1,37 @@
+#include "test-type_array.h"
+#include "test-type_array-files_append.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_append__parameter_checking(void **state) {
+
+  const f_file_t data = f_file_t_initialize;
+
+  {
+    const f_status_t status = f_files_append(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_type_array_files_append__works(void **state) {
+
+  const f_file_t source = macro_f_file_t_initialize_id(3);
+  f_files_t destination = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_append(source, &destination);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(destination.used, 1);
+    assert_int_equal(destination.array[0].id, source.id);
+  }
+
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_append.h
new file mode 100644 (file)
index 0000000..7df88b9
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_append
+#define _TEST__F_type_array__files_append
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_append()
+ */
+extern void test__f_type_array_files_append__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_append()
+ */
+extern void test__f_type_array_files_append__works(void **state);
+
+#endif // _TEST__F_type_array__files_append
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.c
new file mode 100644 (file)
index 0000000..24a87b1
--- /dev/null
@@ -0,0 +1,82 @@
+#include "test-type_array.h"
+#include "test-type_array-files_append_all.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_append_all__parameter_checking(void **state) {
+
+  const f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_append_all(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_type_array_files_append_all__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_files_t source = f_files_t_initialize;
+  f_files_t destination = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &source);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(source.used, 0);
+    assert_int_equal(source.size, length);
+  }
+
+  {
+    const f_status_t status = f_files_append_all(source, &destination);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(destination.used, 0);
+    assert_int_equal(destination.size, 0);
+    assert_null(destination.array);
+  }
+
+  free((void *) source.array);
+}
+
+void test__f_type_array_files_append_all__works(void **state) {
+
+  const int length = 5;
+  const int length_used = 2;
+  f_files_t source = f_files_t_initialize;
+  f_files_t destination = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &source);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(source.used, 0);
+    assert_int_equal(source.size, length);
+  }
+
+  for (; source.used < length_used; ++source.used) {
+    source.array[source.used].id = source.used + 1;
+  } // for
+
+  {
+    const f_status_t status = f_files_append_all(source, &destination);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(destination.used, source.used);
+    assert_int_equal(destination.size, source.used);
+
+    for (f_number_unsigned_t i = 0; i < source.used; ++i) {
+      assert_int_equal(destination.array[i].id, i + 1);
+    } // for
+  }
+
+  free((void *) source.array);
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.h
new file mode 100644 (file)
index 0000000..fa8e3e2
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_append_all
+#define _TEST__F_type_array__files_append_all
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_append_all()
+ */
+extern void test__f_type_array_files_append_all__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_files_append_all()
+ */
+extern void test__f_type_array_files_append_all__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_append_all()
+ */
+extern void test__f_type_array_files_append_all__works(void **state);
+
+#endif // _TEST__F_type_array__files_append_all
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.c
new file mode 100644 (file)
index 0000000..52b8819
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-type_array.h"
+#include "test-type_array-files_decimate_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_decimate_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_decimate_by(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_files_decimate_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_files_decimate_by(0, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_files_decimate_by__works(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_files_decimate_by(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.h
new file mode 100644 (file)
index 0000000..82bee2a
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_decimate_by
+#define _TEST__F_type_array__files_decimate_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_decimate_by()
+ */
+extern void test__f_type_array_files_decimate_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_files_decimate_by()
+ */
+extern void test__f_type_array_files_decimate_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_decimate_by()
+ */
+extern void test__f_type_array_files_decimate_by__works(void **state);
+
+#endif // _TEST__F_type_array__files_decimate_by
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.c
new file mode 100644 (file)
index 0000000..7ecbe8b
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-type_array.h"
+#include "test-type_array-files_decrease_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_decrease_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_decrease_by(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_files_decrease_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_files_decrease_by(0, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_files_decrease_by__works(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_files_decrease_by(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.h
new file mode 100644 (file)
index 0000000..7fe8db3
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_decrease_by
+#define _TEST__F_type_array__files_decrease_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_decrease_by()
+ */
+extern void test__f_type_array_files_decrease_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_files_decrease_by()
+ */
+extern void test__f_type_array_files_decrease_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_decrease_by()
+ */
+extern void test__f_type_array_files_decrease_by__works(void **state);
+
+#endif // _TEST__F_type_array__files_decrease_by
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.c
new file mode 100644 (file)
index 0000000..8801f67
--- /dev/null
@@ -0,0 +1,76 @@
+#include "test-type_array.h"
+#include "test-type_array-files_increase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_increase__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_increase(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_files_increase__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_files_increase(length, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_files_increase__works(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    data.used = length;
+
+    const f_status_t status = f_files_increase(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, length);
+    assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.h
new file mode 100644 (file)
index 0000000..7c3adca
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_increase
+#define _TEST__F_type_array__files_increase
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_increase()
+ */
+extern void test__f_type_array_files_increase__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_files_increase()
+ */
+extern void test__f_type_array_files_increase__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_increase()
+ */
+extern void test__f_type_array_files_increase__works(void **state);
+
+#endif // _TEST__F_type_array__files_increase
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.c
new file mode 100644 (file)
index 0000000..8efbf25
--- /dev/null
@@ -0,0 +1,76 @@
+#include "test-type_array.h"
+#include "test-type_array-files_increase_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_increase_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_increase_by(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_files_increase_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_files_increase_by(0, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_files_increase_by__works(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    data.used = length;
+
+    const f_status_t status = f_files_increase_by(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, length);
+    assert_int_equal(data.size, length * 2);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.h
new file mode 100644 (file)
index 0000000..e7a6dbc
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_increase_by
+#define _TEST__F_type_array__files_increase_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_increase_by()
+ */
+extern void test__f_type_array_files_increase_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_files_increase_by()
+ */
+extern void test__f_type_array_files_increase_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_increase_by()
+ */
+extern void test__f_type_array_files_increase_by__works(void **state);
+
+#endif // _TEST__F_type_array__files_increase_by
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.c
new file mode 100644 (file)
index 0000000..8777148
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-type_array.h"
+#include "test-type_array-files_resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_files_resize__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_files_resize__works(void **state) {
+
+  const int length = 5;
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.h
new file mode 100644 (file)
index 0000000..f62e6e1
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__files_resize
+#define _TEST__F_type_array__files_resize
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_files_resize()
+ */
+extern void test__f_type_array_files_resize__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_files_resize()
+ */
+extern void test__f_type_array_files_resize__works(void **state);
+
+#endif // _TEST__F_type_array__files_resize
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.c
new file mode 100644 (file)
index 0000000..ea5b088
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_adjust.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_adjust__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_adjust(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_filess_adjust__works(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_adjust(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.h
new file mode 100644 (file)
index 0000000..e281823
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_adjust
+#define _TEST__F_type_array__filess_adjust
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_adjust()
+ */
+extern void test__f_type_array_filess_adjust__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_adjust()
+ */
+extern void test__f_type_array_filess_adjust__works(void **state);
+
+#endif // _TEST__F_type_array__filess_adjust
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.c
new file mode 100644 (file)
index 0000000..09b483d
--- /dev/null
@@ -0,0 +1,86 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_append.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_append__parameter_checking(void **state) {
+
+  f_files_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_filess_append(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_type_array_filess_append__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_files_t source = f_files_t_initialize;
+  f_filess_t destination = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &source);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(source.used, 0);
+    assert_int_equal(source.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_append(source, &destination);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(destination.used, 0);
+    assert_int_equal(destination.size, 0);
+    assert_null(destination.array);
+  }
+
+  free((void *) source.array);
+}
+
+void test__f_type_array_filess_append__works(void **state) {
+
+  const int length = 5;
+  f_files_t source = f_files_t_initialize;
+  f_filess_t destination = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_files_resize(length, &source);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(source.used, 0);
+    assert_int_equal(source.size, length);
+  }
+
+  for (; source.used < length; ++source.used) {
+    source.array[source.used].id = source.used + 1;
+  } // for
+
+  {
+    const f_status_t status = f_filess_append(source, &destination);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(destination.used, 1);
+    assert_int_equal(destination.array[0].used, source.used);
+    assert_int_equal(destination.array[0].size, source.used);
+
+    for (f_number_unsigned_t i = 0; i < destination.array[0].used; ++i) {
+      assert_int_equal(destination.array[0].array[i].id, i + 1);
+    } // for
+  }
+
+  for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
+    free((void *) destination.array[i].array);
+  } // for
+
+  free((void *) source.array);
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.h
new file mode 100644 (file)
index 0000000..45b7e7c
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_append
+#define _TEST__F_type_array__filess_append
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_append()
+ */
+extern void test__f_type_array_filess_append__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_filess_append()
+ */
+extern void test__f_type_array_filess_append__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_append()
+ */
+extern void test__f_type_array_filess_append__works(void **state);
+
+#endif // _TEST__F_type_array__filess_append
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.c
new file mode 100644 (file)
index 0000000..13a23b6
--- /dev/null
@@ -0,0 +1,105 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_append_all.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_append_all__parameter_checking(void **state) {
+
+  const f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_append_all(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_type_array_filess_append_all__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_filess_t source = f_filess_t_initialize;
+  f_filess_t destination = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &source);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(source.used, 0);
+    assert_int_equal(source.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_append_all(source, &destination);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(destination.used, 0);
+    assert_int_equal(destination.size, 0);
+    assert_null(destination.array);
+  }
+
+  free((void *) source.array);
+}
+
+void test__f_type_array_filess_append_all__works(void **state) {
+
+  const int length = 5;
+  const int length_inner = 2;
+  f_filess_t source = f_filess_t_initialize;
+  f_filess_t destination = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &source);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(source.used, 0);
+    assert_int_equal(source.size, length);
+  }
+
+  {
+    for (; source.used < length; ++source.used) {
+
+      const f_status_t status = f_files_resize(length_inner, &source.array[source.used]);
+
+      assert_int_equal(status, F_none);
+
+      for (f_number_unsigned_t i = 0; i < length_inner; ++i) {
+        source.array[source.used].array[source.array[source.used].used++].id = i + 1;
+      } // for
+    } // for
+  }
+
+  {
+    const f_status_t status = f_filess_append_all(source, &destination);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(destination.used, source.used);
+    assert_int_equal(destination.size, source.used);
+
+    for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
+
+      assert_int_equal(destination.array[i].used, length_inner);
+      assert_int_equal(destination.array[i].size, length_inner);
+
+      for (f_number_unsigned_t j = 0; j < length_inner; ++j) {
+        assert_int_equal(destination.array[i].array[j].id, j + 1);
+      } // for
+    } // for
+  }
+
+  for (f_number_unsigned_t i = 0; i < source.used; ++i) {
+    free((void *) source.array[i].array);
+  } // for
+
+  for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
+    free((void *) destination.array[i].array);
+  } // for
+
+  free((void *) source.array);
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.h
new file mode 100644 (file)
index 0000000..c4a9815
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_append_all
+#define _TEST__F_type_array__filess_append_all
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_append_all()
+ */
+extern void test__f_type_array_filess_append_all__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_filess_append_all()
+ */
+extern void test__f_type_array_filess_append_all__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_append_all()
+ */
+extern void test__f_type_array_filess_append_all__works(void **state);
+
+#endif // _TEST__F_type_array__filess_append_all
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.c
new file mode 100644 (file)
index 0000000..b980a1a
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_decimate_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_decimate_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_decimate_by(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_filess_decimate_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_decimate_by(0, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_filess_decimate_by__works(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_decimate_by(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.h
new file mode 100644 (file)
index 0000000..e2ff0f0
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_decimate_by
+#define _TEST__F_type_array__filess_decimate_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_decimate_by()
+ */
+extern void test__f_type_array_filess_decimate_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_type_array_filess_decimate_by()
+ */
+extern void test__f_type_array_filess_decimate_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_decimate_by()
+ */
+extern void test__f_type_array_filess_decimate_by__works(void **state);
+
+#endif // _TEST__F_type_array__filess_decimate_by
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.c
new file mode 100644 (file)
index 0000000..a656bd6
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_decrease_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_decrease_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_decrease_by(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_filess_decrease_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_decrease_by(0, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_filess_decrease_by__works(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_decrease_by(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.h
new file mode 100644 (file)
index 0000000..816a091
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_decrease_by
+#define _TEST__F_type_array__filess_decrease_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_decrease_by()
+ */
+extern void test__f_type_array_filess_decrease_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_filess_decrease_by()
+ */
+extern void test__f_type_array_filess_decrease_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_decrease_by()
+ */
+extern void test__f_type_array_filess_decrease_by__works(void **state);
+
+#endif // _TEST__F_type_array__filess_decrease_by
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.c
new file mode 100644 (file)
index 0000000..5a12a45
--- /dev/null
@@ -0,0 +1,76 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_increase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_increase__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_files_t_initialize;
+
+  {
+    const f_status_t status = f_filess_increase(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_filess_increase__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_increase(length, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_filess_increase__works(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    data.used = length;
+
+    const f_status_t status = f_filess_increase(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, length);
+    assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.h
new file mode 100644 (file)
index 0000000..0901222
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_increase
+#define _TEST__F_type_array__filess_increase
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_increase()
+ */
+extern void test__f_type_array_filess_increase__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_filess_increase()
+ */
+extern void test__f_type_array_filess_increase__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_increase()
+ */
+extern void test__f_type_array_filess_increase__works(void **state);
+
+#endif // _TEST__F_type_array__filess_increase
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.c
new file mode 100644 (file)
index 0000000..65b56e5
--- /dev/null
@@ -0,0 +1,84 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_increase_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_increase_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_increase_by(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_filess_increase_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_increase_by(0, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    const f_status_t status = f_filess_increase_by(length, &data);
+
+    assert_int_equal(status, F_data_not);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+void test__f_type_array_filess_increase_by__works(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  {
+    data.used = length;
+
+    const f_status_t status = f_filess_increase_by(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, length);
+    assert_int_equal(data.size, length * 2);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.h
new file mode 100644 (file)
index 0000000..e549585
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_increase_by
+#define _TEST__F_type_array__filess_increase_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_increase_by()
+ */
+extern void test__f_type_array_filess_increase_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not.
+ *
+ * @see f_filess_increase_by()
+ */
+extern void test__f_type_array_filess_increase_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_increase_by()
+ */
+extern void test__f_type_array_filess_increase_by__works(void **state);
+
+#endif // _TEST__F_type_array__filess_increase_by
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.c
new file mode 100644 (file)
index 0000000..2323ae6
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-type_array.h"
+#include "test-type_array-filess_resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_type_array_filess_resize__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, 0);
+  }
+
+  assert_null(data.array);
+}
+
+void test__f_type_array_filess_resize__works(void **state) {
+
+  const int length = 5;
+  f_filess_t data = f_filess_t_initialize;
+
+  {
+    const f_status_t status = f_filess_resize(length, &data);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(data.used, 0);
+    assert_int_equal(data.size, length);
+  }
+
+  free((void *) data.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.h
new file mode 100644 (file)
index 0000000..e2e0472
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_type_array__filess_resize
+#define _TEST__F_type_array__filess_resize
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_filess_resize()
+ */
+extern void test__f_type_array_filess_resize__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_filess_resize()
+ */
+extern void test__f_type_array_filess_resize__works(void **state);
+
+#endif // _TEST__F_type_array__filess_resize
index 85f92ea374edcc27dc5e1330f3862d6d75be1ba3..d87b729c4e61cb0504afe213b85a42e637861aac 100644 (file)
@@ -48,6 +48,37 @@ int main(void) {
     cmocka_unit_test(test__f_type_array_cellss_increase_by__works),
     cmocka_unit_test(test__f_type_array_cellss_resize__works),
 
+    cmocka_unit_test(test__f_type_array_files_append_all__returns_data_not),
+    cmocka_unit_test(test__f_type_array_files_decimate_by__returns_data_not),
+    cmocka_unit_test(test__f_type_array_files_decrease_by__returns_data_not),
+    cmocka_unit_test(test__f_type_array_files_increase__returns_data_not),
+    cmocka_unit_test(test__f_type_array_files_increase_by__returns_data_not),
+
+    cmocka_unit_test(test__f_type_array_files_adjust__works),
+    cmocka_unit_test(test__f_type_array_files_append__works),
+    cmocka_unit_test(test__f_type_array_files_append_all__works),
+    cmocka_unit_test(test__f_type_array_files_decimate_by__works),
+    cmocka_unit_test(test__f_type_array_files_decrease_by__works),
+    cmocka_unit_test(test__f_type_array_files_increase__works),
+    cmocka_unit_test(test__f_type_array_files_increase_by__works),
+    cmocka_unit_test(test__f_type_array_files_resize__works),
+
+    cmocka_unit_test(test__f_type_array_filess_append__returns_data_not),
+    cmocka_unit_test(test__f_type_array_filess_append_all__returns_data_not),
+    cmocka_unit_test(test__f_type_array_filess_decimate_by__returns_data_not),
+    cmocka_unit_test(test__f_type_array_filess_decrease_by__returns_data_not),
+    cmocka_unit_test(test__f_type_array_filess_increase__returns_data_not),
+    cmocka_unit_test(test__f_type_array_filess_increase_by__returns_data_not),
+
+    cmocka_unit_test(test__f_type_array_filess_adjust__works),
+    cmocka_unit_test(test__f_type_array_filess_append__works),
+    cmocka_unit_test(test__f_type_array_filess_append_all__works),
+    cmocka_unit_test(test__f_type_array_filess_decimate_by__works),
+    cmocka_unit_test(test__f_type_array_filess_decrease_by__works),
+    cmocka_unit_test(test__f_type_array_filess_increase__works),
+    cmocka_unit_test(test__f_type_array_filess_increase_by__works),
+    cmocka_unit_test(test__f_type_array_filess_resize__works),
+
     cmocka_unit_test(test__f_type_array_fll_ids_append_all__returns_data_not),
     cmocka_unit_test(test__f_type_array_fll_ids_decimate_by__returns_data_not),
     cmocka_unit_test(test__f_type_array_fll_ids_decrease_by__returns_data_not),
@@ -549,6 +580,24 @@ int main(void) {
       cmocka_unit_test(test__f_type_array_cellss_increase_by__parameter_checking),
       cmocka_unit_test(test__f_type_array_cellss_resize__parameter_checking),
 
+      cmocka_unit_test(test__f_type_array_files_adjust__parameter_checking),
+      cmocka_unit_test(test__f_type_array_files_append__parameter_checking),
+      cmocka_unit_test(test__f_type_array_files_append_all__parameter_checking),
+      cmocka_unit_test(test__f_type_array_files_decimate_by__parameter_checking),
+      cmocka_unit_test(test__f_type_array_files_decrease_by__parameter_checking),
+      cmocka_unit_test(test__f_type_array_files_increase__parameter_checking),
+      cmocka_unit_test(test__f_type_array_files_increase_by__parameter_checking),
+      cmocka_unit_test(test__f_type_array_files_resize__parameter_checking),
+
+      cmocka_unit_test(test__f_type_array_filess_adjust__parameter_checking),
+      cmocka_unit_test(test__f_type_array_filess_append__parameter_checking),
+      cmocka_unit_test(test__f_type_array_filess_append_all__parameter_checking),
+      cmocka_unit_test(test__f_type_array_filess_decimate_by__parameter_checking),
+      cmocka_unit_test(test__f_type_array_filess_decrease_by__parameter_checking),
+      cmocka_unit_test(test__f_type_array_filess_increase__parameter_checking),
+      cmocka_unit_test(test__f_type_array_filess_increase_by__parameter_checking),
+      cmocka_unit_test(test__f_type_array_filess_resize__parameter_checking),
+
       cmocka_unit_test(test__f_type_array_fll_ids_adjust__parameter_checking),
       cmocka_unit_test(test__f_type_array_fll_ids_append__parameter_checking),
       cmocka_unit_test(test__f_type_array_fll_ids_append_all__parameter_checking),
index e7f228af972fb0e16ef26c1d1ec2e8bc216d986f..2018c6c2c85a8c6e4583745b7dd525423b667b50 100644 (file)
 #include "test-type_array-cellss_increase.h"
 #include "test-type_array-cellss_increase_by.h"
 #include "test-type_array-cellss_resize.h"
+#include "test-type_array-files_adjust.h"
+#include "test-type_array-files_append.h"
+#include "test-type_array-files_append_all.h"
+#include "test-type_array-files_decimate_by.h"
+#include "test-type_array-files_decrease_by.h"
+#include "test-type_array-files_increase.h"
+#include "test-type_array-files_increase_by.h"
+#include "test-type_array-files_resize.h"
+#include "test-type_array-filess_adjust.h"
+#include "test-type_array-filess_append.h"
+#include "test-type_array-filess_append_all.h"
+#include "test-type_array-filess_decimate_by.h"
+#include "test-type_array-filess_decrease_by.h"
+#include "test-type_array-filess_increase.h"
+#include "test-type_array-filess_increase_by.h"
+#include "test-type_array-filess_resize.h"
 #include "test-type_array-fll_ids_adjust.h"
 #include "test-type_array-fll_ids_append.h"
 #include "test-type_array-fll_ids_append_all.h"