]> Kevux Git Server - fll/commitdiff
Progress: Continue re-designing of the memory logic.
authorKevin Day <thekevinday@gmail.com>
Sat, 12 Aug 2023 23:07:33 +0000 (18:07 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 13 Aug 2023 00:43:04 +0000 (19:43 -0500)
104 files changed:
build/stand_alone/fake.config.h
level_0/f_account/c/account/accounts.c
level_0/f_account/c/account/accounts.h
level_0/f_account/c/account/common.h
level_0/f_account/c/account/private-accounts.c
level_0/f_account/c/account/private-accounts.h
level_0/f_account/data/build/settings-mocks
level_0/f_account/data/build/settings-tests
level_0/f_account/tests/unit/c/mock-account.c
level_0/f_account/tests/unit/c/mock-account.h
level_0/f_account/tests/unit/c/test-account-by_id.c
level_0/f_account/tests/unit/c/test-account-by_name.c
level_0/f_account/tests/unit/c/test-account-group_name_by_id.c
level_0/f_account/tests/unit/c/test-account-name_by_id.c
level_0/f_account/tests/unit/c/test-account-s_adjust.c [deleted file]
level_0/f_account/tests/unit/c/test-account-s_adjust.h [deleted file]
level_0/f_account/tests/unit/c/test-account-s_adjust_callback.c [new file with mode: 0644]
level_0/f_account/tests/unit/c/test-account-s_adjust_callback.h [new file with mode: 0644]
level_0/f_account/tests/unit/c/test-account-s_append.c
level_0/f_account/tests/unit/c/test-account-s_append.h
level_0/f_account/tests/unit/c/test-account-s_append_all.c
level_0/f_account/tests/unit/c/test-account-s_append_all.h
level_0/f_account/tests/unit/c/test-account-s_decimate_by.c [deleted file]
level_0/f_account/tests/unit/c/test-account-s_decimate_by.h [deleted file]
level_0/f_account/tests/unit/c/test-account-s_decrease_by.c [deleted file]
level_0/f_account/tests/unit/c/test-account-s_decrease_by.h [deleted file]
level_0/f_account/tests/unit/c/test-account-s_increase.c [deleted file]
level_0/f_account/tests/unit/c/test-account-s_increase.h [deleted file]
level_0/f_account/tests/unit/c/test-account-s_increase_by.c [deleted file]
level_0/f_account/tests/unit/c/test-account-s_increase_by.h [deleted file]
level_0/f_account/tests/unit/c/test-account-s_resize.c [deleted file]
level_0/f_account/tests/unit/c/test-account-s_resize.h [deleted file]
level_0/f_account/tests/unit/c/test-account-s_resize_callback.c [new file with mode: 0644]
level_0/f_account/tests/unit/c/test-account-s_resize_callback.h [new file with mode: 0644]
level_0/f_account/tests/unit/c/test-account-ss_adjust.c [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_adjust.h [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_append.c
level_0/f_account/tests/unit/c/test-account-ss_append.h
level_0/f_account/tests/unit/c/test-account-ss_append_all.c
level_0/f_account/tests/unit/c/test-account-ss_append_all.h
level_0/f_account/tests/unit/c/test-account-ss_decimate_by.c [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_decimate_by.h [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_decrease_by.c [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_decrease_by.h [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_increase.c [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_increase.h [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_increase_by.c [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_increase_by.h [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_resize.c [deleted file]
level_0/f_account/tests/unit/c/test-account-ss_resize.h [deleted file]
level_0/f_account/tests/unit/c/test-account.c
level_0/f_account/tests/unit/c/test-account.h
level_0/f_iki/c/iki/common.h
level_0/f_iki/c/iki/data.c
level_0/f_iki/c/iki/data.h
level_0/f_iki/c/iki/private-data.c
level_0/f_iki/c/iki/private-data.h
level_0/f_iki/c/private-iki.h
level_0/f_iki/data/build/settings-mocks [new file with mode: 0644]
level_0/f_iki/data/build/settings-tests
level_0/f_iki/data/build/testfile
level_0/f_iki/tests/unit/c/mock-iki.c [new file with mode: 0644]
level_0/f_iki/tests/unit/c/mock-iki.h [new file with mode: 0644]
level_0/f_iki/tests/unit/c/test-iki-datas_adjust.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_adjust.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.c [new file with mode: 0644]
level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.h [new file with mode: 0644]
level_0/f_iki/tests/unit/c/test-iki-datas_append.h
level_0/f_iki/tests/unit/c/test-iki-datas_append_all.c
level_0/f_iki/tests/unit/c/test-iki-datas_append_all.h
level_0/f_iki/tests/unit/c/test-iki-datas_decimate_by.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_decimate_by.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_decrease_by.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_decrease_by.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_increase.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_increase.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_increase_by.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_increase_by.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_resize.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_resize.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.c [new file with mode: 0644]
level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.h [new file with mode: 0644]
level_0/f_iki/tests/unit/c/test-iki-datass_adjust.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_adjust.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_append.c
level_0/f_iki/tests/unit/c/test-iki-datass_append.h
level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c
level_0/f_iki/tests/unit/c/test-iki-datass_append_all.h
level_0/f_iki/tests/unit/c/test-iki-datass_decimate_by.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_decimate_by.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_decrease_by.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_decrease_by.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_increase.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_increase.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_increase_by.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_increase_by.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_resize.c [deleted file]
level_0/f_iki/tests/unit/c/test-iki-datass_resize.h [deleted file]
level_0/f_iki/tests/unit/c/test-iki-read.c
level_0/f_iki/tests/unit/c/test-iki.c
level_0/f_iki/tests/unit/c/test-iki.h
level_3/controller/c/common/private-rule.c
level_3/controller/c/rule/private-rule.c
level_3/controller/c/rule/private-rule.h

index 80dfa1b48c7449f40b329da8652bdeb2bd862477..83922f38de8ecbb75fbd395efb1c1f7cf9fcdbf3 100644 (file)
 #define _di_f_iki_content_partial_is_
 //#define _di_f_iki_data_delete_
 #define _di_f_iki_data_destroy_
-#define _di_f_iki_datas_adjust_
+#define _di_f_iki_datas_adjust_callback_
 #define _di_f_iki_datas_append_
 #define _di_f_iki_datas_append_all_
-#define _di_f_iki_datas_decimate_by_
-#define _di_f_iki_datas_decrease_by_
-#define _di_f_iki_datas_increase_
-#define _di_f_iki_datas_increase_by_
-#define _di_f_iki_datas_resize_
-#define _di_f_iki_datass_adjust_
+#define _di_f_iki_datas_resize_callack_
 #define _di_f_iki_datass_append_
 #define _di_f_iki_datass_append_all_
-#define _di_f_iki_datass_decimate_by_
-#define _di_f_iki_datass_decrease_by_
-#define _di_f_iki_datass_increase_
-#define _di_f_iki_datass_increase_by_
-#define _di_f_iki_datass_resize_
 #define _di_f_iki_datass_t_
 #define _di_f_iki_datas_t_
 //#define _di_f_iki_data_t_
index fa325f1b3ceb467d4d90c5fd13f61b8d5cf4fd9f..6946d40f551e4771be290fc6bb99a8db7f9b5a7e 100644 (file)
@@ -7,167 +7,173 @@ extern "C" {
 #endif
 
 #ifndef _di_f_account_delete_
-  f_status_t f_account_delete(f_account_t *account) {
+  f_status_t f_account_delete(f_account_t * const account) {
     #ifndef _di_level_0_parameter_checking_
       if (!account) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_account_delete(account);
+    f_status_t status = f_string_dynamic_resize(0, &account->home);
+    if (F_status_is_error(status)) return status;
+
+    status = f_string_dynamic_resize(0, &account->label);
+    if (F_status_is_error(status)) return status;
+
+    status = f_string_dynamic_resize(0, &account->name);
+    if (F_status_is_error(status)) return status;
+
+    status = f_string_dynamic_resize(0, &account->password);
+    if (F_status_is_error(status)) return status;
+
+    status = f_string_dynamic_resize(0, &account->shell);
+    if (F_status_is_error(status)) return status;
+
+    return F_none;
   }
 #endif // _di_f_account_delete_
 
 #ifndef _di_f_account_destroy_
-  f_status_t f_account_destroy(f_account_t *account) {
+  f_status_t f_account_destroy(f_account_t * const account) {
     #ifndef _di_level_0_parameter_checking_
       if (!account) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_account_destroy(account);
-  }
-#endif // _di_f_account_destroy_
+    f_status_t status = f_string_dynamic_adjust(0, &account->home);
+    if (F_status_is_error(status)) return status;
 
-#ifndef _di_f_accounts_adjust_
-  f_status_t f_accounts_adjust(const f_number_unsigned_t length, f_accounts_t *accounts) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accounts) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+    status = f_string_dynamic_adjust(0, &account->label);
+    if (F_status_is_error(status)) return status;
 
-    return private_f_accounts_adjust(length, accounts);
-  }
-#endif // _di_f_accounts_adjust_
+    status = f_string_dynamic_adjust(0, &account->name);
+    if (F_status_is_error(status)) return status;
 
-#ifndef _di_f_accounts_append_
-  f_status_t f_accounts_append(const f_account_t source, f_accounts_t *destination) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!destination) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+    status = f_string_dynamic_adjust(0, &account->password);
+    if (F_status_is_error(status)) return status;
+
+    status = f_string_dynamic_adjust(0, &account->shell);
+    if (F_status_is_error(status)) return status;
 
-    return private_f_accounts_append(source, destination);
+    return F_none;
   }
-#endif // _di_f_accounts_append_
+#endif // _di_f_account_destroy_
 
-#ifndef _di_f_accounts_append_all_
-  f_status_t f_accounts_append_all(const f_accounts_t source, f_accounts_t *destination) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!destination) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_accounts_adjust_callback_
+  f_status_t f_accounts_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
 
-    if (!source.used) return F_data_not;
+    {
+      f_accounts_t * const array = (f_accounts_t *) void_array;
+      f_status_t status = F_none;
 
-    return private_f_accounts_append_all(source, destination);
-  }
-#endif // _di_f_accounts_append_all_
+      for (f_number_unsigned_t i = start; i < stop; ++i) {
 
-#ifndef _di_f_accounts_decimate_by_
-  f_status_t f_accounts_decimate_by(const f_number_unsigned_t amount, f_accounts_t *accounts) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accounts) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+        status = f_string_dynamic_adjust(0, &array->array[i].home);
+        if (F_status_is_error(status)) return status;
+
+        status = f_string_dynamic_adjust(0, &array->array[i].label);
+        if (F_status_is_error(status)) return status;
 
-    if (!amount) return F_data_not;
+        status = f_string_dynamic_adjust(0, &array->array[i].name);
+        if (F_status_is_error(status)) return status;
 
-    if (accounts->size > amount) {
-      return private_f_accounts_adjust(accounts->size - amount, accounts);
+        status = f_string_dynamic_adjust(0, &array->array[i].password);
+        if (F_status_is_error(status)) return status;
+
+        status = f_string_dynamic_adjust(0, &array->array[i].shell);
+        if (F_status_is_error(status)) return status;
+      } // for
     }
 
-    return private_f_accounts_adjust(0, accounts);
+    return F_none;
   }
-#endif // _di_f_accounts_decimate_by_
+#endif // _di_f_accounts_adjust_callback_
 
-#ifndef _di_f_accounts_decrease_by_
-  f_status_t f_accounts_decrease_by(const f_number_unsigned_t amount, f_accounts_t *accounts) {
+#ifndef _di_f_accounts_append_
+  f_status_t f_accounts_append(const f_account_t source, f_accounts_t * const destination) {
     #ifndef _di_level_0_parameter_checking_
-      if (!accounts) return F_status_set_error(F_parameter);
+      if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
+    f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_account_t), (void **) &destination->array, &destination->used, &destination->size);
+    if (F_status_is_error(status)) return status;
 
-    if (accounts->size > amount) {
-      return private_f_accounts_resize(accounts->size - amount, accounts);
-    }
+    destination->array[destination->used].home.used = 0;
+    destination->array[destination->used].label.used = 0;
+    destination->array[destination->used].name.used = 0;
+    destination->array[destination->used].password.used = 0;
+    destination->array[destination->used].shell.used = 0;
 
-    return private_f_accounts_resize(0, accounts);
-  }
-#endif // _di_f_accounts_decrease_by_
+    status = f_string_dynamic_append(source.home, &destination->array[destination->used].home);
+    if (F_status_is_error(status)) return status;
 
-#ifndef _di_f_accounts_increase_
-  f_status_t f_accounts_increase(const f_number_unsigned_t step, f_accounts_t *accounts) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accounts) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+    status = f_string_dynamic_append(source.label, &destination->array[destination->used].label);
+    if (F_status_is_error(status)) return status;
 
-    if (step && accounts->used + 1 > accounts->size) {
-      f_number_unsigned_t size = accounts->used + step;
+    status = f_string_dynamic_append(source.name, &destination->array[destination->used].name);
+    if (F_status_is_error(status)) return status;
 
-      if (size > F_number_t_size_unsigned_d) {
-        if (accounts->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+    status = f_string_dynamic_append(source.password, &destination->array[destination->used].password);
+    if (F_status_is_error(status)) return status;
 
-        size = F_number_t_size_unsigned_d;
-      }
+    status = f_string_dynamic_append(source.shell, &destination->array[destination->used].shell);
+    if (F_status_is_error(status)) return status;
 
-      return private_f_accounts_resize(size, accounts);
-    }
+    ++destination->used;
 
-    return F_data_not;
+    return F_none;
   }
-#endif // _di_f_accounts_increase_
+#endif // _di_f_accounts_append_
 
-#ifndef _di_f_accounts_increase_by_
-  f_status_t f_accounts_increase_by(const f_number_unsigned_t amount, f_accounts_t *accounts) {
+#ifndef _di_f_accounts_append_all_
+  f_status_t f_accounts_append_all(const f_accounts_t source, f_accounts_t * const destination) {
     #ifndef _di_level_0_parameter_checking_
-      if (!accounts) return F_status_set_error(F_parameter);
+      if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
+    if (!source.used) return F_data_not;
 
-    if (accounts->used + amount > accounts->size) {
-      if (accounts->used + amount > F_number_t_size_unsigned_d) {
-        return F_status_set_error(F_array_too_large);
-      }
+    return private_f_accounts_append_all(source, destination);
+  }
+#endif // _di_f_accounts_append_all_
 
-      return private_f_accounts_resize(accounts->used + amount, accounts);
-    }
+#ifndef _di_f_accounts_resize_callback_
+  f_status_t f_accounts_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
 
-    return F_data_not;
-  }
-#endif // _di_f_accounts_increase_by_
+    {
+      f_accounts_t * const array = (f_accounts_t *) void_array;
+      f_status_t status = F_none;
 
-#ifndef _di_f_accounts_resize_
-  f_status_t f_accounts_resize(const f_number_unsigned_t length, f_accounts_t *accounts) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accounts) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+      for (f_number_unsigned_t i = start; i < stop; ++i) {
 
-    return private_f_accounts_resize(length, accounts);
-  }
-#endif // _di_f_accounts_resize_
+        status = f_string_dynamic_resize(0, &array->array[i].home);
+        if (F_status_is_error(status)) return status;
 
-#ifndef _di_f_accountss_adjust_
-  f_status_t f_accountss_adjust(const f_number_unsigned_t length, f_accountss_t *accountss) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accountss) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+        status = f_string_dynamic_resize(0, &array->array[i].label);
+        if (F_status_is_error(status)) return status;
+
+        status = f_string_dynamic_resize(0, &array->array[i].name);
+        if (F_status_is_error(status)) return status;
+
+        status = f_string_dynamic_resize(0, &array->array[i].password);
+        if (F_status_is_error(status)) return status;
+
+        status = f_string_dynamic_resize(0, &array->array[i].shell);
+        if (F_status_is_error(status)) return status;
+      } // for
+    }
 
-    return private_f_accountss_adjust(length, accountss);
+    return F_none;
   }
-#endif // _di_f_accountss_adjust_
+#endif // _di_f_accounts_resize_callback_
 
 #ifndef _di_f_accountss_append_
-  f_status_t f_accountss_append(const f_accounts_t source, f_accountss_t *destination) {
+  f_status_t f_accountss_append(const f_accounts_t source, f_accountss_t * const destination) {
     #ifndef _di_level_0_parameter_checking_
       if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
     if (!source.used) return F_data_not;
 
-    f_status_t status = F_none;
-
-    if (destination->used + 1 > destination->size) {
-      status = private_f_accountss_resize(destination->used + F_memory_default_allocation_small_d, destination);
-      if (F_status_is_error(status)) return status;
-    }
+    f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_accounts_t), (void **) &destination->array, &destination->used, &destination->size);
+    if (F_status_is_error(status)) return status;
 
     status = private_f_accounts_append_all(source, &destination->array[destination->used]);
     if (F_status_is_error(status)) return status;
@@ -179,19 +185,15 @@ extern "C" {
 #endif // _di_f_accountss_append_
 
 #ifndef _di_f_accountss_append_all_
-  f_status_t f_accountss_append_all(const f_accountss_t source, f_accountss_t *destination) {
+  f_status_t f_accountss_append_all(const f_accountss_t source, f_accountss_t * const destination) {
     #ifndef _di_level_0_parameter_checking_
       if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
     if (!source.used) return F_data_not;
 
-    f_status_t status = F_none;
-
-    if (destination->used + source.used > destination->size) {
-      status = private_f_accountss_resize(destination->used + source.used, destination);
-      if (F_status_is_error(status)) return status;
-    }
+    f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_accounts_t), (void **) &destination->array, &destination->used, &destination->size);
+    if (F_status_is_error(status)) return status;
 
     for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) {
 
@@ -207,92 +209,6 @@ extern "C" {
   }
 #endif // _di_f_accountss_append_all_
 
-#ifndef _di_f_accountss_decimate_by_
-  f_status_t f_accountss_decimate_by(const f_number_unsigned_t amount, f_accountss_t *accountss) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accountss) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (!amount) return F_data_not;
-
-    if (accountss->size > amount) {
-      return private_f_accountss_adjust(accountss->size - amount, accountss);
-    }
-
-    return private_f_accountss_adjust(0, accountss);
-  }
-#endif // _di_f_accountss_decimate_by_
-
-#ifndef _di_f_accountss_decrease_by_
-  f_status_t f_accountss_decrease_by(const f_number_unsigned_t amount, f_accountss_t *accountss) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accountss) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (!amount) return F_data_not;
-
-    if (accountss->size > amount) {
-      return private_f_accountss_resize(accountss->size - amount, accountss);
-    }
-
-    return private_f_accountss_resize(0, accountss);
-  }
-#endif // _di_f_accountss_decrease_by_
-
-#ifndef _di_f_accountss_increase_
-  f_status_t f_accountss_increase(const f_number_unsigned_t step, f_accountss_t *accountss) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accountss) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (step && accountss->used + 1 > accountss->size) {
-      f_number_unsigned_t size = accountss->used + step;
-
-      if (size > F_number_t_size_unsigned_d) {
-        if (accountss->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
-
-        size = F_number_t_size_unsigned_d;
-      }
-
-      return private_f_accountss_resize(size, accountss);
-    }
-
-    return F_data_not;
-  }
-#endif // _di_f_accountss_increase_
-
-#ifndef _di_f_accountss_increase_by_
-  f_status_t f_accountss_increase_by(const f_number_unsigned_t amount, f_accountss_t *accountss) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accountss) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (!amount) return F_data_not;
-
-    if (accountss->used + amount > accountss->size) {
-      if (accountss->used + amount > F_number_t_size_unsigned_d) {
-        return F_status_set_error(F_array_too_large);
-      }
-
-      return private_f_accountss_resize(accountss->used + amount, accountss);
-    }
-
-    return F_data_not;
-  }
-#endif // _di_f_accountss_increase_by_
-
-#ifndef _di_f_accountss_resize_
-  f_status_t f_accountss_resize(const f_number_unsigned_t length, f_accountss_t *accountss) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!accountss) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    return private_f_accountss_resize(length, accountss);
-  }
-#endif // _di_f_accountss_resize_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 0fd8049f615e8fdc6ceb560c9133470cfc7dda82..b67e90698cc857ba8839d65550929aa92dfa0f23 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_f_account_delete_
-  extern f_status_t f_account_delete(f_account_t *account);
+  extern f_status_t f_account_delete(f_account_t * const account);
 #endif // _di_f_account_delete_
 
 /**
@@ -51,31 +51,35 @@ extern "C" {
  * @see f_string_dynamic_adjust()
  */
 #ifndef _di_f_account_destroy_
