--- /dev/null
+# fss-0000
+
+cmocka 1.*
--- /dev/null
+# fss-0001
+
+project_name test-f_memory
+
+version_major 0
+version_file major
+version_target major
+
+modes individual
+modes_default individual
+
+build_compiler gcc
+build_indexer ar
+build_indexer_arguments rcs
+build_language c
+build_libraries -lc -lcmocka
+build_libraries-individual -lf_memory
+build_sources_program test-memory-adjust.c test-memory-delete.c test-memory-destroy.c test-memory-new_aligned.c test-memory-new.c test-memory-resize.c test-memory.c
+build_script no
+build_shared yes
+build_static no
+
+path_headers tests/c
+path_headers_preserve no
+path_sources tests/c
+path_standard no
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+defines -Ibuild/includes
+defines_static -Lbuild/libraries/static
+defines_shared -Lbuild/libraries/shared
+
+flags -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_program -fPIE
+flags_program_shared
+flags_program_static
+flags_shared
+flags_static
--- /dev/null
+#include "test-memory.h"
+#include "test-memory-adjust.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_memory_adjust__works(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_adjust(1, 4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ free((void *) data);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Memory
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the memory project.
+ */
+#ifndef _TEST__F_memory__adjust
+#define _TEST__F_memory__adjust
+
+/**
+ * Test that reallocation works.
+ *
+ * @see f_memory_new()
+ * @see f_memory_adjust()
+ */
+extern void test__f_memory_adjust__works(void **state);
+
+#endif // _TEST__F_memory__adjust
--- /dev/null
+#include "test-memory.h"
+#include "test-memory-delete.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_memory_delete__frees_adjusted_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_adjust(1, 4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_delete(4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+void test__f_memory_delete__frees_aligned_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new_aligned(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_delete(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+void test__f_memory_delete__frees_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_delete(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+void test__f_memory_delete__frees_resized_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_resize(1, 4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_delete(4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Memory
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the memory project.
+ */
+#ifndef _TEST__F_memory__delete
+#define _TEST__F_memory__delete
+
+/**
+ * Test that deallocation works for adjusted memory.
+ *
+ * @see f_memory_adjust()
+ * @see f_memory_delete()
+ * @see f_memory_new()
+ */
+extern void test__f_memory_delete__frees_adjusted_memory(void **state);
+
+/**
+ * Test that deallocation works for aligned memory.
+ *
+ * @see f_memory_delete()
+ * @see f_memory_new_aligned()
+ */
+extern void test__f_memory_delete__frees_aligned_memory(void **state);
+
+/**
+ * Test that deallocation works.
+ *
+ * @see f_memory_delete()
+ * @see f_memory_new()
+ */
+extern void test__f_memory_delete__frees_memory(void **state);
+
+/**
+ * Test that deallocation works for resized memory.
+ *
+ * @see f_memory_delete()
+ * @see f_memory_new()
+ * @see f_memory_resize()
+ */
+extern void test__f_memory_delete__frees_resized_memory(void **state);
+
+#endif // _TEST__F_memory__delete
--- /dev/null
+#include "test-memory.h"
+#include "test-memory-destroy.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_memory_destroy__frees_adjusted_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_adjust(1, 4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_destroy(4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+void test__f_memory_destroy__frees_aligned_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new_aligned(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_destroy(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+void test__f_memory_destroy__frees_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_destroy(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+void test__f_memory_destroy__frees_resized_memory(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_resize(1, 4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_destroy(4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_null(data);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Memory
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the memory project.
+ */
+#ifndef _TEST__F_memory__destroy
+#define _TEST__F_memory__destroy
+
+/**
+ * Test that deallocation works for adjusted memory.
+ *
+ * @see f_memory_adjust()
+ * @see f_memory_destroy()
+ * @see f_memory_new()
+ */
+extern void test__f_memory_destroy__frees_adjusted_memory(void **state);
+
+/**
+ * Test that deallocation works for aligned memory.
+ *
+ * @see f_memory_destroy()
+ * @see f_memory_new_aligned()
+ */
+extern void test__f_memory_destroy__frees_aligned_memory(void **state);
+
+/**
+ * Test that deallocation works.
+ *
+ * @see f_memory_destroy()
+ * @see f_memory_new()
+ */
+extern void test__f_memory_destroy__frees_memory(void **state);
+
+/**
+ * Test that deallocation works for resized memory.
+ *
+ * @see f_memory_destroy()
+ * @see f_memory_new()
+ * @see f_memory_resize()
+ */
+extern void test__f_memory_destroy__frees_resized_memory(void **state);
+
+#endif // _TEST__F_memory__destroy
--- /dev/null
+#include "test-memory.h"
+#include "test-memory.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_memory_new__works(void **state) {
+
+ uint16_t *data = 0;
+
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+
+ free((void *) data);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Memory
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the memory project.
+ */
+#ifndef _TEST__F_memory__new
+#define _TEST__F_memory__new
+
+/**
+ * Test that allocation works.
+ *
+ * @see f_memory_new()
+ */
+extern void test__f_memory_new__works(void **state);
+
+#endif // _TEST__F_memory__new
--- /dev/null
+#include "test-memory.h"
+#include "test-memory-new_aligned.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_memory_new_aligned__works(void **state) {
+
+ uint16_t *data = 0;
+
+ const f_status_t status = f_memory_new_aligned(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+
+ free((void *) data);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Memory
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the memory project.
+ */
+#ifndef _TEST__F_memory__new_aligned
+#define _TEST__F_memory__new_aligned
+
+/**
+ * Test that allocation works.
+ *
+ * @see f_memory_new_aligned()
+ */
+extern void test__f_memory_new_aligned__works(void **state);
+
+#endif // _TEST__F_memory__new_aligned
--- /dev/null
+#include "test-memory.h"
+#include "test-memory-resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_memory_resize__works(void **state) {
+
+ uint16_t *data = 0;
+
+ {
+ const f_status_t status = f_memory_new(1, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ {
+ const f_status_t status = f_memory_resize(1, 4, sizeof(uint16_t), (void **) &data);
+
+ assert_int_equal(status, F_none);
+ assert_non_null(data);
+ }
+
+ free((void *) data);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Memory
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the memory project.
+ */
+#ifndef _TEST__F_memory__resize
+#define _TEST__F_memory__resize
+
+/**
+ * Test that reallocation works.
+ *
+ * @see f_memory_new()
+ * @see f_memory_resize()
+ */
+extern void test__f_memory_resize__works(void **state);
+
+#endif // _TEST__F_memory__resize
--- /dev/null
+#include "test-memory.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int setup(void **state) {
+
+ return 0;
+}
+
+int setdown(void **state) {
+
+ return 0;
+}
+
+int main(void) {
+
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test__f_memory_adjust__works),
+
+ cmocka_unit_test(test__f_memory_delete__frees_adjusted_memory),
+ cmocka_unit_test(test__f_memory_delete__frees_aligned_memory),
+ cmocka_unit_test(test__f_memory_delete__frees_memory),
+ cmocka_unit_test(test__f_memory_delete__frees_resized_memory),
+
+ cmocka_unit_test(test__f_memory_destroy__frees_adjusted_memory),
+ cmocka_unit_test(test__f_memory_destroy__frees_aligned_memory),
+ cmocka_unit_test(test__f_memory_destroy__frees_memory),
+ cmocka_unit_test(test__f_memory_destroy__frees_resized_memory),
+
+ cmocka_unit_test(test__f_memory_new__works),
+ cmocka_unit_test(test__f_memory_new_aligned__works),
+
+ cmocka_unit_test(test__f_memory_resize__works),
+ };
+
+ return cmocka_run_group_tests(tests, setup, setdown);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Memory
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the memory project.
+ */
+#ifndef _TEST__F_memory_h
+#define _TEST__F_memory_h
+
+// libc includes
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <stdint.h>
+
+// cmocka includes
+#include <cmocka.h>
+
+// fll-0 includes
+#include <fll/level_0/memory.h>
+
+// test includes
+#include "test-memory-adjust.h"
+#include "test-memory-delete.h"
+#include "test-memory-destroy.h"
+#include "test-memory-new.h"
+#include "test-memory-new_aligned.h"
+#include "test-memory-resize.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Perform any setup operations.
+ *
+ * @param state
+ * The test state.
+ *
+ * @return
+ * The status of this function, where 0 means success.
+ */
+extern int setup(void **state);
+
+/**
+ * Pefom any setdown operations.
+ *
+ * @param state
+ * The test state.
+ *
+ * @return
+ * The status of this function, where 0 means success.
+ */
+extern int setdown(void **state);
+
+/**
+ * Run all tests.
+ *
+ * @return
+ * The final result of the tests.
+ *
+ * @see cmocka_run_group_tests()
+ * @see cmocka_unit_test()
+ */
+extern int main(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _TEST__F_memory_h