]> Kevux Git Server - fll/commitdiff
Update: Add unit tests for f_limit.
authorKevin Day <thekevinday@gmail.com>
Sun, 15 May 2022 00:59:38 +0000 (19:59 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 15 May 2022 00:59:38 +0000 (19:59 -0500)
70 files changed:
level_0/f_limit/tests/unit/c/mock-limit.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/mock-limit.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-process.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-process.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_adjust.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_adjust.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_append.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_append.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_append_all.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_decimate_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_decimate_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_decrease_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_decrease_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_increase.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_increase.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_increase_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_increase_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_resize.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-sets_resize.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_adjust.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_adjust.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_append.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_append.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_append_all.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_increase.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_increase.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_resize.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-setss_resize.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_adjust.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_adjust.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_append.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_append.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_append_all.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_append_all.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_decimate_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_decimate_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_decrease_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_decrease_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_increase.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_increase.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_increase_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_increase_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_resize.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-values_resize.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_adjust.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_adjust.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_append.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_append.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_increase.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_resize.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit-valuess_resize.h [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit.c [new file with mode: 0644]
level_0/f_limit/tests/unit/c/test-limit.h [new file with mode: 0644]

diff --git a/level_0/f_limit/tests/unit/c/mock-limit.c b/level_0/f_limit/tests/unit/c/mock-limit.c
new file mode 100644 (file)
index 0000000..264a198
--- /dev/null
@@ -0,0 +1,29 @@
+#include "mock-limit.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __wrap_prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit) {
+
+  const bool failure = mock_type(bool);
+
+  if (failure) {
+    errno = mock_type(int);
+
+    return -1;
+  }
+
+  if (old_limit) {
+    struct rlimit *mocked_limit = mock_type(struct rlimit *);
+
+    old_limit->rlim_cur = mocked_limit->rlim_cur;
+    old_limit->rlim_max = mocked_limit->rlim_max;
+  }
+
+  return mock_type(int);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_limit/tests/unit/c/mock-limit.h b/level_0/f_limit/tests/unit/c/mock-limit.h
new file mode 100644 (file)
index 0000000..28ec1e5
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the limit project.
+ */
+#ifndef _MOCK__limit_h
+#define _MOCK__limit_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/limit.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const static int mock_errno_generic = 32767;
+
+extern int __wrap_prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _MOCK__limit_h
diff --git a/level_0/f_limit/tests/unit/c/test-limit-process.c b/level_0/f_limit/tests/unit/c/test-limit-process.c
new file mode 100644 (file)
index 0000000..57deb85
--- /dev/null
@@ -0,0 +1,70 @@
+#include "test-limit.h"
+#include "test-limit-process.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_process__fails(void **state) {
+
+  const f_limit_value_t value = f_limit_value_t_initialize;
+
+  int errnos[] = {
+    EFAULT,
+    EINVAL,
+    EPERM,
+    ESRCH,
+    mock_errno_generic,
+  };
+
+  f_status_t statuss[] = {
+    F_address_not,
+    F_parameter,
+    F_prohibited,
+    F_found_not,
+    F_failure,
+  };
+
+  for (int i = 0; i < 5; ++i) {
+
+    will_return(__wrap_prlimit, true);
+    will_return(__wrap_prlimit, errnos[i]);
+
+    const f_status_t status = f_limit_process(1, 1, &value, 0);
+
+    assert_int_equal(status, F_status_set_error(statuss[i]));
+  } // for
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_limit_process__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_limit_process(1, 1, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_limit_process__works(void **state) {
+
+  const f_limit_value_t value = macro_f_limit_value_t_initialize(1, 2);
+  f_limit_value_t destination = f_limit_value_t_initialize;
+
+  {
+    will_return(__wrap_prlimit, F_false);
+    will_return(__wrap_prlimit, &value);
+    will_return(__wrap_prlimit, 0);
+
+    const f_status_t status = f_limit_process(1, 1, &value, &destination);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(destination.rlim_cur, value.rlim_cur);
+    assert_int_equal(destination.rlim_max, value.rlim_max);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_limit/tests/unit/c/test-limit-process.h b/level_0/f_limit/tests/unit/c/test-limit-process.h
new file mode 100644 (file)
index 0000000..783f618
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the limit project.
+ */
+#ifndef _TEST__F_limit_process_h
+#define _TEST__F_limit_process_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_limit_process()
+ */
+extern void test__f_limit_process__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_limit_process()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_limit_process__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_limit_process()
+ */
+extern void test__f_limit_process__works(void **state);
+
+#endif // _TEST__F_limit_process_h
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_adjust.c b/level_0/f_limit/tests/unit/c/test-limit-sets_adjust.c
new file mode 100644 (file)
index 0000000..15d9275
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-sets_adjust.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_adjust__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_adjust__works(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit/tests/unit/c/test-limit-sets_adjust.h b/level_0/f_limit/tests/unit/c/test-limit-sets_adjust.h
new file mode 100644 (file)
index 0000000..a9f2f05
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_adjust
+#define _TEST__F_limit__sets_adjust
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_adjust()
+ */
+extern void test__f_limit_sets_adjust__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_adjust()
+ */
+extern void test__f_limit_sets_adjust__works(void **state);
+
+#endif // _TEST__F_limit__sets_adjust
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_append.c b/level_0/f_limit/tests/unit/c/test-limit-sets_append.c
new file mode 100644 (file)
index 0000000..d3fdf97
--- /dev/null
@@ -0,0 +1,39 @@
+#include "test-limit.h"
+#include "test-limit-sets_append.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_append__parameter_checking(void **state) {
+
+  const f_limit_set_t data = f_limit_set_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_append(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_sets_append__works(void **state) {
+
+  const f_limit_set_t source = macro_f_limit_set_t_initialize(1, macro_f_limit_value_t_initialize(2, 3));
+  f_limit_sets_t destination = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_append(source, &destination);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(destination.used, 1);
+    assert_int_equal(destination.array[0].type, source.type);
+    assert_int_equal(destination.array[0].value.rlim_cur, source.value.rlim_cur);
+    assert_int_equal(destination.array[0].value.rlim_max, source.value.rlim_max);
+  }
+
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_append.h b/level_0/f_limit/tests/unit/c/test-limit-sets_append.h
new file mode 100644 (file)
index 0000000..71dd72f
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_append
+#define _TEST__F_limit__sets_append
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_append()
+ */
+extern void test__f_limit_sets_append__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_append()
+ */
+extern void test__f_limit_sets_append__works(void **state);
+
+#endif // _TEST__F_limit__sets_append
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.c b/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.c
new file mode 100644 (file)
index 0000000..b696b70
--- /dev/null
@@ -0,0 +1,87 @@
+#include "test-limit.h"
+#include "test-limit-sets_append_all.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_append_all__parameter_checking(void **state) {
+
+  const f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_append_all(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_sets_append_all__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t source = f_limit_sets_t_initialize;
+  f_limit_sets_t destination = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_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_limit_sets_append_all__works(void **state) {
+
+  const int length = 5;
+  const int length_used = 2;
+  f_limit_sets_t source = f_limit_sets_t_initialize;
+  f_limit_sets_t destination = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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].type = source.used + 1;
+    source.array[source.used].value.rlim_cur = source.used + 2;
+    source.array[source.used].value.rlim_max = source.used + 3;
+  } // for
+  {
+    const f_status_t status = f_limit_sets_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_array_length_t i = 0; i < source.used; ++i) {
+
+      assert_int_equal(destination.array[i].type, i + 1);
+      assert_int_equal(destination.array[i].value.rlim_cur, i + 2);
+      assert_int_equal(destination.array[i].value.rlim_max, i + 3);
+    } // for
+  }
+
+  free((void *) source.array);
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h
new file mode 100644 (file)
index 0000000..dcf55a5
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_append_all
+#define _TEST__F_limit__sets_append_all
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_append_all()
+ */
+extern void test__f_limit_sets_append_all__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_sets_append_all()
+ */
+extern void test__f_limit_sets_append_all__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_append_all()
+ */
+extern void test__f_limit_sets_append_all__works(void **state);
+
+#endif // _TEST__F_limit__sets_append_all
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_decimate_by.c b/level_0/f_limit/tests/unit/c/test-limit-sets_decimate_by.c
new file mode 100644 (file)
index 0000000..9525417
--- /dev/null
@@ -0,0 +1,50 @@
+#include "test-limit.h"
+#include "test-limit-sets_decimate_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_decimate_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_decimate_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_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_limit/tests/unit/c/test-limit-sets_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-sets_decimate_by.h
new file mode 100644 (file)
index 0000000..b8ce768
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_decimate_by
+#define _TEST__F_limit__sets_decimate_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_decimate_by()
+ */
+extern void test__f_limit_sets_decimate_by__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_decimate_by()
+ */
+extern void test__f_limit_sets_decimate_by__works(void **state);
+
+#endif // _TEST__F_limit__sets_decimate_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_decrease_by.c b/level_0/f_limit/tests/unit/c/test-limit-sets_decrease_by.c
new file mode 100644 (file)
index 0000000..6a7b4ad
--- /dev/null
@@ -0,0 +1,50 @@
+#include "test-limit.h"
+#include "test-limit-sets_decrease_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_decrease_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_decrease_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_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_limit/tests/unit/c/test-limit-sets_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-sets_decrease_by.h
new file mode 100644 (file)
index 0000000..dedcb87
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_decrease_by
+#define _TEST__F_limit__sets_decrease_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_decrease_by()
+ */
+extern void test__f_limit_sets_decrease_by__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_decrease_by()
+ */
+extern void test__f_limit_sets_decrease_by__works(void **state);
+
+#endif // _TEST__F_limit__sets_decrease_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_increase.c b/level_0/f_limit/tests/unit/c/test-limit-sets_increase.c
new file mode 100644 (file)
index 0000000..c4a9ebd
--- /dev/null
@@ -0,0 +1,76 @@
+#include "test-limit.h"
+#include "test-limit-sets_increase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_increase__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_increase__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_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_limit_sets_increase__works(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_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_limit/tests/unit/c/test-limit-sets_increase.h b/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h
new file mode 100644 (file)
index 0000000..8d90cb2
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_increase
+#define _TEST__F_limit__sets_increase
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_increase()
+ */
+extern void test__f_limit_sets_increase__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_sets_increase()
+ */
+extern void test__f_limit_sets_increase__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_increase()
+ */
+extern void test__f_limit_sets_increase__works(void **state);
+
+#endif // _TEST__F_limit__sets_increase
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_increase_by.c b/level_0/f_limit/tests/unit/c/test-limit-sets_increase_by.c
new file mode 100644 (file)
index 0000000..dc040f1
--- /dev/null
@@ -0,0 +1,52 @@
+#include "test-limit.h"
+#include "test-limit-sets_increase_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_increase_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_increase_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_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_limit/tests/unit/c/test-limit-sets_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-sets_increase_by.h
new file mode 100644 (file)
index 0000000..60d7f1d
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_increase_by
+#define _TEST__F_limit__sets_increase_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_increase_by()
+ */
+extern void test__f_limit_sets_increase_by__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_increase_by()
+ */
+extern void test__f_limit_sets_increase_by__works(void **state);
+
+#endif // _TEST__F_limit__sets_increase_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_resize.c b/level_0/f_limit/tests/unit/c/test-limit-sets_resize.c
new file mode 100644 (file)
index 0000000..5c5778a
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-sets_resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_sets_resize__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_sets_resize__works(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit/tests/unit/c/test-limit-sets_resize.h b/level_0/f_limit/tests/unit/c/test-limit-sets_resize.h
new file mode 100644 (file)
index 0000000..c4562d9
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__sets_resize
+#define _TEST__F_limit__sets_resize
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_sets_resize()
+ */
+extern void test__f_limit_sets_resize__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_sets_resize()
+ */
+extern void test__f_limit_sets_resize__works(void **state);
+
+#endif // _TEST__F_limit__sets_resize
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_adjust.c b/level_0/f_limit/tests/unit/c/test-limit-setss_adjust.c
new file mode 100644 (file)
index 0000000..a411161
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-setss_adjust.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_adjust__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_adjust__works(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit/tests/unit/c/test-limit-setss_adjust.h b/level_0/f_limit/tests/unit/c/test-limit-setss_adjust.h
new file mode 100644 (file)
index 0000000..862e192
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_adjust
+#define _TEST__F_limit__setss_adjust
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_adjust()
+ */
+extern void test__f_limit_setss_adjust__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_adjust()
+ */
+extern void test__f_limit_setss_adjust__works(void **state);
+
+#endif // _TEST__F_limit__setss_adjust
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_append.c b/level_0/f_limit/tests/unit/c/test-limit-setss_append.c
new file mode 100644 (file)
index 0000000..43612e4
--- /dev/null
@@ -0,0 +1,92 @@
+#include "test-limit.h"
+#include "test-limit-setss_append.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_append__parameter_checking(void **state) {
+
+  f_limit_sets_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_append(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_setss_append__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t source = f_limit_setss_t_initialize;
+  f_limit_setss_t destination = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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_limit_setss_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_limit_setss_append__works(void **state) {
+
+  const int length = 5;
+  f_limit_sets_t source = f_limit_setss_t_initialize;
+  f_limit_setss_t destination = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_sets_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].type = source.used + 1;
+    source.array[source.used].value.rlim_cur = source.used + 2;
+    source.array[source.used].value.rlim_max = source.used + 3;
+  } // for
+
+  {
+    const f_status_t status = f_limit_setss_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_array_length_t i = 0; i < destination.array[0].used; ++i) {
+
+      assert_int_equal(destination.array[0].array[i].type, i + 1);
+      assert_int_equal(destination.array[0].array[i].value.rlim_cur, i + 2);
+      assert_int_equal(destination.array[0].array[i].value.rlim_max, i + 3);
+    } // for
+  }
+
+  for (f_array_length_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_limit/tests/unit/c/test-limit-setss_append.h b/level_0/f_limit/tests/unit/c/test-limit-setss_append.h
new file mode 100644 (file)
index 0000000..a113b17
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_append
+#define _TEST__F_limit__setss_append
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_append()
+ */
+extern void test__f_limit_setss_append__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_setss_append()
+ */
+extern void test__f_limit_setss_append__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_append()
+ */
+extern void test__f_limit_setss_append__works(void **state);
+
+#endif // _TEST__F_limit__setss_append
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.c b/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.c
new file mode 100644 (file)
index 0000000..4b81ac7
--- /dev/null
@@ -0,0 +1,113 @@
+#include "test-limit.h"
+#include "test-limit-setss_append_all.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_append_all__parameter_checking(void **state) {
+
+  const f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_append_all(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_setss_append_all__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t source = f_limit_setss_t_initialize;
+  f_limit_setss_t destination = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit_setss_append_all__works(void **state) {
+
+  const int length = 5;
+  const int length_inner = 2;
+  f_limit_setss_t source = f_limit_setss_t_initialize;
+  f_limit_setss_t destination = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_sets_resize(length_inner, &source.array[source.used]);
+
+      assert_int_equal(status, F_none);
+
+      for (f_array_length_t i = 0; i < length_inner; ++i) {
+
+        source.array[source.used].array[i].type = i + 1;
+        source.array[source.used].array[i].value.rlim_cur = i + 2;
+        source.array[source.used].array[i].value.rlim_max = i + 3;
+      } // for
+
+      source.array[source.used].used = length_inner;
+    } // for
+  }
+
+  {
+    const f_status_t status = f_limit_setss_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_array_length_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_array_length_t j = 0; j < length_inner; ++j) {
+
+        assert_int_equal(destination.array[i].array[j].type, j + 1);
+        assert_int_equal(destination.array[i].array[j].value.rlim_cur, j + 2);
+        assert_int_equal(destination.array[i].array[j].value.rlim_max, j + 3);
+      } // for
+    } // for
+  }
+
+  for (f_array_length_t i = 0; i < source.used; ++i) {
+    free((void *) source.array[i].array);
+  } // for
+
+  for (f_array_length_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_limit/tests/unit/c/test-limit-setss_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h
new file mode 100644 (file)
index 0000000..575e9fe
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_append_all
+#define _TEST__F_limit__setss_append_all
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_append_all()
+ */
+extern void test__f_limit_setss_append_all__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_setss_append_all()
+ */
+extern void test__f_limit_setss_append_all__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_append_all()
+ */
+extern void test__f_limit_setss_append_all__works(void **state);
+
+#endif // _TEST__F_limit__setss_append_all
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.c b/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.c
new file mode 100644 (file)
index 0000000..1ca2d82
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-limit.h"
+#include "test-limit-setss_decimate_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_decimate_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_decimate_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit_setss_decimate_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit/tests/unit/c/test-limit-setss_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h
new file mode 100644 (file)
index 0000000..62e46e4
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_decimate_by
+#define _TEST__F_limit__setss_decimate_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_decimate_by()
+ */
+extern void test__f_limit_setss_decimate_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_setss_decimate_by()
+ */
+extern void test__f_limit_setss_decimate_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_decimate_by()
+ */
+extern void test__f_limit_setss_decimate_by__works(void **state);
+
+#endif // _TEST__F_limit__setss_decimate_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.c b/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.c
new file mode 100644 (file)
index 0000000..9b4841b
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-limit.h"
+#include "test-limit-setss_decrease_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_decrease_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_decrease_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit_setss_decrease_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit/tests/unit/c/test-limit-setss_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h
new file mode 100644 (file)
index 0000000..52266c5
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_decrease_by
+#define _TEST__F_limit__setss_decrease_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_decrease_by()
+ */
+extern void test__f_limit_setss_decrease_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_setss_decrease_by()
+ */
+extern void test__f_limit_setss_decrease_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_decrease_by()
+ */
+extern void test__f_limit_setss_decrease_by__works(void **state);
+
+#endif // _TEST__F_limit__setss_decrease_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_increase.c b/level_0/f_limit/tests/unit/c/test-limit-setss_increase.c
new file mode 100644 (file)
index 0000000..602f6d1
--- /dev/null
@@ -0,0 +1,84 @@
+#include "test-limit.h"
+#include "test-limit-setss_increase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_increase__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_increase__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_increase(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_limit_setss_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_limit_setss_increase__works(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit/tests/unit/c/test-limit-setss_increase.h b/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h
new file mode 100644 (file)
index 0000000..a4ba142
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_increase
+#define _TEST__F_limit__setss_increase
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_increase()
+ */
+extern void test__f_limit_setss_increase__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_setss_increase()
+ */
+extern void test__f_limit_setss_increase__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_increase()
+ */
+extern void test__f_limit_setss_increase__works(void **state);
+
+#endif // _TEST__F_limit__setss_increase
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.c b/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.c
new file mode 100644 (file)
index 0000000..d4cae0a
--- /dev/null
@@ -0,0 +1,84 @@
+#include "test-limit.h"
+#include "test-limit-setss_increase_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_increase_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_increase_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit_setss_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_limit_setss_increase_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_sets_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_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_limit/tests/unit/c/test-limit-setss_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h
new file mode 100644 (file)
index 0000000..06f3612
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_increase_by
+#define _TEST__F_limit__setss_increase_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_increase_by()
+ */
+extern void test__f_limit_setss_increase_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_setss_increase_by()
+ */
+extern void test__f_limit_setss_increase_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_increase_by()
+ */
+extern void test__f_limit_setss_increase_by__works(void **state);
+
+#endif // _TEST__F_limit__setss_increase_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_resize.c b/level_0/f_limit/tests/unit/c/test-limit-setss_resize.c
new file mode 100644 (file)
index 0000000..ee7fa19
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-setss_resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_resize__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit_setss_resize__works(void **state) {
+
+  const int length = 5;
+  f_limit_setss_t data = f_limit_setss_t_initialize;
+
+  {
+    const f_status_t status = f_limit_setss_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_limit/tests/unit/c/test-limit-setss_resize.h b/level_0/f_limit/tests/unit/c/test-limit-setss_resize.h
new file mode 100644 (file)
index 0000000..247ea69
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_resize
+#define _TEST__F_limit__setss_resize
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_setss_resize()
+ */
+extern void test__f_limit_setss_resize__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_resize()
+ */
+extern void test__f_limit_setss_resize__works(void **state);
+
+#endif // _TEST__F_limit__setss_resize
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_adjust.c b/level_0/f_limit/tests/unit/c/test-limit-values_adjust.c
new file mode 100644 (file)
index 0000000..69711a0
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-values_adjust.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_adjust__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_adjust__works(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit/tests/unit/c/test-limit-values_adjust.h b/level_0/f_limit/tests/unit/c/test-limit-values_adjust.h
new file mode 100644 (file)
index 0000000..3c7ee55
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_adjust
+#define _TEST__F_limit__values_adjust
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_adjust()
+ */
+extern void test__f_limit_values_adjust__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_adjust()
+ */
+extern void test__f_limit_values_adjust__works(void **state);
+
+#endif // _TEST__F_limit__values_adjust
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_append.c b/level_0/f_limit/tests/unit/c/test-limit-values_append.c
new file mode 100644 (file)
index 0000000..8423a10
--- /dev/null
@@ -0,0 +1,38 @@
+#include "test-limit.h"
+#include "test-limit-values_append.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_append__parameter_checking(void **state) {
+
+  const f_limit_value_t data = f_limit_value_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_append(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_values_append__works(void **state) {
+
+  const f_limit_value_t source = macro_f_limit_value_t_initialize(1, 2);
+  f_limit_values_t destination = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_append(source, &destination);
+
+    assert_int_equal(status, F_none);
+    assert_int_equal(destination.used, 1);
+    assert_int_equal(destination.array[0].rlim_cur, source.rlim_cur);
+    assert_int_equal(destination.array[0].rlim_max, source.rlim_max);
+  }
+
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_append.h b/level_0/f_limit/tests/unit/c/test-limit-values_append.h
new file mode 100644 (file)
index 0000000..027db37
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_append
+#define _TEST__F_limit__values_append
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_append()
+ */
+extern void test__f_limit_values_append__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_append()
+ */
+extern void test__f_limit_values_append__works(void **state);
+
+#endif // _TEST__F_limit__values_append
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_append_all.c b/level_0/f_limit/tests/unit/c/test-limit-values_append_all.c
new file mode 100644 (file)
index 0000000..c4b5ec5
--- /dev/null
@@ -0,0 +1,85 @@
+#include "test-limit.h"
+#include "test-limit-values_append_all.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_append_all__parameter_checking(void **state) {
+
+  const f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_append_all(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_values_append_all__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_values_t source = f_limit_values_t_initialize;
+  f_limit_values_t destination = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_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_limit_values_append_all__works(void **state) {
+
+  const int length = 5;
+  const int length_used = 2;
+  f_limit_values_t source = f_limit_values_t_initialize;
+  f_limit_values_t destination = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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].rlim_cur = source.used + 1;
+    source.array[source.used].rlim_max = source.used + 2;
+  } // for
+  {
+    const f_status_t status = f_limit_values_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_array_length_t i = 0; i < source.used; ++i) {
+
+      assert_int_equal(destination.array[i].rlim_cur, i + 1);
+      assert_int_equal(destination.array[i].rlim_max, i + 2);
+    } // for
+  }
+
+  free((void *) source.array);
+  free((void *) destination.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h
new file mode 100644 (file)
index 0000000..0dd4ba6
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_append_all
+#define _TEST__F_limit__values_append_all
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_append_all()
+ */
+extern void test__f_limit_values_append_all__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_values_append_all()
+ */
+extern void test__f_limit_values_append_all__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_append_all()
+ */
+extern void test__f_limit_values_append_all__works(void **state);
+
+#endif // _TEST__F_limit__values_append_all
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_decimate_by.c b/level_0/f_limit/tests/unit/c/test-limit-values_decimate_by.c
new file mode 100644 (file)
index 0000000..ef85e3d
--- /dev/null
@@ -0,0 +1,50 @@
+#include "test-limit.h"
+#include "test-limit-values_decimate_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_decimate_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_decimate_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_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_limit/tests/unit/c/test-limit-values_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-values_decimate_by.h
new file mode 100644 (file)
index 0000000..b6765e2
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_decimate_by
+#define _TEST__F_limit__values_decimate_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_decimate_by()
+ */
+extern void test__f_limit_values_decimate_by__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_decimate_by()
+ */
+extern void test__f_limit_values_decimate_by__works(void **state);
+
+#endif // _TEST__F_limit__values_decimate_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_decrease_by.c b/level_0/f_limit/tests/unit/c/test-limit-values_decrease_by.c
new file mode 100644 (file)
index 0000000..b7a63b0
--- /dev/null
@@ -0,0 +1,50 @@
+#include "test-limit.h"
+#include "test-limit-values_decrease_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_decrease_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_decrease_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_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_limit/tests/unit/c/test-limit-values_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-values_decrease_by.h
new file mode 100644 (file)
index 0000000..ca686a1
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_decrease_by
+#define _TEST__F_limit__values_decrease_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_decrease_by()
+ */
+extern void test__f_limit_values_decrease_by__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_decrease_by()
+ */
+extern void test__f_limit_values_decrease_by__works(void **state);
+
+#endif // _TEST__F_limit__values_decrease_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_increase.c b/level_0/f_limit/tests/unit/c/test-limit-values_increase.c
new file mode 100644 (file)
index 0000000..12e2abc
--- /dev/null
@@ -0,0 +1,76 @@
+#include "test-limit.h"
+#include "test-limit-values_increase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_increase__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_increase__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_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_limit_values_increase__works(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_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_limit/tests/unit/c/test-limit-values_increase.h b/level_0/f_limit/tests/unit/c/test-limit-values_increase.h
new file mode 100644 (file)
index 0000000..bbe0450
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_increase
+#define _TEST__F_limit__values_increase
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_increase()
+ */
+extern void test__f_limit_values_increase__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_values_increase()
+ */
+extern void test__f_limit_values_increase__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_increase()
+ */
+extern void test__f_limit_values_increase__works(void **state);
+
+#endif // _TEST__F_limit__values_increase
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_increase_by.c b/level_0/f_limit/tests/unit/c/test-limit-values_increase_by.c
new file mode 100644 (file)
index 0000000..6a6d427
--- /dev/null
@@ -0,0 +1,52 @@
+#include "test-limit.h"
+#include "test-limit-values_increase_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_increase_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_increase_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_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_limit/tests/unit/c/test-limit-values_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-values_increase_by.h
new file mode 100644 (file)
index 0000000..a216aba
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_increase_by
+#define _TEST__F_limit__values_increase_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_increase_by()
+ */
+extern void test__f_limit_values_increase_by__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_increase_by()
+ */
+extern void test__f_limit_values_increase_by__works(void **state);
+
+#endif // _TEST__F_limit__values_increase_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_resize.c b/level_0/f_limit/tests/unit/c/test-limit-values_resize.c
new file mode 100644 (file)
index 0000000..ee19651
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-values_resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_values_resize__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_values_resize__works(void **state) {
+
+  const int length = 5;
+  f_limit_values_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit/tests/unit/c/test-limit-values_resize.h b/level_0/f_limit/tests/unit/c/test-limit-values_resize.h
new file mode 100644 (file)
index 0000000..09a0952
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the limit project.
+ */
+#ifndef _TEST__F_limit__values_resize
+#define _TEST__F_limit__values_resize
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_values_resize()
+ */
+extern void test__f_limit_values_resize__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_values_resize()
+ */
+extern void test__f_limit_values_resize__works(void **state);
+
+#endif // _TEST__F_limit__values_resize
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_adjust.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_adjust.c
new file mode 100644 (file)
index 0000000..5fe47a5
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-valuess_adjust.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_adjust__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_adjust__works(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit/tests/unit/c/test-limit-valuess_adjust.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_adjust.h
new file mode 100644 (file)
index 0000000..c3dc2a5
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_adjust
+#define _TEST__F_limit__valuess_adjust
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_adjust()
+ */
+extern void test__f_limit_valuess_adjust__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_adjust()
+ */
+extern void test__f_limit_valuess_adjust__works(void **state);
+
+#endif // _TEST__F_limit__valuess_adjust
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_append.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_append.c
new file mode 100644 (file)
index 0000000..a13c358
--- /dev/null
@@ -0,0 +1,90 @@
+#include "test-limit.h"
+#include "test-limit-valuess_append.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_append__parameter_checking(void **state) {
+
+  f_limit_values_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_append(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_valuess_append__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_values_t source = f_limit_valuess_t_initialize;
+  f_limit_valuess_t destination = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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_limit_valuess_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_limit_valuess_append__works(void **state) {
+
+  const int length = 5;
+  f_limit_values_t source = f_limit_valuess_t_initialize;
+  f_limit_valuess_t destination = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_values_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].rlim_cur = source.used + 1;
+    source.array[source.used].rlim_max = source.used + 2;
+  } // for
+
+  {
+    const f_status_t status = f_limit_valuess_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_array_length_t i = 0; i < destination.array[0].used; ++i) {
+
+      assert_int_equal(destination.array[0].array[i].rlim_cur, i + 1);
+      assert_int_equal(destination.array[0].array[i].rlim_max, i + 2);
+    } // for
+  }
+
+  for (f_array_length_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_limit/tests/unit/c/test-limit-valuess_append.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h
new file mode 100644 (file)
index 0000000..611e95f
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_append
+#define _TEST__F_limit__valuess_append
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_append()
+ */
+extern void test__f_limit_valuess_append__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_valuess_append()
+ */
+extern void test__f_limit_valuess_append__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_append()
+ */
+extern void test__f_limit_valuess_append__works(void **state);
+
+#endif // _TEST__F_limit__valuess_append
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.c
new file mode 100644 (file)
index 0000000..33a580c
--- /dev/null
@@ -0,0 +1,111 @@
+#include "test-limit.h"
+#include "test-limit-valuess_append_all.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_append_all__parameter_checking(void **state) {
+
+  const f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_append_all(data, 0);
+
+    assert_int_equal(status, F_status_set_error(F_parameter));
+  }
+}
+
+void test__f_limit_valuess_append_all__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t source = f_limit_valuess_t_initialize;
+  f_limit_valuess_t destination = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit_valuess_append_all__works(void **state) {
+
+  const int length = 5;
+  const int length_inner = 2;
+  f_limit_valuess_t source = f_limit_valuess_t_initialize;
+  f_limit_valuess_t destination = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_values_resize(length_inner, &source.array[source.used]);
+
+      assert_int_equal(status, F_none);
+
+      for (f_array_length_t i = 0; i < length_inner; ++i) {
+
+        source.array[source.used].array[i].rlim_cur = i + 1;
+        source.array[source.used].array[i].rlim_max = i + 2;
+      } // for
+
+      source.array[source.used].used = length_inner;
+    } // for
+  }
+
+  {
+    const f_status_t status = f_limit_valuess_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_array_length_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_array_length_t j = 0; j < length_inner; ++j) {
+
+        assert_int_equal(destination.array[i].array[j].rlim_cur, j + 1);
+        assert_int_equal(destination.array[i].array[j].rlim_max, j + 2);
+      } // for
+    } // for
+  }
+
+  for (f_array_length_t i = 0; i < source.used; ++i) {
+    free((void *) source.array[i].array);
+  } // for
+
+  for (f_array_length_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_limit/tests/unit/c/test-limit-valuess_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h
new file mode 100644 (file)
index 0000000..c80dcbc
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_append_all
+#define _TEST__F_limit__valuess_append_all
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_append_all()
+ */
+extern void test__f_limit_valuess_append_all__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_valuess_append_all()
+ */
+extern void test__f_limit_valuess_append_all__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_append_all()
+ */
+extern void test__f_limit_valuess_append_all__works(void **state);
+
+#endif // _TEST__F_limit__valuess_append_all
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.c
new file mode 100644 (file)
index 0000000..f0afbd4
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-limit.h"
+#include "test-limit-valuess_decimate_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_decimate_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_decimate_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit_valuess_decimate_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit/tests/unit/c/test-limit-valuess_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h
new file mode 100644 (file)
index 0000000..c6cd257
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_decimate_by
+#define _TEST__F_limit__valuess_decimate_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_decimate_by()
+ */
+extern void test__f_limit_valuess_decimate_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_valuess_decimate_by()
+ */
+extern void test__f_limit_valuess_decimate_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_decimate_by()
+ */
+extern void test__f_limit_valuess_decimate_by__works(void **state);
+
+#endif // _TEST__F_limit__valuess_decimate_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.c
new file mode 100644 (file)
index 0000000..17ab8f0
--- /dev/null
@@ -0,0 +1,74 @@
+#include "test-limit.h"
+#include "test-limit-valuess_decrease_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_decrease_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_decrease_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit_valuess_decrease_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit/tests/unit/c/test-limit-valuess_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h
new file mode 100644 (file)
index 0000000..3592fc3
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_decrease_by
+#define _TEST__F_limit__valuess_decrease_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_decrease_by()
+ */
+extern void test__f_limit_valuess_decrease_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_valuess_decrease_by()
+ */
+extern void test__f_limit_valuess_decrease_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_decrease_by()
+ */
+extern void test__f_limit_valuess_decrease_by__works(void **state);
+
+#endif // _TEST__F_limit__valuess_decrease_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.c
new file mode 100644 (file)
index 0000000..f49befc
--- /dev/null
@@ -0,0 +1,84 @@
+#include "test-limit.h"
+#include "test-limit-valuess_increase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_increase__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_increase__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_increase(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_limit_valuess_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_limit_valuess_increase__works(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit/tests/unit/c/test-limit-valuess_increase.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h
new file mode 100644 (file)
index 0000000..acf0d69
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_increase
+#define _TEST__F_limit__valuess_increase
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_increase()
+ */
+extern void test__f_limit_valuess_increase__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_valuess_increase()
+ */
+extern void test__f_limit_valuess_increase__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_increase()
+ */
+extern void test__f_limit_valuess_increase__works(void **state);
+
+#endif // _TEST__F_limit__valuess_increase
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.c
new file mode 100644 (file)
index 0000000..7e0a251
--- /dev/null
@@ -0,0 +1,84 @@
+#include "test-limit.h"
+#include "test-limit-valuess_increase_by.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_increase_by__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_increase_by__returns_data_not(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit_valuess_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_limit_valuess_increase_by__works(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_values_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_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_limit/tests/unit/c/test-limit-valuess_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h
new file mode 100644 (file)
index 0000000..8819fd8
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_increase_by
+#define _TEST__F_limit__valuess_increase_by
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_increase_by()
+ */
+extern void test__f_limit_valuess_increase_by__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not when asked to copy an empty structure.
+ *
+ * @see f_limit_valuess_increase_by()
+ */
+extern void test__f_limit_valuess_increase_by__returns_data_not(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_increase_by()
+ */
+extern void test__f_limit_valuess_increase_by__works(void **state);
+
+#endif // _TEST__F_limit__valuess_increase_by
diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_resize.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_resize.c
new file mode 100644 (file)
index 0000000..a6944e3
--- /dev/null
@@ -0,0 +1,42 @@
+#include "test-limit.h"
+#include "test-limit-valuess_resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_resize__parameter_checking(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit_valuess_resize__works(void **state) {
+
+  const int length = 5;
+  f_limit_valuess_t data = f_limit_valuess_t_initialize;
+
+  {
+    const f_status_t status = f_limit_valuess_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_limit/tests/unit/c/test-limit-valuess_resize.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_resize.h
new file mode 100644 (file)
index 0000000..3a43cf3
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Type
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_resize
+#define _TEST__F_limit__valuess_resize
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_limit_valuess_resize()
+ */
+extern void test__f_limit_valuess_resize__parameter_checking(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_resize()
+ */
+extern void test__f_limit_valuess_resize__works(void **state);
+
+#endif // _TEST__F_limit__valuess_resize
diff --git a/level_0/f_limit/tests/unit/c/test-limit.c b/level_0/f_limit/tests/unit/c/test-limit.c
new file mode 100644 (file)
index 0000000..0bef998
--- /dev/null
@@ -0,0 +1,121 @@
+#include "test-limit.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_limit_process__fails),
+    cmocka_unit_test(test__f_limit_process__works),
+
+    cmocka_unit_test(test__f_limit_sets_adjust__works),
+    cmocka_unit_test(test__f_limit_sets_append__works),
+    cmocka_unit_test(test__f_limit_sets_append_all__works),
+    cmocka_unit_test(test__f_limit_sets_decimate_by__works),
+    cmocka_unit_test(test__f_limit_sets_decrease_by__works),
+    cmocka_unit_test(test__f_limit_sets_increase__works),
+    cmocka_unit_test(test__f_limit_sets_increase_by__works),
+    cmocka_unit_test(test__f_limit_sets_resize__works),
+
+    cmocka_unit_test(test__f_limit_setss_append__returns_data_not),
+    cmocka_unit_test(test__f_limit_setss_append_all__returns_data_not),
+    cmocka_unit_test(test__f_limit_setss_decimate_by__returns_data_not),
+    cmocka_unit_test(test__f_limit_setss_decrease_by__returns_data_not),
+    cmocka_unit_test(test__f_limit_setss_increase__returns_data_not),
+    cmocka_unit_test(test__f_limit_setss_increase_by__returns_data_not),
+
+    cmocka_unit_test(test__f_limit_setss_adjust__works),
+    cmocka_unit_test(test__f_limit_setss_append__works),
+    cmocka_unit_test(test__f_limit_setss_append_all__works),
+    cmocka_unit_test(test__f_limit_setss_decimate_by__works),
+    cmocka_unit_test(test__f_limit_setss_decrease_by__works),
+    cmocka_unit_test(test__f_limit_setss_increase__works),
+    cmocka_unit_test(test__f_limit_setss_increase_by__works),
+    cmocka_unit_test(test__f_limit_setss_resize__works),
+
+    cmocka_unit_test(test__f_limit_values_adjust__works),
+    cmocka_unit_test(test__f_limit_values_append__works),
+    cmocka_unit_test(test__f_limit_values_append_all__works),
+    cmocka_unit_test(test__f_limit_values_decimate_by__works),
+    cmocka_unit_test(test__f_limit_values_decrease_by__works),
+    cmocka_unit_test(test__f_limit_values_increase__works),
+    cmocka_unit_test(test__f_limit_values_increase_by__works),
+    cmocka_unit_test(test__f_limit_values_resize__works),
+
+    cmocka_unit_test(test__f_limit_valuess_append__returns_data_not),
+    cmocka_unit_test(test__f_limit_valuess_append_all__returns_data_not),
+    cmocka_unit_test(test__f_limit_valuess_decimate_by__returns_data_not),
+    cmocka_unit_test(test__f_limit_valuess_decrease_by__returns_data_not),
+    cmocka_unit_test(test__f_limit_valuess_increase__returns_data_not),
+    cmocka_unit_test(test__f_limit_valuess_increase_by__returns_data_not),
+
+    cmocka_unit_test(test__f_limit_valuess_adjust__works),
+    cmocka_unit_test(test__f_limit_valuess_append__works),
+    cmocka_unit_test(test__f_limit_valuess_append_all__works),
+    cmocka_unit_test(test__f_limit_valuess_decimate_by__works),
+    cmocka_unit_test(test__f_limit_valuess_decrease_by__works),
+    cmocka_unit_test(test__f_limit_valuess_increase__works),
+    cmocka_unit_test(test__f_limit_valuess_increase_by__works),
+    cmocka_unit_test(test__f_limit_valuess_resize__works),
+
+    #ifndef _di_level_0_parameter_checking_
+      cmocka_unit_test(test__f_limit_process__parameter_checking),
+
+      cmocka_unit_test(test__f_limit_sets_adjust__parameter_checking),
+      cmocka_unit_test(test__f_limit_sets_append__parameter_checking),
+      cmocka_unit_test(test__f_limit_sets_append_all__parameter_checking),
+      cmocka_unit_test(test__f_limit_sets_decimate_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_sets_decrease_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_sets_increase__parameter_checking),
+      cmocka_unit_test(test__f_limit_sets_increase_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_sets_resize__parameter_checking),
+
+      cmocka_unit_test(test__f_limit_setss_adjust__parameter_checking),
+      cmocka_unit_test(test__f_limit_setss_append__parameter_checking),
+      cmocka_unit_test(test__f_limit_setss_append_all__parameter_checking),
+      cmocka_unit_test(test__f_limit_setss_decimate_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_setss_decrease_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_setss_increase__parameter_checking),
+      cmocka_unit_test(test__f_limit_setss_increase_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_setss_resize__parameter_checking),
+
+      cmocka_unit_test(test__f_limit_values_adjust__parameter_checking),
+      cmocka_unit_test(test__f_limit_values_append__parameter_checking),
+      cmocka_unit_test(test__f_limit_values_append_all__parameter_checking),
+      cmocka_unit_test(test__f_limit_values_decimate_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_values_decrease_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_values_increase__parameter_checking),
+      cmocka_unit_test(test__f_limit_values_increase_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_values_resize__parameter_checking),
+
+      cmocka_unit_test(test__f_limit_valuess_adjust__parameter_checking),
+      cmocka_unit_test(test__f_limit_valuess_append__parameter_checking),
+      cmocka_unit_test(test__f_limit_valuess_append_all__parameter_checking),
+      cmocka_unit_test(test__f_limit_valuess_decimate_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_valuess_decrease_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_valuess_increase__parameter_checking),
+      cmocka_unit_test(test__f_limit_valuess_increase_by__parameter_checking),
+      cmocka_unit_test(test__f_limit_valuess_resize__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_limit/tests/unit/c/test-limit.h b/level_0/f_limit/tests/unit/c/test-limit.h
new file mode 100644 (file)
index 0000000..9a8510e
--- /dev/null
@@ -0,0 +1,105 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the limit project.
+ */
+#ifndef _TEST__F_limit_h
+#define _TEST__F_limit_h
+
+// Libc includes.
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <stdint.h>
+#include <string.h>
+
+// cmocka includes.
+#include <cmocka.h>
+
+// FLL-0 includes.
+#include <fll/level_0/limit.h>
+
+// Mock includes.
+#include "mock-limit.h"
+
+// Test includes.
+#include "test-limit-process.h"
+#include "test-limit-sets_adjust.h"
+#include "test-limit-sets_append.h"
+#include "test-limit-sets_append_all.h"
+#include "test-limit-sets_decimate_by.h"
+#include "test-limit-sets_decrease_by.h"
+#include "test-limit-sets_increase.h"
+#include "test-limit-sets_increase_by.h"
+#include "test-limit-sets_resize.h"
+#include "test-limit-setss_adjust.h"
+#include "test-limit-setss_append.h"
+#include "test-limit-setss_append_all.h"
+#include "test-limit-setss_decimate_by.h"
+#include "test-limit-setss_decrease_by.h"
+#include "test-limit-setss_increase.h"
+#include "test-limit-setss_increase_by.h"
+#include "test-limit-setss_resize.h"
+#include "test-limit-values_adjust.h"
+#include "test-limit-values_append.h"
+#include "test-limit-values_append_all.h"
+#include "test-limit-values_decimate_by.h"
+#include "test-limit-values_decrease_by.h"
+#include "test-limit-values_increase.h"
+#include "test-limit-values_increase_by.h"
+#include "test-limit-values_resize.h"
+#include "test-limit-valuess_adjust.h"
+#include "test-limit-valuess_append.h"
+#include "test-limit-valuess_append_all.h"
+#include "test-limit-valuess_decimate_by.h"
+#include "test-limit-valuess_decrease_by.h"
+#include "test-limit-valuess_increase.h"
+#include "test-limit-valuess_increase_by.h"
+#include "test-limit-valuess_resize.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_limit_h