-  extern f_status_t f_account_destroy(f_account_t *account);
+  extern f_status_t f_account_destroy(f_account_t * const account);
 #endif // _di_f_account_destroy_
 
 /**
- * Resize the accounts array.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_accountss_t structure.
  *
- * @param length
- *   The new size to use.
- * @param accounts
- *   The accounts array to resize.
+ * This does not do parameter checking.
+ *
+ * @param start
+ *   The inclusive start position in the array to start deleting.
+ * @param stop
+ *   The exclusive stop position in the array to stop deleting.
+ * @param array
+ *   The array structure to delete all values of.
+ *   Must not be NULL.
  *
  * @return
  *   F_none on success.
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_string_dynamic_adjust().
+ *   Errors (with error bit) from: f_memory_array_adjust().
  *
- * @see f_memory_adjust()
- * @see f_string_dynamic_adjust()
+ * @see f_memory_array_adjust()
+ * @see f_memory_arrays_adjust()
  */
-#ifndef _di_f_accounts_adjust_
-  extern f_status_t f_accounts_adjust(const f_number_unsigned_t length, f_accounts_t *accounts);
-#endif // _di_f_accounts_adjust_
+#ifndef _di_f_accounts_adjust_callback_
+  extern f_status_t f_accounts_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_accounts_adjust_callback_
 
 /**
  * Append the single source account onto the destination.
@@ -98,7 +102,7 @@ extern "C" {
  * @see f_string_dynamic_append()
  */
 #ifndef _di_f_accounts_append_
-  extern f_status_t f_accounts_append(const f_account_t source, f_accounts_t *destination);
+  extern f_status_t f_accounts_append(const f_account_t source, f_accounts_t * const destination);
 #endif // _di_f_accounts_append_
 
 /**
@@ -122,168 +126,35 @@ extern "C" {
  * @see f_string_dynamic_append()
  */
 #ifndef _di_f_accounts_append_all_
-  extern f_status_t f_accounts_append_all(const f_accounts_t source, f_accounts_t *destination);
+  extern f_status_t f_accounts_append_all(const f_accounts_t source, f_accounts_t * const destination);
 #endif // _di_f_accounts_append_all_
 
 /**
- * Resize the accounts array to a smaller size.
- *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to les than 0.
- *
- * @param amount
- *   A positive number representing how much to decimate the size by.
- * @param accounts
- *   The accounts array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not if amount is 0.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_string_dynamic_adjust().
- *
- * @see f_memory_adjust()
- * @see f_string_dynamic_adjust()
- */
-#ifndef _di_f_accounts_decimate_by_
-  extern f_status_t f_accounts_decimate_by(const f_number_unsigned_t amount, f_accounts_t *accounts);
-#endif // _di_f_accounts_decimate_by_
-
-/**
- * Resize the accounts array to a smaller size.
- *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to les than 0.
- *
- * @param amount
- *   A positive number representing how much to decrease the size by.
- * @param accounts
- *   The accounts array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not if amount is 0.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accounts_decrease_by_
-  extern f_status_t f_accounts_decrease_by(const f_number_unsigned_t amount, f_accounts_t *accounts);
-#endif // _di_f_accounts_decrease_by_
-
-/**
- * Increase the size of the accounts array, but only if necesary.
- *
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param step
- *   The allocation step to use.
- *   Must be greater than 0.
- * @param accounts
- *   The accounts array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_accountss_t structure.
  *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accounts_increase_
-  extern f_status_t f_accounts_increase(const f_number_unsigned_t step, f_accounts_t *accounts);
-#endif // _di_f_accounts_increase_
-
-/**
- * Resize the accounts array to a larger size.
- *
- * This will resize making the array larger based on the given length.
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param accounts
- *   The accounts array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + amount <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accounts_increase_by_
-  extern f_status_t f_accounts_increase_by(const f_number_unsigned_t amount, f_accounts_t *accounts);
-#endif // _di_f_accounts_increase_by_
-
-/**
- * Resize the accounts array.
- *
- * @param length
- *   The new size to use.
- * @param accounts
- *   The accounts array to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accounts_resize_
-  extern f_status_t f_accounts_resize(const f_number_unsigned_t length, f_accounts_t *accounts);
-#endif // _di_f_accounts_resize_
-
-/**
- * Resize the string accountss array.
+ * This does not do parameter checking.
  *
- * @param length
- *   The new size to use.
- * @param accountss
- *   The string accountss array to resize.
+ * @param start
+ *   The inclusive start position in the array to start deleting.
+ * @param stop
+ *   The exclusive stop position in the array to stop deleting.
+ * @param array
+ *   The array structure to delete all values of.
+ *   Must not be NULL.
  *
  * @return
  *   F_none on success.
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_string_dynamic_adjust().
+ *   Errors (with error bit) from: f_memory_array_resize().
  *
- * @see f_memory_adjust()
- * @see f_string_dynamic_adjust()
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
  */
-#ifndef _di_f_accountss_adjust_
-  extern f_status_t f_accountss_adjust(const f_number_unsigned_t length, f_accountss_t *accountss);
-#endif // _di_f_accountss_adjust_
+#ifndef _di_f_accounts_resize_callback_
+  extern f_status_t f_accounts_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_accounts_resize_callback_
 
 /**
  * Append the single source accounts onto the destination.
@@ -306,7 +177,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_f_accountss_append_
-  extern f_status_t f_accountss_append(const f_accounts_t source, f_accountss_t *destination);
+  extern f_status_t f_accountss_append(const f_accounts_t source, f_accountss_t * const destination);
 #endif // _di_f_accountss_append_
 
 /**
@@ -330,144 +201,9 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_f_accountss_append_all_
-  extern f_status_t f_accountss_append_all(const f_accountss_t source, f_accountss_t *destination);
+  extern f_status_t f_accountss_append_all(const f_accountss_t source, f_accountss_t * const destination);
 #endif // _di_f_accountss_append_all_
 
-/**
- * Resize the string accountss array to a smaller size.
- *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to less than 0.
- *
- * @param amount
- *   A positive number representing how much to decimate the size by.
- * @param accountss
- *   The string accountss array to resize.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_string_dynamic_adjust().
- *
- * @see f_memory_adjust()
- * @see f_string_dynamic_adjust()
- */
-#ifndef _di_f_accountss_decimate_by_
-  extern f_status_t f_accountss_decimate_by(const f_number_unsigned_t amount, f_accountss_t *accountss);
-#endif // _di_f_accountss_decimate_by_
-
-/**
- * Resize the string accountss array to a smaller size.
- *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to less than 0.
- *
- * @param amount
- *   A positive number representing how much to decrease the size by.
- * @param accountss
- *   The string accountss array to resize.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accountss_decrease_by_
-  extern f_status_t f_accountss_decrease_by(const f_number_unsigned_t amount, f_accountss_t *accountss);
-#endif // _di_f_accountss_decrease_by_
-
-/**
- * Increase the size of the string accountss array, but only if necessary.
- *
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param step
- *   The allocation step to use.
- *   Must be greater than 0.
- * @param accountss
- *   The string accountss array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accountss_increase_
-  extern f_status_t f_accountss_increase(const f_number_unsigned_t step, f_accountss_t *accountss);
-#endif // _di_f_accountss_increase_
-
-/**
- * Resize the string accountss array to a larger size.
- *
- * This will resize making the array larger based on the given length.
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param accountss
- *   The string accountss array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + amount <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accountss_increase_by_
-  extern f_status_t f_accountss_increase_by(const f_number_unsigned_t amount, f_accountss_t *accountss);
-#endif // _di_f_accountss_increase_by_
-
-/**
- * Resize the string accountss array.
- *
- * @param length
- *   The new size to use.
- * @param accountss
- *   The accounts array to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- */
-#ifndef _di_f_accountss_resize_
-  extern f_status_t f_accountss_resize(const f_number_unsigned_t length, f_accountss_t *accountss);
-#endif // _di_f_accountss_resize_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 7ee1e8b28c9322354f729ef341825b220691b948..bdad4ba2d13aa4384127242231c972bc1f1b5966 100644 (file)
@@ -97,17 +97,6 @@ extern "C" {
   #define macro_f_accounts_t_initialize_2(array, length) { array, length, length }
 
   #define macro_f_accounts_t_clear(accounts) macro_f_memory_structures_clear(accounts)
-
-  #define macro_f_accounts_t_resize(status, accounts, length) status = f_accounts_resize(length, &accounts);
-  #define macro_f_accounts_t_adjust(status, accounts, length) status = f_accounts_adjust(length, &accounts);
-
-  #define macro_f_accounts_t_delete_simple(accounts)  f_accounts_resize(0, &accounts);
-  #define macro_f_accounts_t_destroy_simple(accounts) f_accounts_adjust(0, &accounts);
-
-  #define macro_f_accounts_t_increase(status, step, accounts)      status = f_accounts_increase(step, &accounts);
-  #define macro_f_accounts_t_increase_by(status, accounts, amount) status = f_accounts_increase_by(amount, &accounts);
-  #define macro_f_accounts_t_decrease_by(status, accounts, amount) status = f_accounts_decrease_by(amount, &accounts);
-  #define macro_f_accounts_t_decimate_by(status, accounts, amount) status = f_accounts_decimate_by(amount, &accounts);
 #endif // _di_f_accounts_t_
 
 /**
@@ -132,17 +121,6 @@ extern "C" {
   #define macro_f_accountss_t_initialize_2(array, length) { array, length, length }
 
   #define macro_f_accountss_t_clear(accountss) macro_f_memory_structures_clear(accountss)
-
-  #define macro_f_accountss_t_resize(status, accountss, length) status = f_accountss_resize(length, &accountss);
-  #define macro_f_accountss_t_adjust(status, accountss, length) status = f_accountss_adjust(length, &accountss);
-
-  #define macro_f_accountss_t_delete_simple(accountss)  f_accountss_resize(0, &accountss);
-  #define macro_f_accountss_t_destroy_simple(accountss) f_accountss_adjust(0, &accountss);
-
-  #define macro_f_accountss_t_increase(status, step, accountss)      status = f_accountss_increase(step, &accountss);
-  #define macro_f_accountss_t_increase_by(status, accountss, amount) status = f_accountss_increase_by(amount, &accountss);
-  #define macro_f_accountss_t_decrease_by(status, accountss, amount) status = f_accountss_decrease_by(amount, &accountss);
-  #define macro_f_accountss_t_decimate_by(status, accountss, amount) status = f_accountss_decimate_by(amount, &accountss);
 #endif // _di_f_accountss_t_
 
 #ifdef __cplusplus
index e3969d5574cdeab39209b2eaaba89b65ffa052dd..8f14e410ad5ba3ccf87510f05885de1ac9952fd7 100644 (file)
 extern "C" {
 #endif
 
-#if !defined(_di_f_account_delete_) || !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-  f_status_t private_f_account_delete(f_account_t *account) {
-
-    f_status_t status = f_string_dynamic_resize(0, &account->home);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_resize(0, &account->label);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_resize(0, &account->name);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_resize(0, &account->password);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_resize(0, &account->shell);
-    if (F_status_is_error(status)) return status;
-
-    return F_none;
-  }
-#endif // !defined(_di_f_account_delete_) || !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-
-#if !defined(_di_f_account_destroy_) || !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-  f_status_t private_f_account_destroy(f_account_t *account) {
-
-    f_status_t status = f_string_dynamic_adjust(0, &account->home);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_adjust(0, &account->label);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_adjust(0, &account->name);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_adjust(0, &account->password);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_adjust(0, &account->shell);
-    if (F_status_is_error(status)) return status;
-
-    return F_none;
-  }
-#endif // !defined(_di_f_account_destroy_) || !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-
-#if !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-  f_status_t private_f_accounts_adjust(const f_number_unsigned_t length, f_accounts_t *accounts) {
-
-    f_status_t status = F_none;
-
-    if (length < accounts->size) {
-      for (f_number_unsigned_t i = length; i < accounts->size; ++i) {
-
-        status = private_f_account_destroy(&accounts->array[i]);
-        if (F_status_is_error(status)) return status;
-      } // for
-    }
-
-    status = f_memory_adjust(accounts->size, length, sizeof(f_account_t), (void **) & accounts->array);
-    if (F_status_is_error(status)) return status;
-
-    accounts->size = length;
-
-    if (accounts->used > accounts->size) {
-      accounts->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-
-#if !defined(_di_f_accounts_append_) || !defined(_di_f_accountss_append_)
-  extern f_status_t private_f_accounts_append(const f_account_t source, f_accounts_t *destination) {
-
-    f_status_t status = F_none;
-
-    if (destination->used + 1 > destination->size) {
-      status = private_f_accounts_resize(destination->used + F_memory_default_allocation_small_d, destination);
-      if (F_status_is_error(status)) return status;
-    }
-
-    destination->array[destination->used].home.used = 0;
-    destination->array[destination->used].label.used = 0;
-    destination->array[destination->used].name.used = 0;
-    destination->array[destination->used].password.used = 0;
-    destination->array[destination->used].shell.used = 0;
-
-    status = f_string_dynamic_append(source.home, &destination->array[destination->used].home);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_append(source.label, &destination->array[destination->used].label);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_append(source.name, &destination->array[destination->used].name);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_append(source.password, &destination->array[destination->used].password);
-    if (F_status_is_error(status)) return status;
-
-    status = f_string_dynamic_append(source.shell, &destination->array[destination->used].shell);
-    if (F_status_is_error(status)) return status;
-
-    ++destination->used;
-
-    return F_none;
-  }
-#endif // !defined(_di_f_accounts_append_) || !defined(_di_f_accountss_append_)
-
 #if !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_append_all_) || !defined(_di_f_accountss_append_all_)
-  extern f_status_t private_f_accounts_append_all(const f_accounts_t source, f_accounts_t *destination) {
-
-    f_status_t status = F_none;
+  extern f_status_t private_f_accounts_append_all(const f_accounts_t source, f_accounts_t * const destination) {
 
-    if (destination->used + source.used > destination->size) {
-      status = private_f_accounts_resize(destination->used + source.used, destination);
-      if (F_status_is_error(status)) return status;
-    }
+    f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_account_t), (void **) &destination->array, &destination->used, &destination->size);
+    if (F_status_is_error(status)) return status;
 
     for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) {
 
@@ -151,98 +40,6 @@ extern "C" {
   }
 #endif // !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_append_all_) || !defined(_di_f_accountss_append_all_)
 
-#if !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-  f_status_t private_f_accounts_resize(const f_number_unsigned_t length, f_accounts_t *accounts) {
-
-    f_status_t status = F_none;
-
-    if (length < accounts->size) {
-      for (f_number_unsigned_t i = length; i < accounts->size; ++i) {
-
-        status = f_string_dynamic_resize(0, &accounts->array[i].home);
-        if (F_status_is_error(status)) return status;
-
-        status = f_string_dynamic_resize(0, &accounts->array[i].label);
-        if (F_status_is_error(status)) return status;
-
-        status = f_string_dynamic_resize(0, &accounts->array[i].name);
-        if (F_status_is_error(status)) return status;
-
-        status = f_string_dynamic_resize(0, &accounts->array[i].password);
-        if (F_status_is_error(status)) return status;
-
-        status = f_string_dynamic_resize(0, &accounts->array[i].shell);
-        if (F_status_is_error(status)) return status;
-      } // for
-    }
-
-    status = f_memory_resize(accounts->size, length, sizeof(f_account_t), (void **) & accounts->array);
-    if (F_status_is_error(status)) return status;
-
-    accounts->size = length;
-
-    if (accounts->used > accounts->size) {
-      accounts->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-
-#if !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-  f_status_t private_f_accountss_adjust(const f_number_unsigned_t length, f_accountss_t *accountss) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < accountss->size; ++i) {
-
-      status = private_f_accounts_adjust(0, &accountss->array[i]);
-      if (F_status_is_error(status)) return status;
-
-      accountss->array[i].size = 0;
-      accountss->array[i].used = 0;
-    } // for
-
-    status = f_memory_adjust(accountss->size, length, sizeof(f_accounts_t), (void **) & accountss->array);
-    if (F_status_is_error(status)) return status;
-
-    accountss->size = length;
-
-    if (accountss->used > accountss->size) {
-      accountss->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-
-#if !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-  f_status_t private_f_accountss_resize(const f_number_unsigned_t length, f_accountss_t *accountss) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < accountss->size; ++i) {
-
-      status = private_f_accounts_resize(0, &accountss->array[i]);
-      if (F_status_is_error(status)) return status;
-
-      accountss->array[i].size = 0;
-      accountss->array[i].used = 0;
-    } // for
-
-    status = f_memory_resize(accountss->size, length, sizeof(f_accounts_t), (void **) & accountss->array);
-    if (F_status_is_error(status)) return status;
-
-    accountss->size = length;
-
-    if (accountss->used > accountss->size) {
-      accountss->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 6483ed48225557c5bd138326529af1e5380e65b0..deb26c5d562d26dc7bb14f5acd406237af73e7b2 100644 (file)
@@ -16,115 +16,6 @@ extern "C" {
 #endif
 
 /**
- * Private implementation for resizing the account.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param account
- *   The account to delete.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_string_dynamic_resize()
- *
- * @see f_account_delete()
- * @see f_accounts_append()
- * @see f_accounts_decimate_by()
- * @see f_accounts_resize()
- * @see f_accountss_append()
- * @see f_accountss_decrease_by()
- * @see f_accountss_increase()
- * @see f_accountss_increase_by()
- * @see f_accountss_resize()
- */
-#if !defined(_di_f_account_delete_) || !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-  extern f_status_t private_f_account_delete(f_account_t *account) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_account_delete_) || !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-
-/**
- * Private implementation for resizing the account.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param account
- *   The account to delete.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_string_dynamic_adjust().
- *
- * @see f_string_dynamic_adjust()
- *
- * @see f_account_destroy()
- * @see f_accounts_adjust()
- * @see f_accounts_decimate_by()
- * @see f_accountss_adjust()
- * @see f_accountss_decimate_by()
- */
-#if !defined(_di_f_account_destroy_) || !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-  extern f_status_t private_f_account_destroy(f_account_t *account) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_account_destroy_) || !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-
-/**
- * Private implementation for resizing the accounts array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param accounts
- *   The accounts array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_string_dynamic_adjust().
- *
- * @see f_memory_adjust()
- * @see f_string_dynamic_adjust()
- *
- * @see f_accounts_adjust()
- * @see f_accounts_decimate_by()
- * @see f_accountss_adjust()
- * @see f_accountss_decimate_by()
- */
-#if !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-  extern f_status_t private_f_accounts_adjust(const f_number_unsigned_t length, f_accounts_t *accounts) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_accounts_adjust_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-
-/**
- * Private implementation for appending the account array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- *   The source account to append.
- * @param destination
- *   The destination lengths the source is appended onto.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_append().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_append()
- *
- * @see f_accounts_append()
- * @see f_accountss_append()
- */
-#if !defined(_di_f_accounts_append_) || !defined(_di_f_accountss_append_)
-  extern f_status_t private_f_accounts_append(const f_account_t source, f_accounts_t *destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_accounts_append_) || !defined(_di_f_accountss_append_)
-
-/**
  * Private implementation for appending the account array.
  *
  * Intended to be shared to each of the different implementation variations.
@@ -148,103 +39,9 @@ extern "C" {
  * @see f_accountss_append_all()
  */
 #if !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_append_all_) || !defined(_di_f_accountss_append_all_)
-  extern f_status_t private_f_accounts_append_all(const f_accounts_t source, f_accounts_t *destination) F_attribute_visibility_internal_d;
+  extern f_status_t private_f_accounts_append_all(const f_accounts_t source, f_accounts_t * const destination) F_attribute_visibility_internal_d;
 #endif // !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_append_all_) || !defined(_di_f_accountss_append_all_)
 
-/**
- * Private implementation for resizing the accounts array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param accounts
- *   The accounts array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_dynamic_resize().
- *
- * @see f_memory_resize()
- * @see f_string_dynamic_resize()
- *
- * @see f_accounts_append()
- * @see f_accounts_decimate_by()
- * @see f_accounts_resize()
- * @see f_accountss_append()
- * @see f_accountss_decrease_by()
- * @see f_accountss_increase()
- * @see f_accountss_increase_by()
- * @see f_accountss_resize()
- */
-#if !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-  extern f_status_t private_f_accounts_resize(const f_number_unsigned_t length, f_accounts_t *accounts) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_accounts_resize_) || !defined(_di_f_accounts_append_) || !defined(_di_f_accounts_decimate_by_) || !defined(_di_f_accountss_append_) || !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-
-/**
- * Private implementation for resizing the accountss array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param accountss
- *   The accountss array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if new length is larger than max array length.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_string_dynamic_adjust().
- *
- * @see f_memory_adjust()
- * @see f_string_dynamic_adjust()
- *
- * @see f_accountss_adjust()
- * @see f_accountss_decimate_by()
- */
-#if !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-  extern f_status_t private_f_accountss_adjust(const f_number_unsigned_t length, f_accountss_t *accountss) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_accountss_adjust_) || !defined(_di_f_accountss_decimate_by_)
-
-/**
- * Private implementation for resizing the accountss array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to resize to.
- * @param accountss
- *   The accountss array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if new length is larger than max array length.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_delete().
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_accountss_decrease_by()
- * @see f_accountss_increase()
- * @see f_accountss_increase_by()
- * @see f_accountss_resize()
- */
-#if !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-  extern f_status_t private_f_accountss_resize(const f_number_unsigned_t length, f_accountss_t *accountss) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_accountss_decrease_by_) || !defined(_di_f_accountss_increase_) || !defined(_di_f_accountss_increase_by_) || !defined(_di_f_accountss_resize_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 72125514eaef39ac24a07c1588d954e654a43fda..5f917a332f95d824fe5f847bdfe8ec698eede68f 100644 (file)
@@ -61,6 +61,8 @@ flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/
 flags_library -fPIC
 
 # Inject mocks.
+flags -Wl,--wrap=f_string_dynamic_adjust
+flags -Wl,--wrap=f_string_dynamic_resize
 flags -Wl,--wrap=getpwnam_r
 flags -Wl,--wrap=getpwuid_r
 flags -Wl,--wrap=getgrnam_r
index 65971530bf7468efd7047b67da82421cc1693eee..d752945222ade61a4b99ce444582ec288de6aa47 100644 (file)
@@ -26,8 +26,8 @@ build_libraries -lc -lcmocka
 build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_account
 
 build_sources_program test-account-by_id.c test-account-by_name.c test-account-group_name_by_id.c test-account-group_id_by_name.c test-account-id_by_name.c test-account-name_by_id.c
-build_sources_program test-account-s_adjust.c test-account-s_append.c test-account-s_append_all.c test-account-s_decimate_by.c test-account-s_decrease_by.c test-account-s_increase.c test-account-s_increase_by.c test-account-s_resize.c
-build_sources_program test-account-ss_adjust.c test-account-ss_append.c test-account-ss_append_all.c test-account-ss_decimate_by.c test-account-ss_decrease_by.c test-account-ss_increase.c test-account-ss_increase_by.c test-account-ss_resize.c
+build_sources_program test-account-s_adjust_callback.c test-account-s_append.c test-account-s_append_all.c test-account-s_resize_callback.c
+build_sources_program test-account-ss_append.c test-account-ss_append_all.c
 build_sources_program test-account.c
 
 build_script no
index caf13ccf08d22fc144bf27f58d74a8fe0327eda3..00add2fbf7e02af5adcc058264dfa640746c9746 100644 (file)
@@ -4,6 +4,42 @@
 extern "C" {
 #endif
 
+int mock_unwrap = 0;
+
+f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure) {
+
+  if (mock_unwrap) {
+    return __real_f_string_dynamic_adjust(length, structure);
+  }
+
+  if (!structure) return F_status_set_error(F_parameter_not);
+
+  const bool failure = mock_type(bool);
+
+  if (failure) return mock_type(f_status_t);
+
+  structure->size = length;
+
+  return mock_type(f_status_t);
+}
+
+f_status_t __wrap_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure) {
+
+  if (mock_unwrap) {
+    return __real_f_string_dynamic_resize(length, structure);
+  }
+
+  if (!structure) return F_status_set_error(F_parameter_not);
+
+  const bool failure = mock_type(bool);
+
+  if (failure) return mock_type(f_status_t);
+
+  structure->size = length;
+
+  return mock_type(f_status_t);
+}
+
 int __wrap_getpwnam_r(const char * const name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result) {
 
   const bool failure = mock_type(bool);
index 81ccc1658e58560f5770101918aaef590253e715..76c04124587aa3b02ebce86d871ef9e0dc11bf29 100644 (file)
@@ -28,6 +28,14 @@ extern "C" {
 
 const static int mock_errno_generic = 32767;
 
+extern int mock_unwrap;
+
+extern f_status_t __real_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure);
+extern f_status_t __real_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure);
+
+extern f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure);
+extern f_status_t __wrap_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure);
+
 extern int __wrap_getpwnam_r(const char * const name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result);
 extern int __wrap_getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result);
 extern int __wrap_getgrgid_r(uid_t uid, struct group *grp, char *buf, size_t buflen, struct group **result);
index 317ba1125da4796a5988d6f6727d3e333886f913..673d83d031e5f4bee39b29e95ad46e99c92fedd2 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_account_by_id__fails(void **state) {
 
+  mock_unwrap = 1;
+
   const long size = 20;
   uid_t uid = 0;
   f_account_t account = f_account_t_initialize;
@@ -47,6 +49,8 @@ void test__f_account_by_id__fails(void **state) {
 
 void test__f_account_by_id__not_found(void **state) {
 
+  mock_unwrap = 1;
+
   const long size = 20;
   struct passwd password;
   uid_t uid = 0;
@@ -77,6 +81,8 @@ void test__f_account_by_id__parameter_checking(void **state) {
 
 void test__f_account_by_id__works(void **state) {
 
+  mock_unwrap = 1;
+
   const long size = 20;
   struct passwd password;
   struct passwd pointer;
index b302eb8409709b9b5b9b676d7c28c22f39af5777..07775c703b2cb33909ae027c9add01efc7de3bf9 100644 (file)
@@ -7,6 +7,8 @@ extern "C" {
 
 void test__f_account_by_name__fails(void **state) {
 
+  mock_unwrap = 1;
+
   const long size = 20;
   f_account_t account = f_account_t_initialize;
 
index 30093137113568be89874d37f68e26925a8e26e2..fb352e650512ba0bc5c772493274b26aba0a72ed 100644 (file)
@@ -77,6 +77,8 @@ void test__f_account_group_name_by_id__parameter_checking(void **state) {
 
 void test__f_account_group_name_by_id__works(void **state) {
 
+  mock_unwrap = 0;
+
   const long size = 20;
   struct group group_data;
   struct group pointer;
index e8bf6d9a589fff023fc95e39beb0fe659e3f05ec..5bbc0938746f3366fe7094b4cf3b48a3858bee89 100644 (file)
@@ -77,6 +77,8 @@ void test__f_account_name_by_id__parameter_checking(void **state) {
 
 void test__f_account_name_by_id__works(void **state) {
 
+  mock_unwrap = 0;
+
   const long size = 20;
   struct passwd password;
   struct passwd pointer;
diff --git a/level_0/f_account/tests/unit/c/test-account-s_adjust.c b/level_0/f_account/tests/unit/c/test-account-s_adjust.c
deleted file mode 100644 (file)
index 52bbd86..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-account.h"
-#include "test-account-s_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accounts_adjust__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_adjust__works(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_account/tests/unit/c/test-account-s_adjust.h b/level_0/f_account/tests/unit/c/test-account-s_adjust.h
deleted file mode 100644 (file)
index 0cf011e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_s_adjust
-#define _TEST__F_account_s_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accounts_adjust()
- */
-extern void test__f_accounts_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accounts_adjust()
- */
-extern void test__f_accounts_adjust__works(void **state);
-
-#endif // _TEST__F_account_s_adjust
diff --git a/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.c b/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.c
new file mode 100644 (file)
index 0000000..37bcc5a
--- /dev/null
@@ -0,0 +1,61 @@
+#include "test-account.h"
+#include "test-account-s_adjust_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_accounts_adjust_callback__fails(void **state) {
+
+  mock_unwrap = 0;
+
+  f_account_t data = f_account_t_initialize;
+  f_account_t data_array[] = { data };
+  f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_accounts_t datass_array[] = { datas };
+
+  {
+    will_return(__wrap_f_string_dynamic_adjust, true);
+    will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure));
+
+    const f_status_t status = f_accounts_adjust_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+}
+
+void test__f_accounts_adjust_callback__works(void **state) {
+
+  mock_unwrap = 0;
+
+  f_account_t data = f_account_t_initialize;
+  f_account_t data_array[] = { data };
+  f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_accounts_t datass_array[] = { datas };
+  const f_number_unsigned_t length = 1;
+
+  {
+    will_return(__wrap_f_string_dynamic_adjust, false);
+    will_return(__wrap_f_string_dynamic_adjust, F_none);
+
+    will_return(__wrap_f_string_dynamic_adjust, false);
+    will_return(__wrap_f_string_dynamic_adjust, F_none);
+
+    will_return(__wrap_f_string_dynamic_adjust, false);
+    will_return(__wrap_f_string_dynamic_adjust, F_none);
+
+    will_return(__wrap_f_string_dynamic_adjust, false);
+    will_return(__wrap_f_string_dynamic_adjust, F_none);
+
+    will_return(__wrap_f_string_dynamic_adjust, false);
+    will_return(__wrap_f_string_dynamic_adjust, F_none);
+
+    const f_status_t status = f_accounts_adjust_callback(0, length, (void *) datass_array);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.h b/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.h
new file mode 100644 (file)
index 0000000..98039dd
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Account
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_account__s_adjust_callback
+#define _TEST__F_account__s_adjust_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_accounts_adjust_callback()
+ */
+extern void test__f_accounts_adjust_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_accounts_adjust_callback()
+ */
+extern void test__f_accounts_adjust_callback__works(void **state);
+
+#endif // _TEST__F_account__s_adjust_callback
index 4096618d3997db75797dddd7eb6d571b0489f533..bb5b43b1bbb8d49182835565d845363ee745d9b6 100644 (file)
@@ -18,6 +18,8 @@ void test__f_accounts_append__parameter_checking(void **state) {
 
 void test__f_accounts_append__works(void **state) {
 
+  mock_unwrap = 1;
+
   f_string_static_t home = macro_f_string_static_t_initialize_1("home", 0, 4);
   f_string_static_t label = macro_f_string_static_t_initialize_1("label", 0, 5);
   f_string_static_t name = macro_f_string_static_t_initialize_1("name", 0, 4);
@@ -46,6 +48,11 @@ void test__f_accounts_append__works(void **state) {
     assert_int_equal(destination.array[0].shell.used, source.shell.used);
   }
 
+  free((void *) destination.array[0].home.string);
+  free((void *) destination.array[0].label.string);
+  free((void *) destination.array[0].name.string);
+  free((void *) destination.array[0].password.string);
+  free((void *) destination.array[0].shell.string);
   free((void *) destination.array);
 }
 
index 87ad93eb6b104db5eca3f5ea5400528aa04bf08b..18118177b8183bfd2a418dc23c2265b75d830bd2 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: Account
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
index 4de5cf567b908cf71bb50c79a45d9ca70e285803..fa7e1f6b458ad5c30c436a19617ba1a25da13dd8 100644 (file)
@@ -23,7 +23,7 @@ void test__f_accounts_append_all__returns_data_not(void **state) {
   f_accounts_t destination = f_accounts_t_initialize;
 
   {
-    const f_status_t status = f_accounts_resize(length, &source);
+    const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &source.array, &source.used, &source.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
@@ -44,6 +44,8 @@ void test__f_accounts_append_all__returns_data_not(void **state) {
 
 void test__f_accounts_append_all__works(void **state) {
 
+  mock_unwrap = 1;
+
   const int length = 5;
   f_accounts_t source = f_accounts_t_initialize;
   f_accounts_t destination = f_accounts_t_initialize;
@@ -64,7 +66,7 @@ void test__f_accounts_append_all__works(void **state) {
   const f_account_t account_1 = { .home = home_1, .label = label_1, .name = name_1, .password = password_1, .shell = shell_1 };
 
   {
-    const f_status_t status = f_accounts_resize(length, &source);
+    const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &source.array, &source.used, &source.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
@@ -95,6 +97,17 @@ void test__f_accounts_append_all__works(void **state) {
   }
 
   free((void *) source.array);
+
+  free((void *) destination.array[0].home.string);
+  free((void *) destination.array[0].label.string);
+  free((void *) destination.array[0].name.string);
+  free((void *) destination.array[0].password.string);
+  free((void *) destination.array[0].shell.string);
+  free((void *) destination.array[1].home.string);
+  free((void *) destination.array[1].label.string);
+  free((void *) destination.array[1].name.string);
+  free((void *) destination.array[1].password.string);
+  free((void *) destination.array[1].shell.string);
   free((void *) destination.array);
 }
 
index 056fa310ac4f7633ea858a9de2cd286993bcad5a..43ef5faf1eb2e3f1fa8d64047447ae3bbdbd9c95 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: Account
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
diff --git a/level_0/f_account/tests/unit/c/test-account-s_decimate_by.c b/level_0/f_account/tests/unit/c/test-account-s_decimate_by.c
deleted file mode 100644 (file)
index 063d1f0..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "test-account.h"
-#include "test-account-s_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accounts_decimate_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_decimate_by__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_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_accounts_decimate_by__works(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_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_account/tests/unit/c/test-account-s_decimate_by.h b/level_0/f_account/tests/unit/c/test-account-s_decimate_by.h
deleted file mode 100644 (file)
index 2c13180..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_s_decimate_by
-#define _TEST__F_account_s_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accounts_decimate_by()
- */
-extern void test__f_accounts_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accounts_decimate_by()
- */
-extern void test__f_accounts_decimate_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accounts_decimate_by()
- */
-extern void test__f_accounts_decimate_by__works(void **state);
-
-#endif // _TEST__F_account_s_decimate_by
diff --git a/level_0/f_account/tests/unit/c/test-account-s_decrease_by.c b/level_0/f_account/tests/unit/c/test-account-s_decrease_by.c
deleted file mode 100644 (file)
index 7ad19a4..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "test-account.h"
-#include "test-account-s_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accounts_decrease_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_decrease_by__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_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_accounts_decrease_by__works(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_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_account/tests/unit/c/test-account-s_decrease_by.h b/level_0/f_account/tests/unit/c/test-account-s_decrease_by.h
deleted file mode 100644 (file)
index bd6394c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_s_decrease_by
-#define _TEST__F_account_s_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accounts_decrease_by()
- */
-extern void test__f_accounts_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accounts_decrease_by()
- */
-extern void test__f_accounts_decrease_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accounts_decrease_by()
- */
-extern void test__f_accounts_decrease_by__works(void **state);
-
-#endif // _TEST__F_account_s_decrease_by
diff --git a/level_0/f_account/tests/unit/c/test-account-s_increase.c b/level_0/f_account/tests/unit/c/test-account-s_increase.c
deleted file mode 100644 (file)
index e528c88..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "test-account.h"
-#include "test-account-s_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accounts_increase__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_increase__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_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_accounts_increase__works(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_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_account/tests/unit/c/test-account-s_increase.h b/level_0/f_account/tests/unit/c/test-account-s_increase.h
deleted file mode 100644 (file)
index a953829..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_s_increase
-#define _TEST__F_account_s_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accounts_increase()
- */
-extern void test__f_accounts_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accounts_increase()
- */
-extern void test__f_accounts_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accounts_increase()
- */
-extern void test__f_accounts_increase__works(void **state);
-
-#endif // _TEST__F_account_s_increase
diff --git a/level_0/f_account/tests/unit/c/test-account-s_increase_by.c b/level_0/f_account/tests/unit/c/test-account-s_increase_by.c
deleted file mode 100644 (file)
index c551006..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "test-account.h"
-#include "test-account-s_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accounts_increase_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_increase_by__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_increase_by(0, &data);
-
-    assert_int_equal(status, F_data_not);
-    assert_int_equal(data.used, 0);
-    assert_int_equal(data.size, length);
-  }
-
-  free((void *) data.array);
-}
-
-void test__f_accounts_increase_by__works(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_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_account/tests/unit/c/test-account-s_increase_by.h b/level_0/f_account/tests/unit/c/test-account-s_increase_by.h
deleted file mode 100644 (file)
index fc386c4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_s_increase_by
-#define _TEST__F_account_s_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accounts_increase_by()
- */
-extern void test__f_accounts_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accounts_increase_by()
- */
-extern void test__f_accounts_increase_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accounts_increase_by()
- */
-extern void test__f_accounts_increase_by__works(void **state);
-
-#endif // _TEST__F_account_s_increase_by
diff --git a/level_0/f_account/tests/unit/c/test-account-s_resize.c b/level_0/f_account/tests/unit/c/test-account-s_resize.c
deleted file mode 100644 (file)
index b67cbab..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-account.h"
-#include "test-account-s_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accounts_resize__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_accounts_resize__works(void **state) {
-
-  const int length = 5;
-  f_accounts_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accounts_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_account/tests/unit/c/test-account-s_resize.h b/level_0/f_account/tests/unit/c/test-account-s_resize.h
deleted file mode 100644 (file)
index 9cb047d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_s_resize
-#define _TEST__F_account_s_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accounts_resize()
- */
-extern void test__f_accounts_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accounts_resize()
- */
-extern void test__f_accounts_resize__works(void **state);
-
-#endif // _TEST__F_account_s_resize
diff --git a/level_0/f_account/tests/unit/c/test-account-s_resize_callback.c b/level_0/f_account/tests/unit/c/test-account-s_resize_callback.c
new file mode 100644 (file)
index 0000000..abcd324
--- /dev/null
@@ -0,0 +1,127 @@
+#include "test-account.h"
+#include "test-account-s_resize_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_accounts_resize_callback__fails(void **state) {
+
+  mock_unwrap = 0;
+
+  f_account_t data = f_account_t_initialize;
+  f_account_t data_array[] = { data };
+  f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_accounts_t datass_array[] = { datas };
+
+  {
+    will_return(__wrap_f_string_dynamic_resize, true);
+    will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, true);
+    will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, true);
+    will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, true);
+    will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, true);
+    will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+}
+
+void test__f_accounts_resize_callback__works(void **state) {
+
+  mock_unwrap = 0;
+
+  f_account_t data = f_account_t_initialize;
+  f_account_t data_array[] = { data };
+  f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_accounts_t datass_array[] = { datas };
+  const f_number_unsigned_t length = 1;
+
+  {
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    will_return(__wrap_f_string_dynamic_resize, false);
+    will_return(__wrap_f_string_dynamic_resize, F_none);
+
+    const f_status_t status = f_accounts_resize_callback(0, length, (void *) datass_array);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_account/tests/unit/c/test-account-s_resize_callback.h b/level_0/f_account/tests/unit/c/test-account-s_resize_callback.h
new file mode 100644 (file)
index 0000000..3fe68d0
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: Account
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_account__s_resize_callback
+#define _TEST__F_account__s_resize_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_accounts_resize_callback()
+ */
+extern void test__f_accounts_resize_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_accounts_resize_callback()
+ */
+extern void test__f_accounts_resize_callback__works(void **state);
+
+#endif // _TEST__F_account__s_resize_callback
diff --git a/level_0/f_account/tests/unit/c/test-account-ss_adjust.c b/level_0/f_account/tests/unit/c/test-account-ss_adjust.c
deleted file mode 100644 (file)
index 66360a1..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-account.h"
-#include "test-account-ss_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accountss_adjust__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_adjust__works(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_account/tests/unit/c/test-account-ss_adjust.h b/level_0/f_account/tests/unit/c/test-account-ss_adjust.h
deleted file mode 100644 (file)
index ae4a766..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_ss_adjust
-#define _TEST__F_account_ss_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accountss_adjust()
- */
-extern void test__f_accountss_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accountss_adjust()
- */
-extern void test__f_accountss_adjust__works(void **state);
-
-#endif // _TEST__F_account_ss_adjust
index 081534963bb1cb02480665a8916ba6781ac9ef18..66a1e1d31c590432f9ab727ae386e98a2d4e2a89 100644 (file)
@@ -23,7 +23,7 @@ void test__f_accountss_append__returns_data_not(void **state) {
   f_accountss_t destination = f_accountss_t_initialize;
 
   {
-    const f_status_t status = f_accounts_resize(length, &source);
+    const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &source.array, &source.used, &source.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
@@ -44,6 +44,8 @@ void test__f_accountss_append__returns_data_not(void **state) {
 
 void test__f_accountss_append__works(void **state) {
 
+  mock_unwrap = 1;
+
   const int length = 5;
   f_accounts_t sources = f_accounts_t_initialize;
   f_accountss_t destination = f_accountss_t_initialize;
@@ -57,7 +59,7 @@ void test__f_accountss_append__works(void **state) {
   const f_account_t source = { .home = home, .label = label, .name = name, .password = password, .shell = shell };
 
   {
-    const f_status_t status = f_accounts_resize(length, &sources);
+    const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &sources.array, &sources.used, &sources.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(sources.used, 0);
@@ -93,6 +95,16 @@ void test__f_accountss_append__works(void **state) {
   }
 
   for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
+
+    for (f_number_unsigned_t j = 0; j < destination.array[i].used; ++j) {
+
+      free((void *) destination.array[i].array[j].home.string);
+      free((void *) destination.array[i].array[j].label.string);
+      free((void *) destination.array[i].array[j].name.string);
+      free((void *) destination.array[i].array[j].password.string);
+      free((void *) destination.array[i].array[j].shell.string);
+    }
+
     free((void *) destination.array[i].array);
   } // for
 
index a45dd7014f857eb6f367e4716c5f9f3552c42d88..ca626a4152c09e6adb78ed9a341e60f30ad0b6dc 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: Account
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
index 09afa82abd558008ace65074e06ecc1947d3f226..e4e1cca480bbf69224b9de6f8fd70af73e787303 100644 (file)
@@ -23,7 +23,7 @@ void test__f_accountss_append_all__returns_data_not(void **state) {
   f_accountss_t destination = f_accountss_t_initialize;
 
   {
-    const f_status_t status = f_accountss_resize(length, &source);
+    const f_status_t status = f_memory_arrays_resize(length, sizeof(f_accounts_t), (void **) &source.array, &source.used, &source.size, &f_accounts_resize_callback);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
@@ -44,6 +44,8 @@ void test__f_accountss_append_all__returns_data_not(void **state) {
 
 void test__f_accountss_append_all__works(void **state) {
 
+  mock_unwrap = 1;
+
   const int length = 5;
   const int length_inner = 2;
   f_accountss_t source = f_accountss_t_initialize;
@@ -65,7 +67,7 @@ void test__f_accountss_append_all__works(void **state) {
   const f_account_t account_1 = { .home = home_1, .label = label_1, .name = name_1, .password = password_1, .shell = shell_1 };
 
   {
-    const f_status_t status = f_accountss_resize(length, &source);
+    const f_status_t status = f_memory_arrays_resize(length, sizeof(f_accounts_t), (void **) &source.array, &source.used, &source.size, &f_accounts_resize_callback);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
@@ -75,7 +77,7 @@ void test__f_accountss_append_all__works(void **state) {
   {
     for (; source.used < length; ++source.used) {
 
-      const f_status_t status = f_accounts_resize(length_inner, &source.array[source.used]);
+      const f_status_t status = f_memory_array_resize(length_inner, sizeof(f_account_t), (void **) &source.array[source.used].array, &source.array[source.used].used, &source.array[source.used].size);
 
       assert_int_equal(status, F_none);
 
@@ -115,6 +117,16 @@ void test__f_accountss_append_all__works(void **state) {
   } // for
 
   for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
+
+    for (f_number_unsigned_t j = 0; j < destination.array[i].used; ++j) {
+
+      free((void *) destination.array[i].array[j].home.string);
+      free((void *) destination.array[i].array[j].label.string);
+      free((void *) destination.array[i].array[j].name.string);
+      free((void *) destination.array[i].array[j].password.string);
+      free((void *) destination.array[i].array[j].shell.string);
+    }
+
     free((void *) destination.array[i].array);
   } // for
 
index a7288323710b93636978be7ed44d1d9e3c9f04cc..4074adb77ec5bf79d57ab61656b8efb6c3116f7a 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: Account
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
diff --git a/level_0/f_account/tests/unit/c/test-account-ss_decimate_by.c b/level_0/f_account/tests/unit/c/test-account-ss_decimate_by.c
deleted file mode 100644 (file)
index e9af665..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "test-account.h"
-#include "test-account-ss_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accountss_decimate_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_decimate_by__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_accountss_decimate_by__works(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_account/tests/unit/c/test-account-ss_decimate_by.h b/level_0/f_account/tests/unit/c/test-account-ss_decimate_by.h
deleted file mode 100644 (file)
index 4ac5cc2..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_ss_decimate_by
-#define _TEST__F_account_ss_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accountss_decimate_by()
- */
-extern void test__f_accountss_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accountss_decimate_by()
- */
-extern void test__f_accountss_decimate_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accountss_decimate_by()
- */
-extern void test__f_accountss_decimate_by__works(void **state);
-
-#endif // _TEST__F_account_ss_decimate_by
diff --git a/level_0/f_account/tests/unit/c/test-account-ss_decrease_by.c b/level_0/f_account/tests/unit/c/test-account-ss_decrease_by.c
deleted file mode 100644 (file)
index 34fc020..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "test-account.h"
-#include "test-account-ss_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accountss_decrease_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_decrease_by__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_accountss_decrease_by__works(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_account/tests/unit/c/test-account-ss_decrease_by.h b/level_0/f_account/tests/unit/c/test-account-ss_decrease_by.h
deleted file mode 100644 (file)
index cdf0b2c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_ss_decrease_by
-#define _TEST__F_account_ss_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accountss_decrease_by()
- */
-extern void test__f_accountss_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accountss_decrease_by()
- */
-extern void test__f_accountss_decrease_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accountss_decrease_by()
- */
-extern void test__f_accountss_decrease_by__works(void **state);
-
-#endif // _TEST__F_account_ss_decrease_by
diff --git a/level_0/f_account/tests/unit/c/test-account-ss_increase.c b/level_0/f_account/tests/unit/c/test-account-ss_increase.c
deleted file mode 100644 (file)
index 710c2e2..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "test-account.h"
-#include "test-account-ss_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accountss_increase__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_increase__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_accountss_increase__works(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_account/tests/unit/c/test-account-ss_increase.h b/level_0/f_account/tests/unit/c/test-account-ss_increase.h
deleted file mode 100644 (file)
index 67326d0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_ss_increase
-#define _TEST__F_account_ss_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accountss_increase()
- */
-extern void test__f_accountss_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accountss_increase()
- */
-extern void test__f_accountss_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accountss_increase()
- */
-extern void test__f_accountss_increase__works(void **state);
-
-#endif // _TEST__F_account_ss_increase
diff --git a/level_0/f_account/tests/unit/c/test-account-ss_increase_by.c b/level_0/f_account/tests/unit/c/test-account-ss_increase_by.c
deleted file mode 100644 (file)
index 0398ccf..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "test-account.h"
-#include "test-account-ss_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accountss_increase_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_increase_by__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_accountss_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_account_decrease_by__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_accountss_increase_by__works(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accounts_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_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_account/tests/unit/c/test-account-ss_increase_by.h b/level_0/f_account/tests/unit/c/test-account-ss_increase_by.h
deleted file mode 100644 (file)
index 20d99fa..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_ss_increase_by
-#define _TEST__F_account_ss_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accountss_increase_by()
- */
-extern void test__f_accountss_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_accountss_increase_by()
- */
-extern void test__f_accountss_increase_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accountss_increase_by()
- */
-extern void test__f_accountss_increase_by__works(void **state);
-
-#endif // _TEST__F_account_ss_increase_by
diff --git a/level_0/f_account/tests/unit/c/test-account-ss_resize.c b/level_0/f_account/tests/unit/c/test-account-ss_resize.c
deleted file mode 100644 (file)
index d37cd77..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-account.h"
-#include "test-account-ss_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_accountss_resize__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_accountss_resize__works(void **state) {
-
-  const int length = 5;
-  f_accountss_t data = f_accountss_t_initialize;
-
-  {
-    const f_status_t status = f_accountss_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_account/tests/unit/c/test-account-ss_resize.h b/level_0/f_account/tests/unit/c/test-account-ss_resize.h
deleted file mode 100644 (file)
index 1df4e83..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_account_ss_resize
-#define _TEST__F_account_ss_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_accountss_resize()
- */
-extern void test__f_accountss_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_accountss_resize()
- */
-extern void test__f_accountss_resize__works(void **state);
-
-#endif // _TEST__F_account_ss_resize
index 3eef52c9cd2e60efb0fc95a70b1e02e70ebd7740..a6c2512df1d33a1430b6a2d2d982243a83b93f26 100644 (file)
@@ -43,36 +43,22 @@ int main(void) {
     cmocka_unit_test(test__f_account_name_by_id__not_found),
     cmocka_unit_test(test__f_account_name_by_id__works),
 
+    cmocka_unit_test(test__f_accounts_adjust_callback__fails),
+    cmocka_unit_test(test__f_accounts_resize_callback__fails),
+
+    cmocka_unit_test(test__f_accounts_adjust_callback__works),
+    cmocka_unit_test(test__f_accounts_resize_callback__works),
+
     cmocka_unit_test(test__f_accounts_append_all__returns_data_not),
-    cmocka_unit_test(test__f_accounts_decimate_by__returns_data_not),
-    cmocka_unit_test(test__f_accounts_decrease_by__returns_data_not),
-    cmocka_unit_test(test__f_accounts_increase__returns_data_not),
-    cmocka_unit_test(test__f_accounts_increase_by__returns_data_not),
 
-    cmocka_unit_test(test__f_accounts_adjust__works),
     cmocka_unit_test(test__f_accounts_append__works),
     cmocka_unit_test(test__f_accounts_append_all__works),
-    cmocka_unit_test(test__f_accounts_decimate_by__works),
-    cmocka_unit_test(test__f_accounts_decrease_by__works),
-    cmocka_unit_test(test__f_accounts_increase__works),
-    cmocka_unit_test(test__f_accounts_increase_by__works),
-    cmocka_unit_test(test__f_accounts_resize__works),
 
     cmocka_unit_test(test__f_accountss_append__returns_data_not),
     cmocka_unit_test(test__f_accountss_append_all__returns_data_not),
-    cmocka_unit_test(test__f_accountss_decimate_by__returns_data_not),
-    cmocka_unit_test(test__f_accountss_decrease_by__returns_data_not),
-    cmocka_unit_test(test__f_accountss_increase__returns_data_not),
-    cmocka_unit_test(test__f_accountss_increase_by__returns_data_not),
 
-    cmocka_unit_test(test__f_accountss_adjust__works),
     cmocka_unit_test(test__f_accountss_append__works),
     cmocka_unit_test(test__f_accountss_append_all__works),
-    cmocka_unit_test(test__f_accountss_decimate_by__works),
-    cmocka_unit_test(test__f_accountss_decrease_by__works),
-    cmocka_unit_test(test__f_accountss_increase__works),
-    cmocka_unit_test(test__f_accountss_increase_by__works),
-    cmocka_unit_test(test__f_accountss_resize__works),
 
     #ifndef _di_level_0_parameter_checking_
       cmocka_unit_test(test__f_account_by_id__parameter_checking),
@@ -82,23 +68,14 @@ int main(void) {
       cmocka_unit_test(test__f_account_id_by_name__parameter_checking),
       cmocka_unit_test(test__f_account_name_by_id__parameter_checking),
 
-      cmocka_unit_test(test__f_accounts_adjust__parameter_checking),
+      // f_accounts_adjust_callback() doesn't use parameter checking.
+      // f_accounts_resize_callback() doesn't use parameter checking.
+
       cmocka_unit_test(test__f_accounts_append__parameter_checking),
       cmocka_unit_test(test__f_accounts_append_all__parameter_checking),
-      cmocka_unit_test(test__f_accounts_decimate_by__parameter_checking),
-      cmocka_unit_test(test__f_accounts_decrease_by__parameter_checking),
-      cmocka_unit_test(test__f_accounts_increase__parameter_checking),
-      cmocka_unit_test(test__f_accounts_increase_by__parameter_checking),
-      cmocka_unit_test(test__f_accounts_resize__parameter_checking),
 
-      cmocka_unit_test(test__f_accountss_adjust__parameter_checking),
       cmocka_unit_test(test__f_accountss_append__parameter_checking),
       cmocka_unit_test(test__f_accountss_append_all__parameter_checking),
-      cmocka_unit_test(test__f_accountss_decimate_by__parameter_checking),
-      cmocka_unit_test(test__f_accountss_decrease_by__parameter_checking),
-      cmocka_unit_test(test__f_accountss_increase__parameter_checking),
-      cmocka_unit_test(test__f_accountss_increase_by__parameter_checking),
-      cmocka_unit_test(test__f_accountss_resize__parameter_checking),
     #endif // _di_level_0_parameter_checking_
   };
 
index 89f1b8ca4e99ac3d53f71bbe89358934f5d0b79e..d2689c0ea1b7a474b2f8512385f3a1cf4d63c651 100644 (file)
 #include "test-account-group_name_by_id.h"
 #include "test-account-id_by_name.h"
 #include "test-account-name_by_id.h"
-#include "test-account-s_adjust.h"
+#include "test-account-s_adjust_callback.h"
 #include "test-account-s_append.h"
 #include "test-account-s_append_all.h"
-#include "test-account-s_decimate_by.h"
-#include "test-account-s_decrease_by.h"
-#include "test-account-s_increase.h"
-#include "test-account-s_increase_by.h"
-#include "test-account-s_resize.h"
-#include "test-account-ss_adjust.h"
+#include "test-account-s_resize_callback.h"
 #include "test-account-ss_append.h"
 #include "test-account-ss_append_all.h"
-#include "test-account-ss_decimate_by.h"
-#include "test-account-ss_decrease_by.h"
-#include "test-account-ss_increase.h"
-#include "test-account-ss_increase_by.h"
-#include "test-account-ss_resize.h"
 
 #ifdef __cplusplus
 extern "C" {
index 541ee4ea126d9af6e3cde3936bbea0934fdac925..f2f5f339cbe19a02cb39f73fdfecb7c084f4a69c 100644 (file)
@@ -244,17 +244,6 @@ extern "C" {
 
   #define macro_f_iki_datas_t_initialize_1(content, size, used) { array, size, used }
   #define macro_f_iki_datas_t_initialize_2(array, length) { array, length, length }
-
-  #define macro_f_iki_datas_t_resize(status, datas, length) status = f_iki_datas_resize(length, &datas);
-  #define macro_f_iki_datas_t_adjust(status, datas, length) status = f_iki_datas_adjust(length, &datas);
-
-  #define macro_f_iki_datas_t_delete_simple(datas)  status = f_iki_datas_resize(0, &datas);
-  #define macro_f_iki_datas_t_destroy_simple(datas) status = f_iki_datas_adjust(0, &datas);
-
-  #define macro_f_iki_datas_t_increase(status, step, datas)      status = f_iki_datas_increase(step, &datas);
-  #define macro_f_iki_datas_t_increase_by(status, datas, amount) status = f_iki_datas_increase_by(amount, &datas);
-  #define macro_f_iki_datas_t_decrease_by(status, datas, amount) status = f_iki_datas_decrease_by(amount, &datas);
-  #define macro_f_iki_datas_t_decimate_by(status, datas, amount) status = f_iki_datas_decimate_by(amount, &datas);
 #endif // _di_f_iki_datas_t_
 
 /**
@@ -277,17 +266,6 @@ extern "C" {
 
   #define macro_f_iki_datass_t_initialize_1(content, size, used) { array, size, used }
   #define macro_f_iki_datass_t_initialize_2(array, length) { array, length, length }
-
-  #define macro_f_iki_datass_t_resize(status, datas, length) status = f_iki_datass_resize(length, &datas);
-  #define macro_f_iki_datass_t_adjust(status, datas, length) status = f_iki_datass_adjust(length, &datas);
-
-  #define macro_f_iki_datass_t_delete_simple(datas)  status = f_iki_datass_resize(0, &datas);
-  #define macro_f_iki_datass_t_destroy_simple(datas) status = f_iki_datass_adjust(0, &datas);
-
-  #define macro_f_iki_datass_t_increase(status, step, datas)      status = f_iki_datass_increase(step, &datas);
-  #define macro_f_iki_datass_t_increase_by(status, datas, amount) status = f_iki_datass_increase_by(amount, &datas);
-  #define macro_f_iki_datass_t_decrease_by(status, datas, amount) status = f_iki_datass_decrease_by(amount, &datas);
-  #define macro_f_iki_datass_t_decimate_by(status, datas, amount) status = f_iki_datass_decimate_by(amount, &datas);
 #endif // _di_f_iki_datass_t_
 
 #ifdef __cplusplus
index f98df4dc0a0a001ed51968751070998642fd65e6..ee8df0a60d2fdcf3f9966918e12c4d6ca08b43ba 100644 (file)
@@ -50,129 +50,114 @@ extern "C" {
   }
 #endif // _di_f_iki_data_destroy_
 
-#ifndef _di_f_iki_datas_adjust_
-  f_status_t f_iki_datas_adjust(const f_number_unsigned_t length, f_iki_datas_t *datas) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datas) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    return private_f_iki_datas_adjust(length, datas);
-  }
-#endif // _di_f_iki_datas_adjust_
+#ifndef _di_f_iki_datas_adjust_callback_
+  f_status_t f_iki_datas_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
 
-#ifndef _di_f_iki_datas_append_
-  f_status_t f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t *destination) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!destination) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+    {
+      f_iki_datas_t * const array = (f_iki_datas_t *) void_array;
+      f_status_t status = F_none;
 
-    return private_f_iki_datas_append(source, destination);
-  }
-#endif // _di_f_iki_datas_append_
+      for (f_number_unsigned_t i = start; i < stop; ++i) {
 
-#ifndef _di_f_iki_datas_append_all_
-  f_status_t f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!destination) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (!source.used) return F_data_not;
+        status = f_string_ranges_adjust(0, &array->array[i].content);
+        if (F_status_is_error(status)) return status;
 
-    return private_f_iki_datas_append_all(source, destination);
-  }
-#endif // _di_f_iki_datas_append_all_
+        status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array->array[i].delimits.array, &array->array[i].delimits.used, &array->array[i].delimits.size);
+        if (F_status_is_error(status)) return status;
 
-#ifndef _di_f_iki_datas_decimate_by_
-  f_status_t f_iki_datas_decimate_by(const f_number_unsigned_t amount, f_iki_datas_t *datas) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datas) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+        status = f_string_ranges_adjust(0, &array->array[i].variable);
+        if (F_status_is_error(status)) return status;
 
-    if (!amount) return F_data_not;
-    if (datas->size > amount) return private_f_iki_datas_adjust(datas->size - amount, datas);
+        status = f_string_ranges_adjust(0, &array->array[i].vocabulary);
+        if (F_status_is_error(status)) return status;
+      } // for
+    }
 
-    return private_f_iki_datas_adjust(0, datas);
+    return F_none;
   }
-#endif // _di_f_iki_datas_decimate_by_
+#endif // _di_f_iki_datas_adjust_callback_
 
-#ifndef _di_f_iki_datas_decrease_by_
-  f_status_t f_iki_datas_decrease_by(const f_number_unsigned_t amount, f_iki_datas_t *datas) {
+#ifndef _di_f_iki_datas_append_
+  f_status_t f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t *destination) {
     #ifndef _di_level_0_parameter_checking_
-      if (!datas) return F_status_set_error(F_parameter);
+      if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
-    if (datas->size > amount) return private_f_iki_datas_resize(datas->size - amount, datas);
-
-    return private_f_iki_datas_resize(0, datas);
-  }
-#endif // _di_f_iki_datas_decrease_by_
+    f_status_t status = f_memory_array_increase(F_iki_default_allocation_small_d, sizeof(f_iki_data_t), (void **) &destination->array, &destination->used, &destination->size);
+    if (F_status_is_error(status)) return status;
 
-#ifndef _di_f_iki_datas_increase_
-  f_status_t f_iki_datas_increase(const f_number_unsigned_t step, f_iki_datas_t *datas) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datas) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+    destination->array[destination->used].content.used = 0;
+    destination->array[destination->used].delimits.used = 0;
+    destination->array[destination->used].variable.used = 0;
+    destination->array[destination->used].vocabulary.used = 0;
 
-    if (step && datas->used + 1 > datas->size) {
-      if (datas->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
+    if (source.content.used) {
+      status = f_string_ranges_append_all(source.content, &destination->array[destination->used].content);
+      if (F_status_is_error(status)) return status;
+    }
 
-      f_number_unsigned_t length = datas->used + step;
+    if (source.delimits.used) {
+      for (f_number_unsigned_t i = 0; i < source.delimits.used; ++i) {
 
-      if (length > F_number_t_size_unsigned_d) {
-        if (datas->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
+        status = f_memory_array_append(source.delimits.array + i, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].delimits.array, &destination->array[destination->used].delimits.used, &destination->array[destination->used].delimits.size);
+        if (F_status_is_error(status)) return status;
+      } // for
+    }
 
-        length = F_number_t_size_unsigned_d;
-      }
+    if (source.variable.used) {
+      status = f_string_ranges_append_all(source.variable, &destination->array[destination->used].variable);
+      if (F_status_is_error(status)) return status;
+    }
 
-      return private_f_iki_datas_resize(length, datas);
+    if (source.vocabulary.used) {
+      status = f_string_ranges_append_all(source.vocabulary, &destination->array[destination->used].vocabulary);
+      if (F_status_is_error(status)) return status;
     }
 
-    return F_data_not;
+    ++destination->used;
+
+    return F_none;
   }
-#endif // _di_f_iki_datas_increase_
+#endif // _di_f_iki_datas_append_
 
-#ifndef _di_f_iki_datas_increase_by_
-  f_status_t f_iki_datas_increase_by(const f_number_unsigned_t amount, f_iki_datas_t *datas) {
+#ifndef _di_f_iki_datas_append_all_
+  f_status_t f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) {
     #ifndef _di_level_0_parameter_checking_
-      if (!datas) return F_status_set_error(F_parameter);
+      if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (amount) {
-      if (datas->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
+    if (!source.used) return F_data_not;
 
-      const f_number_unsigned_t length = datas->used + amount;
+    return private_f_iki_datas_append_all(source, destination);
+  }
+#endif // _di_f_iki_datas_append_all_
 
-      if (length > datas->size) {
-        if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
+#ifndef _di_f_iki_datas_resize_callback_
+  f_status_t f_iki_datas_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
 
-        return private_f_iki_datas_resize(length, datas);
-      }
-    }
+    {
+      f_iki_datas_t * const array = (f_iki_datas_t *) void_array;
+      f_status_t status = F_none;
 
-    return F_data_not;
-  }
-#endif // _di_f_iki_datas_increase_by_
+      for (f_number_unsigned_t i = start; i < stop; ++i) {
 
-#ifndef _di_f_iki_datas_resize_
-  f_status_t f_iki_datas_resize(const f_number_unsigned_t length, f_iki_datas_t *datas) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datas) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+        status = f_string_ranges_resize(0, &array->array[i].content);
+        if (F_status_is_error(status)) return status;
 
-    return private_f_iki_datas_resize(length, datas);
-  }
-#endif // _di_f_iki_datas_resize_
+        status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array->array[i].delimits.array, &array->array[i].delimits.used, &array->array[i].delimits.size);
+        if (F_status_is_error(status)) return status;
 
-#ifndef _di_f_iki_datass_adjust_
-  f_status_t f_iki_datass_adjust(const f_number_unsigned_t length, f_iki_datass_t *datass) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datass) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
+        status = f_string_ranges_resize(0, &array->array[i].variable);
+        if (F_status_is_error(status)) return status;
 
-    return private_f_iki_datass_adjust(length, datass);
+        status = f_string_ranges_resize(0, &array->array[i].vocabulary);
+        if (F_status_is_error(status)) return status;
+      } // for
+    }
+
+    return F_none;
   }
-#endif // _di_f_iki_datass_adjust_
+#endif // _di_f_iki_datas_resize_callback_
 
 #ifndef _di_f_iki_datass_append_
   f_status_t f_iki_datass_append(const f_iki_datas_t source, f_iki_datass_t *destination) {
@@ -219,86 +204,6 @@ extern "C" {
   }
 #endif // _di_f_iki_datass_append_all_
 
-#ifndef _di_f_iki_datass_decimate_by_
-  f_status_t f_iki_datass_decimate_by(const f_number_unsigned_t amount, f_iki_datass_t *datass) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datass) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (!amount) return F_data_not;
-
-    return private_f_iki_datass_adjust((datass->size > amount) ? datass->size - amount : 0, datass);
-  }
-#endif // _di_f_iki_datass_decimate_by_
-
-#ifndef _di_f_iki_datass_decrease_by_
-  f_status_t f_iki_datass_decrease_by(const f_number_unsigned_t amount, f_iki_datass_t *datass) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datass) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (!amount) return F_data_not;
-
-    return private_f_iki_datass_resize((datass->size > amount) ? datass->size - amount : 0, datass);
-  }
-#endif // _di_f_iki_datass_decrease_by_
-
-#ifndef _di_f_iki_datass_increase_
-  f_status_t f_iki_datass_increase(const f_number_unsigned_t step, f_iki_datass_t *datass) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datass) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (step && datass->used + 1 > datass->size) {
-      if (datass->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-      f_number_unsigned_t length = datass->used + step;
-
-      if (length > F_number_t_size_unsigned_d) {
-        if (datass->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-        length = F_number_t_size_unsigned_d;
-      }
-
-      return private_f_iki_datass_resize(length, datass);
-    }
-
-    return F_data_not;
-  }
-#endif // _di_f_iki_datass_increase_
-
-#ifndef _di_f_iki_datass_increase_by_
-  f_status_t f_iki_datass_increase_by(const f_number_unsigned_t amount, f_iki_datass_t *datass) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datass) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    if (amount) {
-      if (datass->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-      const f_number_unsigned_t length = datass->used + amount;
-
-      if (length > datass->size) {
-        if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-        return private_f_iki_datass_resize(length, datass);
-      }
-    }
-
-    return F_data_not;
-  }
-#endif // _di_f_iki_datass_increase_by_
-
-#ifndef _di_f_iki_datass_resize_
-  f_status_t f_iki_datass_resize(const f_number_unsigned_t length, f_iki_datass_t *datass) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!datass) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    return private_f_iki_datass_resize(length, datass);
-  }
-#endif // _di_f_iki_datass_resize_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 36388a61fff2fac310277c296e79dfe4965b1055..d99891b2320f35a14a5291829733b290612fd755 100644 (file)
@@ -59,12 +59,17 @@ extern "C" {
 #endif // _di_f_iki_data_destroy_
 
 /**
- * Resize the iki_datas array.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_iki_datass_t structure.
  *
- * @param length
- *   The new size to use.
- * @param iki_datas
- *   The iki_datas array to resize.
+ * This does not do parameter checking.
+ *
+ * @param start
+ *   The inclusive start position in the array to start deleting.
+ * @param stop
+ *   The exclusive stop position in the array to stop deleting.
+ * @param array
+ *   The array structure to delete all values of.
+ *   Must not be NULL.
  *
  * @return
  *   F_none on success.
@@ -72,14 +77,13 @@ extern "C" {
  *   F_parameter (with error bit) if a parameter is invalid.
  *
  *   Errors (with error bit) from: f_memory_array_adjust().
- *   Errors (with error bit) from: f_string_ranges_adjust().
  *
  * @see f_memory_array_adjust()
- * @see f_string_ranges_adjust()
+ * @see f_memory_arrays_adjust()
  */
-#ifndef _di_f_iki_datas_adjust_
-  extern f_status_t f_iki_datas_adjust(const f_number_unsigned_t length, f_iki_datas_t *datas);
-#endif // _di_f_iki_datas_adjust_
+#ifndef _di_f_iki_datas_adjust_callback_
+  extern f_status_t f_iki_datas_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_iki_datas_adjust_callback_
 
 /**
  * Append the single source iki_data onto the destination.
@@ -95,11 +99,11 @@ extern "C" {
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_memory_array_append_all().
+ *   Errors (with error bit) from: f_memory_array_append().
  *   Errors (with error bit) from: f_memory_array_increase().
  *   Errors (with error bit) from: f_string_ranges_append_all().
  *
- * @see f_memory_array_append_all()
+ * @see f_memory_array_append()
  * @see f_memory_array_increase()
  * @see f_string_ranges_append_all()
  */
@@ -121,11 +125,11 @@ extern "C" {
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_memory_array_append_all().
+ *   Errors (with error bit) from: f_memory_array_append().
  *   Errors (with error bit) from: f_memory_array_increase_by().
  *   Errors (with error bit) from: f_string_ranges_append_all().
  *
- * @see f_memory_array_append_all()
+ * @see f_memory_array_append()
  * @see f_memory_array_increase_by()
  * @see f_string_ranges_append_all()
  */
@@ -134,164 +138,31 @@ extern "C" {
 #endif // _di_f_iki_datas_append_all_
 
 /**
- * Resize the iki_datas array to a smaller size.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_iki_datass_t structure.
  *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to les than 0.
+ * This does not do parameter checking.
  *
- * @param amount
- *   A positive number representing how much to decimate the size by.
- * @param iki_datas
- *   The iki_datas array to resize.
+ * @param start
+ *   The inclusive start position in the array to start deleting.
+ * @param stop
+ *   The exclusive stop position in the array to stop deleting.
+ * @param array
+ *   The array structure to delete all values of.
+ *   Must not be NULL.
  *
  * @return
  *   F_none on success.
- *   F_data_not if amount is 0.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_adjust().
- *   Errors (with error bit) from: f_string_ranges_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_string_ranges_adjust()
- */
-#ifndef _di_f_iki_datas_decimate_by_
-  extern f_status_t f_iki_datas_decimate_by(const f_number_unsigned_t amount, f_iki_datas_t *datas);
-#endif // _di_f_iki_datas_decimate_by_
-
-/**
- * Resize the iki_datas array to a smaller size.
- *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to les than 0.
- *
- * @param amount
- *   A positive number representing how much to decrease the size by.
- * @param iki_datas
- *   The iki_datas array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not if amount is 0.
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
  *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
  *
  * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datas_decrease_by_
-  extern f_status_t f_iki_datas_decrease_by(const f_number_unsigned_t amount, f_iki_datas_t *datas);
-#endif // _di_f_iki_datas_decrease_by_
-
-/**
- * Increase the size of the iki_datas array, but only if necesary.
- *
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param step
- *   The allocation step to use.
- *   Must be greater than 0.
- * @param iki_datas
- *   The iki_datas array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datas_increase_
-  extern f_status_t f_iki_datas_increase(const f_number_unsigned_t step, f_iki_datas_t *datas);
-#endif // _di_f_iki_datas_increase_
-
-/**
- * Resize the iki_datas array to a larger size.
- *
- * This will resize making the array larger based on the given length.
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param iki_datas
- *   The iki_datas array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + amount <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datas_increase_by_
-  extern f_status_t f_iki_datas_increase_by(const f_number_unsigned_t amount, f_iki_datas_t *datas);
-#endif // _di_f_iki_datas_increase_by_
-
-/**
- * Resize the iki_datas array.
- *
- * @param length
- *   The new size to use.
- * @param iki_datas
- *   The iki_datas array to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datas_resize_
-  extern f_status_t f_iki_datas_resize(const f_number_unsigned_t length, f_iki_datas_t *datas);
-#endif // _di_f_iki_datas_resize_
-
-/**
- * Resize the iki_datass array.
- *
- * @param length
- *   The new size to use.
- * @param iki_datass
- *   The iki_datass array to resize.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_adjust().
- *   Errors (with error bit) from: f_string_ranges_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_string_ranges_adjust()
+ * @see f_memory_arrays_resize()
  */
-#ifndef _di_f_iki_datass_adjust_
-  extern f_status_t f_iki_datass_adjust(const f_number_unsigned_t length, f_iki_datass_t *datass);
-#endif // _di_f_iki_datass_adjust_
+#ifndef _di_f_iki_datas_resize_callback_
+  extern f_status_t f_iki_datas_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_iki_datas_resize_callback_
 
 /**
  * Append the single source iki_datas onto the destination.
@@ -345,143 +216,6 @@ extern "C" {
   extern f_status_t f_iki_datass_append_all(const f_iki_datass_t source, f_iki_datass_t *destination);
 #endif // _di_f_iki_datass_append_all_
 
-/**
- * Resize the iki_datass array to a smaller size.
- *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to less than 0.
- *
- * @param amount
- *   A positive number representing how much to decimate the size by.
- * @param iki_datass
- *   The iki_datass array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not if amount is 0.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_adjust().
- *   Errors (with error bit) from: f_string_ranges_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_string_ranges_adjust()
- */
-#ifndef _di_f_iki_datass_decimate_by_
-  extern f_status_t f_iki_datass_decimate_by(const f_number_unsigned_t amount, f_iki_datass_t *datass);
-#endif // _di_f_iki_datass_decimate_by_
-
-/**
- * Resize the iki_datass array to a smaller size.
- *
- * This will resize making the array smaller based on (size - given length).
- * If the given length is too small, then the resize will fail.
- * This will not shrink the size to less than 0.
- *
- * @param amount
- *   A positive number representing how much to decrease the size by.
- * @param iki_datass
- *   The iki_datass array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not if amount is 0.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datass_decrease_by_
-  extern f_status_t f_iki_datass_decrease_by(const f_number_unsigned_t amount, f_iki_datass_t *datass);
-#endif // _di_f_iki_datass_decrease_by_
-
-/**
- * Increase the size of the iki_datass array, but only if necessary.
- *
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param step
- *   The allocation step to use.
- *   Must be greater than 0.
- * @param iki_datass
- *   The iki_datass array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datass_increase_
-  extern f_status_t f_iki_datass_increase(const f_number_unsigned_t step, f_iki_datass_t *datass);
-#endif // _di_f_iki_datass_increase_
-
-/**
- * Resize the iki_datass array to a larger size.
- *
- * This will resize making the array larger based on the given length.
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param iki_datass
- *   The iki_datass array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + amount <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datass_increase_by_
-  extern f_status_t f_iki_datass_increase_by(const f_number_unsigned_t amount, f_iki_datass_t *datass);
-#endif // _di_f_iki_datass_increase_by_
-
-/**
- * Resize the iki_datass array.
- *
- * @param length
- *   The new size to use.
- * @param iki_datass
- *   The iki_datass array to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- */
-#ifndef _di_f_iki_datass_resize_
-  extern f_status_t f_iki_datass_resize(const f_number_unsigned_t length, f_iki_datass_t *datass);
-#endif // _di_f_iki_datass_resize_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index b9ab34ab8c9c97c79a1303848c0cb70e826c3187..4549d73fbf6c768ffa08e2d48a74f67a8ede64da 100644 (file)
@@ -5,70 +5,6 @@
 extern "C" {
 #endif
 
-#if !defined(_di_f_iki_datas_adjust_) || !defined(_di_f_iki_datas_decimate_by_)
-  f_status_t private_f_iki_datas_adjust(const f_number_unsigned_t length, f_iki_datas_t *structure) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < structure->size; ++i) {
-
-      status = f_string_ranges_adjust(0, &structure->array[i].content);
-      if (F_status_is_error(status)) return status;
-
-      status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].delimits.array, &structure->array[i].delimits.used, &structure->array[i].delimits.size);
-      if (F_status_is_error(status)) return status;
-
-      status = f_string_ranges_adjust(0, &structure->array[i].variable);
-      if (F_status_is_error(status)) return status;
-
-      status = f_string_ranges_adjust(0, &structure->array[i].vocabulary);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    return f_memory_array_adjust(length, sizeof(f_iki_data_t), (void **) &structure->array, &structure->used, &structure->size);
-  }
-#endif // !defined(_di_f_iki_datas_adjust_) || !defined(_di_f_iki_datas_decimate_by_)
-
-#if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datass_append_)
-  extern f_status_t private_f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t *destination) {
-
-    f_status_t status = f_memory_array_increase(F_iki_default_allocation_small_d, sizeof(f_iki_data_t), (void **) &destination->array, &destination->used, &destination->size);
-    if (F_status_is_error(status)) return status;
-
-    destination->array[destination->used].content.used = 0;
-    destination->array[destination->used].delimits.used = 0;
-    destination->array[destination->used].variable.used = 0;
-    destination->array[destination->used].vocabulary.used = 0;
-
-    if (source.content.used) {
-      status = f_string_ranges_append_all(source.content, &destination->array[destination->used].content);
-      if (F_status_is_error(status)) return status;
-    }
-
-    if (source.delimits.used) {
-      for (f_number_unsigned_t i = 0; i < source.delimits.used; ++i) {
-
-        status = f_memory_array_append(source.delimits.array + i, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].delimits.array, &destination->array[destination->used].delimits.used, &destination->array[destination->used].delimits.size);
-        if (F_status_is_error(status)) return status;
-      } // for
-    }
-
-    if (source.variable.used) {
-      status = f_string_ranges_append_all(source.variable, &destination->array[destination->used].variable);
-      if (F_status_is_error(status)) return status;
-    }
-
-    if (source.vocabulary.used) {
-      status = f_string_ranges_append_all(source.vocabulary, &destination->array[destination->used].vocabulary);
-      if (F_status_is_error(status)) return status;
-    }
-
-    ++destination->used;
-
-    return F_none;
-  }
-#endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datass_append_)
-
 #if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
   extern f_status_t private_f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) {
 
@@ -112,60 +48,6 @@ extern "C" {
   }
 #endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
 
-#if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_decrease_by_) || !defined(_di_f_iki_datas_increase_) || !defined(_di_f_iki_datas_increase_by_) || !defined(_di_f_iki_datas_resize_)
-  f_status_t private_f_iki_datas_resize(const f_number_unsigned_t length, f_iki_datas_t *structure) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < structure->size; ++i) {
-
-      status = f_string_ranges_resize(0, &structure->array[i].content);
-      if (F_status_is_error(status)) return status;
-
-      status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].delimits.array, &structure->array[i].delimits.used, &structure->array[i].delimits.size);
-      if (F_status_is_error(status)) return status;
-
-      status = f_string_ranges_resize(0, &structure->array[i].variable);
-      if (F_status_is_error(status)) return status;
-
-      status = f_string_ranges_resize(0, &structure->array[i].vocabulary);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    return f_memory_array_resize(length, sizeof(f_iki_data_t), (void **) &structure->array, &structure->used, &structure->size);
-  }
-#endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_decrease_by_) || !defined(_di_f_iki_datas_increase_) || !defined(_di_f_iki_datas_increase_by_) || !defined(_di_f_iki_datas_resize_)
-
-#if !defined(_di_f_iki_datass_adjust_) || !defined(_di_f_iki_datass_decimate_by_)
-  f_status_t private_f_iki_datass_adjust(const f_number_unsigned_t length, f_iki_datass_t *structure) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < structure->size; ++i) {
-
-      status = private_f_iki_datas_adjust(0, &structure->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    return f_memory_array_adjust(length, sizeof(f_iki_datas_t), (void **) &structure->array, &structure->used, &structure->size);
-  }
-#endif // !defined(_di_f_iki_datass_adjust_) || !defined(_di_f_iki_datass_decimate_by_)
-
-#if !defined(_di_f_iki_datass_decrease_by_) || !defined(_di_f_iki_datass_increase_) || !defined(_di_f_iki_datass_increase_by_) || !defined(_di_f_iki_datass_resize_)
-  f_status_t private_f_iki_datass_resize(const f_number_unsigned_t length, f_iki_datass_t *structure) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < structure->size; ++i) {
-
-      status = private_f_iki_datas_resize(0, &structure->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    return f_memory_array_resize(length, sizeof(f_iki_datas_t), (void **) &structure->array, &structure->used, &structure->size);
-  }
-#endif // !defined(_di_f_iki_datass_decrease_by_) || !defined(_di_f_iki_datass_increase_) || !defined(_di_f_iki_datass_increase_by_) || !defined(_di_f_iki_datass_resize_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 236518d6d6f2546845157596e4f818903f480b7b..a149cf42fd5ad8f4db7f7f4e86ddfaa2fffc9024 100644 (file)
@@ -16,61 +16,6 @@ extern "C" {
 #endif
 
 /**
- * Private implementation for resizing the iki_datas array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param structure
- *   The iki_datas array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   Errors (with error bit) from: f_memory_array_adjust().
- *   Errors (with error bit) from: f_string_ranges_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_string_ranges_adjust()
- *
- * @see f_iki_datas_adjust()
- * @see f_iki_datas_decimate_by()
- */
-#if !defined(_di_f_iki_datas_adjust_) || !defined(_di_f_iki_datas_decimate_by_)
-  extern f_status_t private_f_iki_datas_adjust(const f_number_unsigned_t length, f_iki_datas_t *structure) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datas_adjust_) || !defined(_di_f_iki_datas_decimate_by_)
-
-/**
- * Private implementation for appending the iki_data array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- *   The source iki_data to append.
- * @param destination
- *   The iki_datas array the source is appended onto.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_array_append_all().
- *   Errors (with error bit) from: f_memory_array_increase().
- *   Errors (with error bit) from: f_string_ranges_append_all().
- *
- * @see f_memory_array_append_all()
- * @see f_memory_array_increase()
- * @see f_string_ranges_append_all()
- *
- * @see f_iki_datas_append()
- * @see f_iki_datass_append()
- */
-#if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datass_append_)
-  extern f_status_t private_f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t *destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datass_append_)
-
-/**
  * Private implementation for appending the iki_data array.
  *
  * Intended to be shared to each of the different implementation variations.
@@ -83,11 +28,11 @@ extern "C" {
  * @return
  *   F_none on success.
  *
- *   Errors (with error bit) from: f_memory_array_append_all().
+ *   Errors (with error bit) from: f_memory_array_append().
  *   Errors (with error bit) from: f_memory_array_increase_by().
  *   Errors (with error bit) from: f_string_ranges_append_all().
  *
- * @see f_memory_array_append_all()
+ * @see f_memory_array_append()
  * @see f_memory_array_increase_by()
  * @see f_string_ranges_append_all()
  *
@@ -98,99 +43,6 @@ extern "C" {
   extern f_status_t private_f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) F_attribute_visibility_internal_d;
 #endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
 
-/**
- * Private implementation for resizing the iki_datas array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param structure
- *   The iki_datas array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- *
- * @see f_iki_datas_resize()
- * @see f_iki_datas_append()
- * @see f_iki_datas_decimate_by()
- * @see f_iki_datass_append()
- */
-#if !defined(_di_f_iki_datas_resize_) || !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_decimate_by_) || !defined(_di_f_iki_datass_append_)
-  extern f_status_t private_f_iki_datas_resize(const f_number_unsigned_t length, f_iki_datas_t *structure) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datas_resize_) || !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_decimate_by_) || !defined(_di_f_iki_datass_append_)
-
-/**
- * Private implementation for resizing the iki_datass array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param iki_datass
- *   The iki_datass array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if new length is larger than max array length.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_adjust().
- *   Errors (with error bit) from: f_string_ranges_adjust().
- *
- * @see f_memory_array_adjust()
- * @see f_string_ranges_adjust()
- *
- * @see f_iki_datass_adjust()
- * @see f_iki_datass_decimate_by()
- */
-#if !defined(_di_f_iki_datass_adjust_) || !defined(_di_f_iki_datass_decimate_by_)
-  extern f_status_t private_f_iki_datass_adjust(const f_number_unsigned_t length, f_iki_datass_t *datass) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datass_adjust_) || !defined(_di_f_iki_datass_decimate_by_)
-
-/**
- * Private implementation for resizing the iki_datass array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to resize to.
- * @param iki_datass
- *   The iki_datass array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if new length is larger than max array length.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_string_ranges_resize()
- *
- * @see f_iki_datass_decrease_by()
- * @see f_iki_datass_increase()
- * @see f_iki_datass_increase_by()
- * @see f_iki_datass_resize()
- */
-#if !defined(_di_f_iki_datass_decrease_by_) || !defined(_di_f_iki_datass_increase_) || !defined(_di_f_iki_datass_increase_by_) || !defined(_di_f_iki_datass_resize_)
-  extern f_status_t private_f_iki_datass_resize(const f_number_unsigned_t length, f_iki_datass_t *datass) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datass_decrease_by_) || !defined(_di_f_iki_datass_increase_) || !defined(_di_f_iki_datass_increase_by_) || !defined(_di_f_iki_datass_resize_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 7db3acc76089a7dde20552dab727189b67ec2edb..36d588f34a7393fc98e0146371bd205839470cd4 100644 (file)
@@ -44,140 +44,6 @@ extern "C" {
 #endif // !defined(_di_f_iki_content_is_) || !defined(_di_f_iki_content_partial_is_)
 
 /**
- * Private implementation for resizing the iki_datas array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param datas
- *   The IKI datas array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_string_ranges_adjust().
- *
- * @see f_memory_adjust()
- * @see f_memory_array_resize()
- * @see f_string_ranges_adjust()
- */
-#if !defined(_di_f_iki_datas_adjust_) || !defined(_di_f_iki_datas_decimate_by_)
-  extern f_status_t private_f_iki_datas_adjust(const f_number_unsigned_t length, f_iki_datas_t *datas) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datas_adjust_) || !defined(_di_f_iki_datas_decimate_by_)
-
-/**
- * Private implementation for appending the iki_data array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- *   The source iki_datas to append.
- * @param destination
- *   The destination lengths the source is appended onto.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_iki_datas_append_all()
- * @see f_iki_datass_append()
- * @see f_iki_datass_append_all()
- */
-#if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
-  extern f_status_t private_f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
-
-/**
- * Private implementation for resizing the iki_datas array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param datas
- *   The IKI datas array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   Errors (with error bit) from: f_memory_array_resize().
- *   Errors (with error bit) from: f_memory_resize().
- *   Errors (with error bit) from: f_string_ranges_resize().
- *
- * @see f_memory_array_resize()
- * @see f_memory_resize()
- * @see f_string_ranges_resize()
- */
-#if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_decrease_by_) || !defined(_di_f_iki_datas_increase_) || !defined(_di_f_iki_datas_increase_by_) || !defined(_di_f_iki_datas_resize_)
-  extern f_status_t private_f_iki_datas_resize(const f_number_unsigned_t length, f_iki_datas_t *datas) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_decrease_by_) || !defined(_di_f_iki_datas_increase_) || !defined(_di_f_iki_datas_increase_by_) || !defined(_di_f_iki_datas_resize_)
-
-/**
- * Private implementation for resizing the iki_datass array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to adjust to.
- * @param iki_datass
- *   The iki_datass array to adjust.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if new length is larger than max array length.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *   Errors (with error bit) from: f_memory_destroy().
- *
- * @see f_iki_datass_adjust()
- * @see f_iki_datass_decimate_by()
- */
-#if !defined(_di_f_iki_datass_adjust_) || !defined(_di_f_iki_datass_decimate_by_)
-  extern f_status_t private_f_iki_datass_adjust(const f_number_unsigned_t length, f_iki_datass_t *datass) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datass_adjust_) || !defined(_di_f_iki_datass_decimate_by_)
-
-/**
- * Private implementation for resizing the iki_datass array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The length to resize to.
- * @param iki_datass
- *   The iki_datass array to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + 1 <= size).
- *
- *   F_array_too_large (with error bit) if new length is larger than max array length.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_memory_delete().
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_iki_datass_decrease_by()
- * @see f_iki_datass_increase()
- * @see f_iki_datass_increase_by()
- * @see f_iki_datass_resize()
- */
-#if !defined(_di_f_iki_datass_decrease_by_) || !defined(_di_f_iki_datass_increase_) || !defined(_di_f_iki_datass_increase_by_) || !defined(_di_f_iki_datass_resize_)
-  extern f_status_t private_f_iki_datass_resize(const f_number_unsigned_t length, f_iki_datass_t *datass) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_iki_datass_decrease_by_) || !defined(_di_f_iki_datass_increase_) || !defined(_di_f_iki_datass_increase_by_) || !defined(_di_f_iki_datass_resize_)
-
-/**
  * Private implementation of f_iki_object_partial_is().
  *
  * Intended to be shared to each of the different implementation variations.
diff --git a/level_0/f_iki/data/build/settings-mocks b/level_0/f_iki/data/build/settings-mocks
new file mode 100644 (file)
index 0000000..c6241fb
--- /dev/null
@@ -0,0 +1,71 @@
+# fss-0001
+#
+# Build the project with appropriate mocks linked in via the dynamic linker's "--wrap" functionality.
+#
+# The -Wl,--wrap does not work across shared files.
+# Therefore, this file is a work-around to inject the mocks into the library for testing purposes.
+# This should exactly match the "settings" file, except for the additional "-Wl,--wrap" parts and the additional mock source file.
+#
+# The flags -o0 must be passed to prevent the compiler from optimizing away any functions being mocked (which results in the mock not happening and a real function being called).
+# Alternatively, figure out which optimization that is disabled by -o0 and have that specific optimization disabled.
+#
+
+build_name f_iki
+
+version_major 0
+version_minor 7
+version_micro 0
+version_file micro
+version_target minor
+
+modes individual clang test coverage
+modes_default individual test
+
+build_compiler gcc
+build_compiler-clang clang
+build_indexer ar
+build_indexer_arguments rcs
+build_language c
+
+build_libraries -lc
+build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf
+
+build_sources_library iki.c private-iki.c iki/common.c iki/private-data.c iki/data.c
+build_sources_library ../../tests/unit/c/mock-iki.c
+
+build_sources_headers iki.h iki/common.h iki/data.h
+
+build_script yes
+build_shared yes
+build_static no
+
+path_headers fll/level_0
+path_library_script script
+path_library_shared shared
+path_library_static static
+
+has_path_standard yes
+preserve_path_headers yes
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+environment PATH LD_LIBRARY_PATH
+environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH
+
+#defines -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
+defines -D_pthread_sigqueue_unsupported_
+
+flags -O0 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses
+flags-clang -Wno-logical-op-parentheses
+flags-test -fstack-protector -Wall
+flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/
+
+flags_library -fPIC
+
+# Inject mocks.
+flags -Wl,--wrap=f_memory_array_adjust
+flags -Wl,--wrap=f_memory_array_resize
+flags -Wl,--wrap=f_string_ranges_adjust
+flags -Wl,--wrap=f_string_ranges_resize
index 1680284703b4128a664c1e724afcb71956af79c4..ad630d2934d9e6ac2dd96e67a08128d45453796e 100644 (file)
@@ -26,7 +26,7 @@ build_libraries -lc -lcmocka
 build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_iki
 
 build_sources_program test-iki-content_is.c test-iki-content_partial_is.c test-iki-object_is.c test-iki-object_partial_is.c test-iki-read.c
-build_sources_program test-iki-datas_adjust.c test-iki-datas_append.c test-iki-datas_append_all.c test-iki-datas_decimate_by.c test-iki-datas_decrease_by.c test-iki-datas_increase.c test-iki-datas_increase_by.c test-iki-datas_resize.c test-iki-datass_adjust.c test-iki-datass_append.c test-iki-datass_append_all.c test-iki-datass_decimate_by.c test-iki-datass_decrease_by.c test-iki-datass_increase.c test-iki-datass_increase_by.c test-iki-datass_resize.c
+build_sources_program test-iki-datas_adjust_callback.c test-iki-datas_append.c test-iki-datas_append_all.c test-iki-datas_resize_callback.c test-iki-datass_append.c test-iki-datass_append_all.c
 build_sources_program test-iki.c
 
 build_script no
index 23f582464015161dc61a941929784370eb0731c3..5f76e645744e5e97e0a9425cdc6c8c55e8e3a1f4 100644 (file)
@@ -18,7 +18,7 @@ settings:
   #define CMOCKA_XML_FILE ./out.xml
 
 main:
-  build settings individual test
+  build settings-mocks individual test
   build settings-tests individual test
 
   operate build_path
diff --git a/level_0/f_iki/tests/unit/c/mock-iki.c b/level_0/f_iki/tests/unit/c/mock-iki.c
new file mode 100644 (file)
index 0000000..0441520
--- /dev/null
@@ -0,0 +1,79 @@
+#include "mock-iki.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int mock_unwrap = 0;
+
+f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) {
+
+  if (mock_unwrap) {
+    return __real_f_memory_array_adjust(length, width, array, used, size);
+  }
+
+  if (!array || !used || !size) return F_status_set_error(F_parameter_not);
+
+  const bool failure = mock_type(bool);
+
+  if (failure) return mock_type(f_status_t);
+
+  *size = length;
+
+  return mock_type(f_status_t);
+}
+
+f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) {
+
+  if (mock_unwrap) {
+    return __real_f_memory_array_resize(length, width, array, used, size);
+  }
+
+  if (!array || !used || !size) return F_status_set_error(F_parameter_not);
+
+  const bool failure = mock_type(bool);
+
+  if (failure) return mock_type(f_status_t);
+
+  *size = length;
+
+  return mock_type(f_status_t);
+}
+
+f_status_t __wrap_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure) {
+
+  if (mock_unwrap) {
+    return __real_f_string_ranges_adjust(length, structure);
+  }
+
+  if (!structure) return F_status_set_error(F_parameter_not);
+
+  const bool failure = mock_type(bool);
+
+  if (failure) return mock_type(f_status_t);
+
+  structure->size = length;
+
+  return mock_type(f_status_t);
+}
+
+f_status_t __wrap_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure) {
+
+  if (mock_unwrap) {
+    return __real_f_string_ranges_resize(length, structure);
+  }
+
+  if (!structure) return F_status_set_error(F_parameter_not);
+
+  const bool failure = mock_type(bool);
+
+  if (failure) return mock_type(f_status_t);
+
+  structure->size = length;
+
+  return mock_type(f_status_t);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_iki/tests/unit/c/mock-iki.h b/level_0/f_iki/tests/unit/c/mock-iki.h
new file mode 100644 (file)
index 0000000..a42bfc5
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: IKI
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the iki project.
+ */
+#ifndef _MOCK__iki_h
+#define _MOCK__iki_h
+
+// Libc includes.
+#include <semaphore.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <stdint.h>
+
+// cmocka includes.
+#include <cmocka.h>
+
+// FLL-0 includes.
+#include <fll/level_0/iki.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const static int mock_errno_generic = 32767;
+
+extern int mock_unwrap;
+
+extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __real_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure);
+extern f_status_t __real_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure);
+
+extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __wrap_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure);
+extern f_status_t __wrap_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _MOCK__iki_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust.c b/level_0/f_iki/tests/unit/c/test-iki-datas_adjust.c
deleted file mode 100644 (file)
index e528630..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datas_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datas_adjust__works(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-void test__f_iki_datas_adjust__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust.h b/level_0/f_iki/tests/unit/c/test-iki-datas_adjust.h
deleted file mode 100644 (file)
index 588e89e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datas_adjust_h
-#define _TEST__F_iki_datas_adjust_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datas_adjust()
- */
-extern void test__f_iki_datas_adjust__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datas_adjust()
- */
-extern void test__f_iki_datas_adjust__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datas_adjust_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.c
new file mode 100644 (file)
index 0000000..69bce9b
--- /dev/null
@@ -0,0 +1,103 @@
+#include "test-iki.h"
+#include "test-iki-datas_adjust_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_iki_datas_adjust_callback__fails(void **state) {
+
+  mock_unwrap = 0;
+
+  f_iki_data_t data = f_iki_data_t_initialize;
+  f_iki_data_t data_array[] = { data };
+  f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_iki_datas_t datass_array[] = { datas };
+
+  {
+    will_return(__wrap_f_string_ranges_adjust, true);
+    will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_ranges_adjust, false);
+    will_return(__wrap_f_string_ranges_adjust, F_none);
+
+    will_return(__wrap_f_memory_array_adjust, true);
+    will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_ranges_adjust, false);
+    will_return(__wrap_f_string_ranges_adjust, F_none);
+
+    will_return(__wrap_f_memory_array_adjust, false);
+    will_return(__wrap_f_memory_array_adjust, F_none);
+
+    will_return(__wrap_f_string_ranges_adjust, true);
+    will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_ranges_adjust, false);
+    will_return(__wrap_f_string_ranges_adjust, F_none);
+
+    will_return(__wrap_f_memory_array_adjust, false);
+    will_return(__wrap_f_memory_array_adjust, F_none);
+
+    will_return(__wrap_f_string_ranges_adjust, false);
+    will_return(__wrap_f_string_ranges_adjust, F_none);
+
+    will_return(__wrap_f_string_ranges_adjust, true);
+    will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+}
+
+void test__f_iki_datas_adjust_callback__works(void **state) {
+
+  mock_unwrap = 0;
+
+  f_iki_data_t data = f_iki_data_t_initialize;
+  f_iki_data_t data_array[] = { data };
+  f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_iki_datas_t datass_array[] = { datas };
+  const f_number_unsigned_t length = 1;
+
+  {
+    will_return(__wrap_f_string_ranges_adjust, false);
+    will_return(__wrap_f_string_ranges_adjust, F_none);
+
+    will_return(__wrap_f_memory_array_adjust, false);
+    will_return(__wrap_f_memory_array_adjust, F_none);
+
+    will_return(__wrap_f_string_ranges_adjust, false);
+    will_return(__wrap_f_string_ranges_adjust, F_none);
+
+    will_return(__wrap_f_string_ranges_adjust, false);
+    will_return(__wrap_f_string_ranges_adjust, F_none);
+
+    const f_status_t status = f_iki_datas_adjust_callback(0, length, (void *) datass_array);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.h
new file mode 100644 (file)
index 0000000..ac7c857
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: IKI
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_iki__datas_adjust_callback
+#define _TEST__F_iki__datas_adjust_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_iki_datas_adjust_callback()
+ */
+extern void test__f_iki_datas_adjust_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_iki_datas_adjust_callback()
+ */
+extern void test__f_iki_datas_adjust_callback__works(void **state);
+
+#endif // _TEST__F_iki__datas_adjust_callback
index 46a85125ad8ddfffeff9ab538ad8472c4d52051f..6b6eb41c4215a24b68bda24e0d48fe6dbda13878 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: IKI
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
index 764be627277307e2ecfca08890d04678d834e27e..6f4bc1be0b4c31c5a33b9432822972e7d5ac32cf 100644 (file)
@@ -12,7 +12,7 @@ void test__f_iki_datas_append_all__works(void **state) {
   f_iki_datas_t destination = f_iki_datas_t_initialize;
 
   {
-    f_status_t status = f_iki_datas_resize(2, &source);
+    f_status_t status = f_memory_array_resize(2, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.size, 2);
@@ -126,7 +126,7 @@ void test__f_iki_datas_append_all__returns_data_not(void **state) {
   f_iki_datas_t destination = f_iki_datas_t_initialize;
 
   {
-    const f_status_t status = f_iki_datas_resize(length, &source);
+    const f_status_t status = f_memory_array_resize(length, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
index 42200a310b39027b718b74d375f039193a2d3e23..da422ee12879f0c44dcebf4397dfe896067fe9ca 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: IKI
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_decimate_by.c b/level_0/f_iki/tests/unit/c/test-iki-datas_decimate_by.c
deleted file mode 100644 (file)
index d0dbd0e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datas_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datas_decimate_by__works(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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_iki_datas_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);
-}
-
-void test__f_iki_datas_decimate_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_decimate_by.h b/level_0/f_iki/tests/unit/c/test-iki-datas_decimate_by.h
deleted file mode 100644 (file)
index a9875f5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datas_decimate_by_h
-#define _TEST__F_iki_datas_decimate_by_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datas_decimate_by()
- */
-extern void test__f_iki_datas_decimate_by__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datas_decimate_by()
- */
-extern void test__f_iki_datas_decimate_by__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datas_decimate_by_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_decrease_by.c b/level_0/f_iki/tests/unit/c/test-iki-datas_decrease_by.c
deleted file mode 100644 (file)
index 3bd1865..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datas_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datas_decrease_by__works(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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_iki_datas_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);
-}
-
-void test__f_iki_datas_decrease_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_decrease_by.h b/level_0/f_iki/tests/unit/c/test-iki-datas_decrease_by.h
deleted file mode 100644 (file)
index d32f0f2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datas_decrease_by_h
-#define _TEST__F_iki_datas_decrease_by_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datas_decrease_by()
- */
-extern void test__f_iki_datas_decrease_by__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datas_decrease_by()
- */
-extern void test__f_iki_datas_decrease_by__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datas_decrease_by_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_increase.c b/level_0/f_iki/tests/unit/c/test-iki-datas_increase.c
deleted file mode 100644 (file)
index 16fe997..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datas_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datas_increase__works(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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_iki_datas_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);
-}
-
-void test__f_iki_datas_increase__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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_iki_datas_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_iki_datas_increase__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_increase.h b/level_0/f_iki/tests/unit/c/test-iki-datas_increase.h
deleted file mode 100644 (file)
index 3c726cf..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datas_increase_h
-#define _TEST__F_iki_datas_increase_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datas_increase()
- */
-extern void test__f_iki_datas_increase__works(void **state);
-
-/**
- * Test that the function returns F_data_not when asked to copy an empty structure.
- *
- * @see f_iki_datas_increase()
- */
-extern void test__f_iki_datas_increase__returns_data_not(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datas_increase()
- */
-extern void test__f_iki_datas_increase__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datas_increase_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_increase_by.c b/level_0/f_iki/tests/unit/c/test-iki-datas_increase_by.c
deleted file mode 100644 (file)
index ba53394..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datas_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datas_increase_by__works(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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_iki_datas_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);
-}
-
-void test__f_iki_datas_increase_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_increase_by.h b/level_0/f_iki/tests/unit/c/test-iki-datas_increase_by.h
deleted file mode 100644 (file)
index e441469..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datas_increase_by_h
-#define _TEST__F_iki_datas_increase_by_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datas_increase_by()
- */
-extern void test__f_iki_datas_increase_by__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datas_increase_by()
- */
-extern void test__f_iki_datas_increase_by__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datas_increase_by_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_resize.c b/level_0/f_iki/tests/unit/c/test-iki-datas_resize.c
deleted file mode 100644 (file)
index e647f00..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datas_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datas_resize__works(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-void test__f_iki_datas_resize__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datas_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datas_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_resize.h b/level_0/f_iki/tests/unit/c/test-iki-datas_resize.h
deleted file mode 100644 (file)
index 125f31a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datas_resize_h
-#define _TEST__F_iki_datas_resize_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datas_resize()
- */
-extern void test__f_iki_datas_resize__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datas_resize()
- */
-extern void test__f_iki_datas_resize__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datas_resize_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.c
new file mode 100644 (file)
index 0000000..5cf1459
--- /dev/null
@@ -0,0 +1,103 @@
+#include "test-iki.h"
+#include "test-iki-datas_resize_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_iki_datas_resize_callback__fails(void **state) {
+
+  mock_unwrap = 0;
+
+  f_iki_data_t data = f_iki_data_t_initialize;
+  f_iki_data_t data_array[] = { data };
+  f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_iki_datas_t datass_array[] = { datas };
+
+  {
+    will_return(__wrap_f_string_ranges_resize, true);
+    will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_ranges_resize, false);
+    will_return(__wrap_f_string_ranges_resize, F_none);
+
+    will_return(__wrap_f_memory_array_resize, true);
+    will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_ranges_resize, false);
+    will_return(__wrap_f_string_ranges_resize, F_none);
+
+    will_return(__wrap_f_memory_array_resize, false);
+    will_return(__wrap_f_memory_array_resize, F_none);
+
+    will_return(__wrap_f_string_ranges_resize, true);
+    will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+
+  {
+    will_return(__wrap_f_string_ranges_resize, false);
+    will_return(__wrap_f_string_ranges_resize, F_none);
+
+    will_return(__wrap_f_memory_array_resize, false);
+    will_return(__wrap_f_memory_array_resize, F_none);
+
+    will_return(__wrap_f_string_ranges_resize, false);
+    will_return(__wrap_f_string_ranges_resize, F_none);
+
+    will_return(__wrap_f_string_ranges_resize, true);
+    will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure));
+
+    const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array);
+
+    assert_int_equal(status, F_status_set_error(F_failure));
+  }
+}
+
+void test__f_iki_datas_resize_callback__works(void **state) {
+
+  mock_unwrap = 0;
+
+  f_iki_data_t data = f_iki_data_t_initialize;
+  f_iki_data_t data_array[] = { data };
+  f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 };
+  f_iki_datas_t datass_array[] = { datas };
+  const f_number_unsigned_t length = 1;
+
+  {
+    will_return(__wrap_f_string_ranges_resize, false);
+    will_return(__wrap_f_string_ranges_resize, F_none);
+
+    will_return(__wrap_f_memory_array_resize, false);
+    will_return(__wrap_f_memory_array_resize, F_none);
+
+    will_return(__wrap_f_string_ranges_resize, false);
+    will_return(__wrap_f_string_ranges_resize, F_none);
+
+    will_return(__wrap_f_string_ranges_resize, false);
+    will_return(__wrap_f_string_ranges_resize, F_none);
+
+    const f_status_t status = f_iki_datas_resize_callback(0, length, (void *) datass_array);
+
+    assert_int_equal(status, F_none);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.h
new file mode 100644 (file)
index 0000000..1d846bb
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: IKI
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_iki__datas_resize_callback
+#define _TEST__F_iki__datas_resize_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_iki_datas_resize_callback()
+ */
+extern void test__f_iki_datas_resize_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_iki_datas_resize_callback()
+ */
+extern void test__f_iki_datas_resize_callback__works(void **state);
+
+#endif // _TEST__F_iki__datas_resize_callback
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_adjust.c b/level_0/f_iki/tests/unit/c/test-iki-datass_adjust.c
deleted file mode 100644 (file)
index d6f562d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datass_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datass_adjust__works(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datass_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-void test__f_iki_datass_adjust__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datass_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_adjust.h b/level_0/f_iki/tests/unit/c/test-iki-datass_adjust.h
deleted file mode 100644 (file)
index 9bcb3e9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datass_adjust_h
-#define _TEST__F_iki_datass_adjust_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datass_adjust()
- */
-extern void test__f_iki_datass_adjust__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datass_adjust()
- */
-extern void test__f_iki_datass_adjust__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datass_adjust_h
index 83def3e868d0bf0af3a48c47c55f54194a2ee256..66a20b383afec21dcbb0a7f9cf9eb795fdab1f08 100644 (file)
@@ -13,7 +13,7 @@ void test__f_iki_datass_append__works(void **state) {
   f_iki_datass_t destination = f_iki_datass_t_initialize;
 
   {
-    f_status_t status = f_iki_datas_resize(length_outer, &source);
+    f_status_t status = f_memory_array_resize(length_outer, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.size, length_outer);
@@ -131,7 +131,7 @@ void test__f_iki_datass_append__returns_data_not(void **state) {
   f_iki_datass_t destination = f_iki_datass_t_initialize;
 
   {
-    const f_status_t status = f_iki_datas_resize(length, &source);
+    f_status_t status = f_memory_array_resize(length, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
index 8ba174bcb946eff6af77605b07a3353fe2fa2e2d..fb5a6444e8fda7c51e9fa661e6aab3ee06ccf9e2 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: IKI
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
index 45f68aa3193780974a4b1a3cf0fcf428449a48d8..1dca0c5f2d6305934a4f7c0dfca561791d57f9aa 100644 (file)
@@ -14,7 +14,7 @@ void test__f_iki_datass_append_all__works(void **state) {
   f_iki_datass_t destination = f_iki_datass_t_initialize;
 
   {
-    f_status_t status = f_iki_datass_resize(length_outer, &source);
+    f_status_t status = f_memory_arrays_resize(length_outer, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size, &f_iki_datas_resize_callback);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.size, length_outer);
@@ -24,7 +24,7 @@ void test__f_iki_datass_append_all__works(void **state) {
 
     for (; source.used < length_outer; ++source.used) {
 
-      status = f_iki_datas_resize(length_inner, &source.array[source.used]);
+      status = f_memory_array_resize(length_inner, sizeof(f_iki_data_t), (void **) &source.array[source.used].array, &source.array[source.used].used, &source.array[source.used].size);
 
       assert_int_equal(status, F_none);
       assert_int_equal(source.array[source.used].size, length_inner);
@@ -147,7 +147,7 @@ void test__f_iki_datass_append_all__returns_data_not(void **state) {
   f_iki_datass_t destination = f_iki_datass_t_initialize;
 
   {
-    const f_status_t status = f_iki_datass_resize(length, &source);
+    const f_status_t status = f_memory_arrays_resize(length, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size, &f_iki_datas_resize_callback);
 
     assert_int_equal(status, F_none);
     assert_int_equal(source.used, 0);
index 3692a757fa8757bdd1be603d2b62be23f2fa0aea..680a4189fbc0f6e9162b4a667a7467ce098a150d 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * FLL - Level 0
  *
- * Project: Type
+ * Project: IKI
  * API Version: 0.7
  * Licenses: lgpl-2.1-or-later
  *
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_decimate_by.c b/level_0/f_iki/tests/unit/c/test-iki-datass_decimate_by.c
deleted file mode 100644 (file)
index 8866b8a..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datass_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datass_decimate_by__works(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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_iki_datass_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);
-}
-
-void test__f_iki_datass_decimate_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_decimate_by.h b/level_0/f_iki/tests/unit/c/test-iki-datass_decimate_by.h
deleted file mode 100644 (file)
index ce5155d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datass_decimate_by_h
-#define _TEST__F_iki_datass_decimate_by_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datass_decimate_by()
- */
-extern void test__f_iki_datass_decimate_by__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datass_decimate_by()
- */
-extern void test__f_iki_datass_decimate_by__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datass_decimate_by_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_decrease_by.c b/level_0/f_iki/tests/unit/c/test-iki-datass_decrease_by.c
deleted file mode 100644 (file)
index dea8c3f..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datass_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datass_decrease_by__works(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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_iki_datass_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);
-}
-
-void test__f_iki_datass_decrease_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_decrease_by.h b/level_0/f_iki/tests/unit/c/test-iki-datass_decrease_by.h
deleted file mode 100644 (file)
index 174ca8e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datass_decrease_by_h
-#define _TEST__F_iki_datass_decrease_by_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datass_decrease_by()
- */
-extern void test__f_iki_datass_decrease_by__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datass_decrease_by()
- */
-extern void test__f_iki_datass_decrease_by__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datass_decrease_by_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_increase.c b/level_0/f_iki/tests/unit/c/test-iki-datass_increase.c
deleted file mode 100644 (file)
index a2e3912..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datass_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datass_increase__works(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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_iki_datass_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);
-}
-
-void test__f_iki_datass_increase__returns_data_not(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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_iki_datass_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_iki_datass_increase__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_increase.h b/level_0/f_iki/tests/unit/c/test-iki-datass_increase.h
deleted file mode 100644 (file)
index db08526..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datass_increase_h
-#define _TEST__F_iki_datass_increase_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datass_increase()
- */
-extern void test__f_iki_datass_increase__works(void **state);
-
-/**
- * Test that the function returns F_data_not when asked to copy an empty structure.
- *
- * @see f_iki_datass_increase()
- */
-extern void test__f_iki_datass_increase__returns_data_not(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datass_increase()
- */
-extern void test__f_iki_datass_increase__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datass_increase_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_increase_by.c b/level_0/f_iki/tests/unit/c/test-iki-datass_increase_by.c
deleted file mode 100644 (file)
index 24e07c4..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datass_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datass_increase_by__works(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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_iki_datass_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);
-}
-
-void test__f_iki_datass_increase_by__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datas_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_increase_by.h b/level_0/f_iki/tests/unit/c/test-iki-datass_increase_by.h
deleted file mode 100644 (file)
index c9c8909..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datass_increase_by_h
-#define _TEST__F_iki_datass_increase_by_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datass_increase_by()
- */
-extern void test__f_iki_datass_increase_by__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datass_increase_by()
- */
-extern void test__f_iki_datass_increase_by__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datass_increase_by_h
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_resize.c b/level_0/f_iki/tests/unit/c/test-iki-datass_resize.c
deleted file mode 100644 (file)
index 852ef54..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "test-iki.h"
-#include "test-iki-datass_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_iki_datass_resize__works(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datass_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-void test__f_iki_datass_resize__parameter_checking(void **state) {
-
-  const int length = 5;
-  f_iki_datass_t data = f_iki_datass_t_initialize;
-
-  {
-    const f_status_t status = f_iki_datass_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);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_resize.h b/level_0/f_iki/tests/unit/c/test-iki-datass_resize.h
deleted file mode 100644 (file)
index 06610a5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * FLL - Level 0
- *
- * Project: Type
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_iki_datass_resize_h
-#define _TEST__F_iki_datass_resize_h
-
-/**
- * Test that the function works.
- *
- * @see f_iki_datass_resize()
- */
-extern void test__f_iki_datass_resize__works(void **state);
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_iki_datass_resize()
- */
-extern void test__f_iki_datass_resize__parameter_checking(void **state);
-
-#endif // _TEST__F_iki_datass_resize_h
index 22d5d88fdb091aaa5fa72c671d87af12879fe321..d1c686f70cbd52c86cea723be1ed396ec0c53ffe 100644 (file)
@@ -83,6 +83,8 @@ void test__f_iki_read__returns_data_not_stop(void **state) {
 
 void test__f_iki_read__works(void **state) {
 
+  mock_unwrap = 1;
+
   f_state_t state_data = f_state_t_initialize;
   f_string_static_t empty = macro_f_string_static_t_initialize_1(f_string_empty_s.string, f_string_empty_s.size, f_string_empty_s.used);
   f_string_static_t ascii_a = macro_f_string_static_t_initialize_1(f_string_ascii_a_s.string, f_string_ascii_a_s.size, f_string_ascii_a_s.used);
index 8e46be3e302752022127826f7664d6b190d40c4b..3c120263a3eda97c531c911176fe0cebd69d940e 100644 (file)
@@ -29,28 +29,20 @@ int main(void) {
     cmocka_unit_test(test__f_iki_content_partial_is__returns_false),
     cmocka_unit_test(test__f_iki_content_partial_is__returns_true),
 
-    cmocka_unit_test(test__f_iki_datas_adjust__works),
+    cmocka_unit_test(test__f_iki_datas_adjust_callback__fails),
+    cmocka_unit_test(test__f_iki_datas_resize_callback__fails),
+
+    cmocka_unit_test(test__f_iki_datas_adjust_callback__works),
+    cmocka_unit_test(test__f_iki_datas_resize_callback__works),
+
     cmocka_unit_test(test__f_iki_datas_append__works),
     cmocka_unit_test(test__f_iki_datas_append_all__works),
     cmocka_unit_test(test__f_iki_datas_append_all__returns_data_not),
-    cmocka_unit_test(test__f_iki_datas_decimate_by__works),
-    cmocka_unit_test(test__f_iki_datas_decrease_by__works),
-    cmocka_unit_test(test__f_iki_datas_increase__works),
-    cmocka_unit_test(test__f_iki_datas_increase__returns_data_not),
-    cmocka_unit_test(test__f_iki_datas_increase_by__works),
-    cmocka_unit_test(test__f_iki_datas_resize__works),
-
-    cmocka_unit_test(test__f_iki_datass_adjust__works),
+
     cmocka_unit_test(test__f_iki_datass_append__works),
     cmocka_unit_test(test__f_iki_datass_append__returns_data_not),
     cmocka_unit_test(test__f_iki_datass_append_all__works),
     cmocka_unit_test(test__f_iki_datass_append_all__returns_data_not),
-    cmocka_unit_test(test__f_iki_datass_decimate_by__works),
-    cmocka_unit_test(test__f_iki_datass_decrease_by__works),
-    cmocka_unit_test(test__f_iki_datass_increase__works),
-    cmocka_unit_test(test__f_iki_datass_increase__returns_data_not),
-    cmocka_unit_test(test__f_iki_datass_increase_by__works),
-    cmocka_unit_test(test__f_iki_datass_resize__works),
 
     cmocka_unit_test(test__f_iki_object_is__returns_data_not),
     cmocka_unit_test(test__f_iki_object_is__returns_false),
@@ -71,23 +63,14 @@ int main(void) {
       cmocka_unit_test(test__f_iki_content_is__parameter_checking),
       cmocka_unit_test(test__f_iki_content_partial_is__parameter_checking),
 
-      cmocka_unit_test(test__f_iki_datas_adjust__parameter_checking),
+      // f_iki_datas_adjust_callback() doesn't use parameter checking.
+      // f_iki_datas_resize_callback() doesn't use parameter checking.
+
       cmocka_unit_test(test__f_iki_datas_append__parameter_checking),
       cmocka_unit_test(test__f_iki_datas_append_all__parameter_checking),
-      cmocka_unit_test(test__f_iki_datas_decimate_by__parameter_checking),
-      cmocka_unit_test(test__f_iki_datas_decrease_by__parameter_checking),
-      cmocka_unit_test(test__f_iki_datas_increase__parameter_checking),
-      cmocka_unit_test(test__f_iki_datas_increase_by__parameter_checking),
-      cmocka_unit_test(test__f_iki_datas_resize__parameter_checking),
 
-      cmocka_unit_test(test__f_iki_datass_adjust__parameter_checking),
       cmocka_unit_test(test__f_iki_datass_append__parameter_checking),
       cmocka_unit_test(test__f_iki_datass_append_all__parameter_checking),
-      cmocka_unit_test(test__f_iki_datass_decimate_by__parameter_checking),
-      cmocka_unit_test(test__f_iki_datass_decrease_by__parameter_checking),
-      cmocka_unit_test(test__f_iki_datass_increase__parameter_checking),
-      cmocka_unit_test(test__f_iki_datass_increase_by__parameter_checking),
-      cmocka_unit_test(test__f_iki_datass_resize__parameter_checking),
 
       // f_iki_object_is() doesn't use parameter checking.
       // f_iki_object_partial_is() doesn't use parameter checking.
index b84b7ca7304e02b745a0db1dff8a488a7013657c..b1a7267fe76da87c088f2f3ea21e1ec9b3d1b645 100644 (file)
 #include <fll/level_0/iki.h>
 
 // Mock includes.
-//#include "mock-iki.h"
+#include "mock-iki.h"
 
 // Test includes.
 #include "test-iki-content_is.h"
 #include "test-iki-content_partial_is.h"
-#include "test-iki-datas_adjust.h"
+#include "test-iki-datas_adjust_callback.h"
 #include "test-iki-datas_append.h"
 #include "test-iki-datas_append_all.h"
-#include "test-iki-datas_decimate_by.h"
-#include "test-iki-datas_decrease_by.h"
-#include "test-iki-datas_increase.h"
-#include "test-iki-datas_increase_by.h"
-#include "test-iki-datas_resize.h"
-#include "test-iki-datass_adjust.h"
+#include "test-iki-datas_resize_callback.h"
 #include "test-iki-datass_append.h"
 #include "test-iki-datass_append_all.h"
-#include "test-iki-datass_decimate_by.h"
-#include "test-iki-datass_decrease_by.h"
-#include "test-iki-datass_increase.h"
-#include "test-iki-datass_increase_by.h"
-#include "test-iki-datass_resize.h"
 #include "test-iki-object_is.h"
 #include "test-iki-object_partial_is.h"
 #include "test-iki-read.h"
index 6532bbb860ec3907271e18b91418a1d66bb667e1..83a9078c6dfaa0d18eb2c40f7b2d3f180c38c46c 100644 (file)
@@ -14,7 +14,7 @@ extern "C" {
   void controller_rule_action_delete_simple(controller_rule_action_t * const action) {
 
     f_string_dynamics_resize(0, &action->parameters);
-    f_iki_datas_resize(0, &action->ikis);
+    f_memory_array_resize(0, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
   }
 #endif // _di_controller_rule_action_delete_simple_
 
index dd79b8a16034416e31ffe6b6b763f61b0665bd57..7b74e5177d4af4c750b3c3db98fca4aac1a22bdd 100644 (file)
@@ -82,14 +82,14 @@ extern "C" {
       }
 
       if (content) {
-        status = f_iki_datas_increase_by(content->used + 1, &action->ikis);
+        status = f_memory_array_increase_by(content->used + 1, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
       }
       else {
-        status = f_iki_datas_increase(controller_common_allocation_small_d, &action->ikis);
+        status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), content ? "f_iki_datas_increase_by" : "f_iki_datas_increase", F_true);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), content ? "f_memory_array_increase_by" : "f_memory_array_increase", F_true);
 
         return status;
       }
@@ -121,10 +121,10 @@ extern "C" {
         return status;
       }
 
-      status = f_iki_datas_increase_by(content->used, &action->ikis);
+      status = f_memory_array_increase_by(content->used, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_iki_datas_increase_by", F_true);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_memory_array_increase_by", F_true);
 
         return status;
       }
@@ -276,10 +276,10 @@ extern "C" {
             return status;
           }
 
-          status = f_iki_datas_increase(controller_common_allocation_small_d, &actions->array[actions->used].ikis);
+          status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_iki_datas_increase", F_true);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_memory_array_increase", F_true);
 
             return status;
           }
@@ -576,10 +576,10 @@ extern "C" {
             return status;
           }
 
-          status = f_iki_datas_increase(controller_common_allocation_small_d, &actions->array[actions->used].ikis);
+          status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_iki_datas_increase", F_true);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_memory_array_increase", F_true);
 
             return status;
           }
index eba8634929f98a272cb22d69e1a68262e2b7b48e..8e6b7e05ad103984f03b4e1148c1059b34152c6e 100644 (file)
@@ -87,14 +87,16 @@ extern "C" {
  *   F_none on success.
  *
  *   Errors (with error bit) from: f_fss_count_lines().
- *   Errors (with error bit) from: f_iki_datas_increase_by().
+ *   Errors (with error bit) from: f_memory_array_increase().
+ *   Errors (with error bit) from: f_memory_array_increase_by().
  *   Errors (with error bit) from: f_string_dynamic_partial_append_nulless().
  *   Errors (with error bit) from: f_string_dynamics_increase().
  *   Errors (with error bit) from: f_string_dynamics_increase_by().
  *   Errors (with error bit) from: fl_iki_read().
  *
  * @see f_fss_count_lines()
- * @see f_iki_datas_increase_by()
+ * @see f_memory_array_increase()
+ * @see f_memory_array_increase_by()
  * @see f_string_dynamic_partial_append_nulless()
  * @see f_string_dynamics_increase()
  * @see f_string_dynamics_increase_by()