flags -Wl,--wrap=pthread_attr_getguardsize
flags -Wl,--wrap=pthread_attr_getinheritsched
flags -Wl,--wrap=pthread_attr_getschedparam
+flags -Wl,--wrap=pthread_attr_getschedpolicy
+flags -Wl,--wrap=pthread_attr_getscope
+flags -Wl,--wrap=pthread_attr_getscopesize
+flags -Wl,--wrap=pthread_attr_getstack
+flags -Wl,--wrap=pthread_attr_getstacksize
flags -Wl,--wrap=pthread_attr_init
flags -Wl,--wrap=pthread_attr_setaffinity_np
flags -Wl,--wrap=pthread_attr_setdetachstate
flags -Wl,--wrap=pthread_attr_setguardsize
flags -Wl,--wrap=pthread_attr_setinheritsched
flags -Wl,--wrap=pthread_attr_setschedparam
+flags -Wl,--wrap=pthread_attr_setschedpolicy
+flags -Wl,--wrap=pthread_attr_setscope
+flags -Wl,--wrap=pthread_attr_setscopesize
+flags -Wl,--wrap=pthread_attr_setstack
+flags -Wl,--wrap=pthread_attr_setstacksize
+flags -Wl,--wrap=pthread_barrierattr_destroy
+flags -Wl,--wrap=pthread_barrierattr_init
+flags -Wl,--wrap=pthread_barrierattr_getpshared
+flags -Wl,--wrap=pthread_barrierattr_setpshared
flags -Wl,--wrap=pthread_barrier_destroy
+flags -Wl,--wrap=pthread_barrier_init
+flags -Wl,--wrap=pthread_barrier_wait
flags -Wl,--wrap=pthread_condattr_getclock
flags -Wl,--wrap=pthread_condattr_getpshared
flags -Wl,--wrap=pthread_condattr_setclock
build_sources_program test-thread-attribute_guard_get.c test-thread-attribute_guard_set.c
build_sources_program test-thread-attribute_scheduler_inherit_get.c test-thread-attribute_scheduler_inherit_set.c
build_sources_program test-thread-attribute_scheduler_parameter_get.c test-thread-attribute_scheduler_parameter_set.c
+build_sources_program test-thread-attribute_scheduler_policy_get.c test-thread-attribute_scheduler_policy_set.c
+build_sources_program test-thread-attribute_scope_get.c test-thread-attribute_scope_set.c
+build_sources_program test-thread-attribute_stack_get.c test-thread-attribute_stack_set.c
+build_sources_program test-thread-attribute_stack_size_get.c test-thread-attribute_stack_size_set.c
+build_sources_program test-thread-barrier_attribute_create.c test-thread-barrier_attribute_delete.c
+build_sources_program test-thread-barrier_attribute_shared_get.c test-thread-barrier_attribute_shared_set.c
+build_sources_program test-thread-barrier_create.c test-thread-barrier_delete.c
+build_sources_program test-thread-barrier_wait.c
build_sources_program test-thread.c
return 0;
}
-int __wrap_pthread_attr_getaffinity_np(const pthread_attr_t *__attr, size_t __cpusetsize, cpu_set_t *__cpuset) {
+int __wrap_pthread_attr_getaffinity_np(const pthread_attr_t *attr, size_t cpusetsize, cpu_set_t *cpuset) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_getguardsize(const pthread_attr_t *restrict attr, size_t *restrict guardsize) {
+int __wrap_pthread_attr_getguardsize(const pthread_attr_t * restrict attr, size_t * restrict guardsize) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_getinheritsched(const pthread_attr_t *restrict attr, int *restrict inheritsched) {
+int __wrap_pthread_attr_getinheritsched(const pthread_attr_t * restrict attr, int * restrict inheritsched) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_getschedparam(const pthread_attr_t *restrict attr, struct sched_param *restrict param) {
+int __wrap_pthread_attr_getschedparam(const pthread_attr_t * restrict attr, struct sched_param * restrict param) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_setaffinity_np(pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset) {
+int __wrap_pthread_attr_getschedpolicy(const pthread_attr_t * restrict attr, int * restrict policy) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_barrier_destroy(pthread_barrier_t barrier) {
+int __wrap_pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_condattr_getclock(const pthread_condattr_t *__restrict __attr, clockid_t *__restrict __clock_id) {
+int __wrap_pthread_attr_getstack(const pthread_attr_t *attr, void **stackaddr, size_t *stacksize) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_condattr_setclock(pthread_condattr_t *__attr, clockid_t __clock_id) {
+int __wrap_pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_condattr_getpshared(const pthread_condattr_t *__attr, int *__pshared) {
+int __wrap_pthread_attr_init(pthread_attr_t *attr) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_condattr_setpshared(pthread_condattr_t *__attr, int __pshared) {
+int __wrap_pthread_attr_setaffinity_np(pthread_t id, size_t cpusetsize, const cpu_set_t *cpuset) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_getattr_default_np(pthread_attr_t *attr) {
+int __wrap_pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_setattr_default_np(const pthread_attr_t *attr) {
+int __wrap_pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_init(pthread_attr_t *__attr) {
+int __wrap_pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) {
+int __wrap_pthread_attr_setschedparam(pthread_attr_t *restrict attr, const struct sched_param *restrict param) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize) {
+int __wrap_pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched) {
+int __wrap_pthread_attr_setscope(pthread_attr_t *attr, int contentionscope) {
const bool failure = mock_type(bool);
return 0;
}
-int __wrap_pthread_attr_setschedparam(pthread_attr_t *restrict attr, const struct sched_param *restrict param) {
+int __wrap_pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, size_t stacksize) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_barrierattr_destroy(pthread_barrierattr_t *attr) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_barrierattr_init(pthread_barrierattr_t *attr) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, int *pshared) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_barrier_destroy(pthread_barrier_t *barrier) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned count) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_barrier_wait(pthread_barrier_t *barrier) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_condattr_getclock(const pthread_condattr_t * restrict attr, clockid_t * restrict clock_id) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
+int __wrap_pthread_getattr_default_np(pthread_attr_t *attr) {
const bool failure = mock_type(bool);
return mock_type(int);
}
+int __wrap_pthread_setattr_default_np(const pthread_attr_t *attr) {
+
+ const bool failure = mock_type(bool);
+
+ if (failure) {
+ return mock_type(int);
+ }
+
+ return 0;
+}
+
void stub(void) {
}
extern int __wrap_pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
extern int __wrap_pthread_attr_destroy(pthread_attr_t *attr);
-extern int __wrap_pthread_attr_getaffinity_np(const pthread_attr_t *__attr, size_t __cpusetsize, cpu_set_t *__cpuset);
+extern int __wrap_pthread_attr_getaffinity_np(const pthread_attr_t *attr, size_t cpusetsize, cpu_set_t *cpuset);
extern int __wrap_pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate);
extern int __wrap_pthread_attr_getguardsize(const pthread_attr_t *restrict attr, size_t *restrict guardsize);
extern int __wrap_pthread_attr_getinheritsched(const pthread_attr_t *restrict attr, int *restrict inheritsched);
extern int __wrap_pthread_attr_getschedparam(const pthread_attr_t *restrict attr, struct sched_param *restrict param);
-extern int __wrap_pthread_attr_init(pthread_attr_t *__attr);
-extern int __wrap_pthread_attr_setaffinity_np(pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset);
+extern int __wrap_pthread_attr_getschedpolicy(const pthread_attr_t *restrict attr, int *restrict policy);
+extern int __wrap_pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope);
+extern int __wrap_pthread_attr_getstack(const pthread_attr_t *attr, void **stackaddr, size_t *stacksize);
+extern int __wrap_pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize);
+extern int __wrap_pthread_attr_init(pthread_attr_t *attr);
+extern int __wrap_pthread_attr_setaffinity_np(pthread_t id, size_t cpusetsize, const cpu_set_t *cpuset);
extern int __wrap_pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate);
extern int __wrap_pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize);
extern int __wrap_pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched);
extern int __wrap_pthread_attr_setschedparam(pthread_attr_t *restrict attr, const struct sched_param *restrict param);
-extern int __wrap_pthread_barrier_destroy(pthread_barrier_t barrier);
-extern int __wrap_pthread_condattr_getclock(const pthread_condattr_t *__restrict __attr, clockid_t *__restrict __clock_id);
-extern int __wrap_pthread_condattr_getpshared(const pthread_condattr_t *__attr, int *__pshared);
-extern int __wrap_pthread_condattr_setclock(pthread_condattr_t *__attr, clockid_t __clock_id);
-extern int __wrap_pthread_condattr_setpshared(pthread_condattr_t *__attr, int __pshared);
+extern int __wrap_pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
+extern int __wrap_pthread_attr_setscope(pthread_attr_t *attr, int contentionscope);
+extern int __wrap_pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, size_t stacksize);
+extern int __wrap_pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
+extern int __wrap_pthread_barrierattr_destroy(pthread_barrierattr_t *attr);
+extern int __wrap_pthread_barrierattr_init(pthread_barrierattr_t *attr);
+extern int __wrap_pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, int *pshared);
+extern int __wrap_pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared);
+extern int __wrap_pthread_barrier_destroy(pthread_barrier_t *barrier);
+extern int __wrap_pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned count);
+extern int __wrap_pthread_barrier_wait(pthread_barrier_t *barrier);
+extern int __wrap_pthread_condattr_getclock(const pthread_condattr_t * restrict attr, clockid_t * restrict clock_id);
+extern int __wrap_pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared);
+extern int __wrap_pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id);
+extern int __wrap_pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared);
extern int __wrap_pthread_getattr_default_np(pthread_attr_t *attr);
extern int __wrap_pthread_key_delete(pthread_key_t key);
extern int __wrap_pthread_setattr_default_np(const pthread_attr_t *attr);
/*
-pthread_attr_getschedpolicy
-pthread_attr_setschedpolicy
-pthread_attr_getscope
-pthread_attr_setscope
-pthread_attr_getstack
-pthread_attr_setstack
-pthread_attr_getstacksize
-pthread_attr_setstacksize
-pthread_barrierattr_init
-pthread_barrierattr_getpshared
-pthread_barrierattr_setpshared
-pthread_barrier_init
-pthread_barrier_wait
pthread_setcancelstate
pthread_testcancel
pthread_setcanceltype
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_scheduler_policy_get.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_scheduler_policy_get__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int policy = 0;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_attr_getschedpolicy, true);
+ will_return(__wrap_pthread_attr_getschedpolicy, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_scheduler_policy_get(attribute, &policy);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_scheduler_policy_get__parameter_checking(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+
+ {
+ const f_status_t status = f_thread_attribute_scheduler_policy_get(attribute, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_scheduler_policy_get__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int policy = 0;
+
+ {
+ will_return(__wrap_pthread_attr_getschedpolicy, false);
+
+ const f_status_t status = f_thread_attribute_scheduler_policy_get(attribute, &policy);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_scheduler_policy_get_h
+#define _TEST__F_thread__attribute_scheduler_policy_get_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_scheduler_policy_get()
+ */
+extern void test__f_thread_attribute_scheduler_policy_get__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_scheduler_policy_get()
+ */
+extern void test__f_thread_attribute_scheduler_policy_get__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_scheduler_policy_get()
+ */
+extern void test__f_thread_attribute_scheduler_policy_get__works(void **state);
+
+#endif // _TEST__F_thread__attribute_scheduler_policy_get_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_scheduler_policy_set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_scheduler_policy_set__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int policy = 0;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_attr_setschedpolicy, true);
+ will_return(__wrap_pthread_attr_setschedpolicy, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_scheduler_policy_set(policy, &attribute);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_scheduler_policy_set__parameter_checking(void **state) {
+
+ int policy = 0;
+
+ {
+ const f_status_t status = f_thread_attribute_scheduler_policy_set(policy, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_scheduler_policy_set__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int policy = 0;
+
+ {
+ will_return(__wrap_pthread_attr_setschedpolicy, false);
+
+ const f_status_t status = f_thread_attribute_scheduler_policy_set(policy, &attribute);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_scheduler_policy_set_h
+#define _TEST__F_thread__attribute_scheduler_policy_set_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_scheduler_policy_set()
+ */
+extern void test__f_thread_attribute_scheduler_policy_set__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_scheduler_policy_set()
+ */
+extern void test__f_thread_attribute_scheduler_policy_set__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_scheduler_policy_set()
+ */
+extern void test__f_thread_attribute_scheduler_policy_set__works(void **state);
+
+#endif // _TEST__F_thread__attribute_scheduler_policy_set_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_scope_get.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_scope_get__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int scope = 0;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_attr_getscope, true);
+ will_return(__wrap_pthread_attr_getscope, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_scope_get(attribute, &scope);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_scope_get__parameter_checking(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+
+ {
+ const f_status_t status = f_thread_attribute_scope_get(attribute, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_scope_get__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int scope = 0;
+
+ {
+ will_return(__wrap_pthread_attr_getscope, false);
+
+ const f_status_t status = f_thread_attribute_scope_get(attribute, &scope);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_scope_get_h
+#define _TEST__F_thread__attribute_scope_get_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_scope_get()
+ */
+extern void test__f_thread_attribute_scope_get__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_scope_get()
+ */
+extern void test__f_thread_attribute_scope_get__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_scope_get()
+ */
+extern void test__f_thread_attribute_scope_get__works(void **state);
+
+#endif // _TEST__F_thread__attribute_scope_get_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_scope_set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_scope_set__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int scope = 0;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_attr_setscope, true);
+ will_return(__wrap_pthread_attr_setscope, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_scope_set(scope, &attribute);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_scope_set__parameter_checking(void **state) {
+
+ int scope = 0;
+
+ {
+ const f_status_t status = f_thread_attribute_scope_set(scope, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_scope_set__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ int scope = 0;
+
+ {
+ will_return(__wrap_pthread_attr_setscope, false);
+
+ const f_status_t status = f_thread_attribute_scope_set(scope, &attribute);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_scope_set_h
+#define _TEST__F_thread__attribute_scope_set_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_scope_set()
+ */
+extern void test__f_thread_attribute_scope_set__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_scope_set()
+ */
+extern void test__f_thread_attribute_scope_set__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_scope_set()
+ */
+extern void test__f_thread_attribute_scope_set__works(void **state);
+
+#endif // _TEST__F_thread__attribute_scope_set_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_stack_get.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_stack_get__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+ int stack[] = { 0, 0 };
+
+ int errnos[] = {
+ EACCES,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_access_denied,
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_attr_getstack, true);
+ will_return(__wrap_pthread_attr_getstack, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_stack_get(attribute, &stack_size, (void *) &stack);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_stack_get__parameter_checking(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+
+ {
+ const f_status_t status = f_thread_attribute_stack_get(attribute, 0, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_stack_get__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+ int stack[] = { 0, 0 };
+
+ {
+ will_return(__wrap_pthread_attr_getstack, false);
+
+ const f_status_t status = f_thread_attribute_stack_get(attribute, &stack_size, (void *) &stack);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_stack_get_h
+#define _TEST__F_thread__attribute_stack_get_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_stack_get()
+ */
+extern void test__f_thread_attribute_stack_get__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_stack_get()
+ */
+extern void test__f_thread_attribute_stack_get__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_stack_get()
+ */
+extern void test__f_thread_attribute_stack_get__works(void **state);
+
+#endif // _TEST__F_thread__attribute_stack_get_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_stack_set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_stack_set__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+ int stack[] = { 0, 0 };
+
+ int errnos[] = {
+ EACCES,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_access_denied,
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_attr_setstack, true);
+ will_return(__wrap_pthread_attr_setstack, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_stack_set(stack_size, (void *) &stack, &attribute);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_stack_set__parameter_checking(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+ int stack[] = { 0, 0 };
+
+ {
+ const f_status_t status = f_thread_attribute_stack_set(stack_size, 0, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+
+ {
+ const f_status_t status = f_thread_attribute_stack_set(stack_size, (void *) &stack, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+
+ {
+ const f_status_t status = f_thread_attribute_stack_set(stack_size, 0, &attribute);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_stack_set__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+ int stack[] = { 0, 0 };
+
+ {
+ will_return(__wrap_pthread_attr_setstack, false);
+
+ const f_status_t status = f_thread_attribute_stack_set(stack_size, (void *) &stack, &attribute);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_stack_set_h
+#define _TEST__F_thread__attribute_stack_set_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_stack_set()
+ */
+extern void test__f_thread_attribute_stack_set__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_stack_set()
+ */
+extern void test__f_thread_attribute_stack_set__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_stack_set()
+ */
+extern void test__f_thread_attribute_stack_set__works(void **state);
+
+#endif // _TEST__F_thread__attribute_stack_set_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_stack_size_get.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_stack_size_get__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_attr_getstacksize, true);
+ will_return(__wrap_pthread_attr_getstacksize, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_stack_size_get(attribute, &stack_size);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_stack_size_get__parameter_checking(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+
+ {
+ const f_status_t status = f_thread_attribute_stack_size_get(attribute, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_stack_size_get__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+
+ {
+ will_return(__wrap_pthread_attr_getstacksize, false);
+
+ const f_status_t status = f_thread_attribute_stack_size_get(attribute, &stack_size);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_stack_size_get_h
+#define _TEST__F_thread__attribute_stack_size_get_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_stack_size_get()
+ */
+extern void test__f_thread_attribute_stack_size_get__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_stack_size_get()
+ */
+extern void test__f_thread_attribute_stack_size_get__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_stack_size_get()
+ */
+extern void test__f_thread_attribute_stack_size_get__works(void **state);
+
+#endif // _TEST__F_thread__attribute_stack_size_get_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-attribute_stack_size_set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_attribute_stack_size_set__fails(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_attr_setstacksize, true);
+ will_return(__wrap_pthread_attr_setstacksize, errnos[i]);
+
+ const f_status_t status = f_thread_attribute_stack_size_set(stack_size, &attribute);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_attribute_stack_size_set__parameter_checking(void **state) {
+
+ size_t stack_size = 2;
+
+ {
+ const f_status_t status = f_thread_attribute_stack_size_set(stack_size, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_attribute_stack_size_set__works(void **state) {
+
+ f_thread_attribute_t attribute = f_thread_attribute_t_initialize;
+ size_t stack_size = 2;
+
+ {
+ will_return(__wrap_pthread_attr_setstacksize, false);
+
+ const f_status_t status = f_thread_attribute_stack_size_set(stack_size, &attribute);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__attribute_stack_size_set_h
+#define _TEST__F_thread__attribute_stack_size_set_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_attribute_stack_size_set()
+ */
+extern void test__f_thread_attribute_stack_size_set__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_attribute_stack_size_set()
+ */
+extern void test__f_thread_attribute_stack_size_set__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_attribute_stack_size_set()
+ */
+extern void test__f_thread_attribute_stack_size_set__works(void **state);
+
+#endif // _TEST__F_thread__attribute_stack_size_set_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_attribute_create.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_attribute_create__fails(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+
+ int errnos[] = {
+ ENOMEM,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_memory_not,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_barrierattr_init, true);
+ will_return(__wrap_pthread_barrierattr_init, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_attribute_create(&attribute);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_attribute_create__parameter_checking(void **state) {
+
+ {
+ const f_status_t status = f_thread_barrier_attribute_create(0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_barrier_attribute_create__works(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+
+ {
+ will_return(__wrap_pthread_barrierattr_init, false);
+
+ const f_status_t status = f_thread_barrier_attribute_create(&attribute);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__barrier_attribute_create_h
+#define _TEST__F_thread__barrier_attribute_create_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_barrier_attribute_create()
+ */
+extern void test__f_thread_barrier_attribute_create__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_barrier_attribute_create()
+ */
+extern void test__f_thread_barrier_attribute_create__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_barrier_attribute_create()
+ */
+extern void test__f_thread_barrier_attribute_create__works(void **state);
+
+#endif // _TEST__F_thread__barrier_attribute_create_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_attribute_delete.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_attribute_delete__fails(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+
+ int errnos[] = {
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 1; ++i) {
+
+ will_return(__wrap_pthread_barrierattr_destroy, true);
+ will_return(__wrap_pthread_barrierattr_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_attribute_delete(&attribute);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_attribute_delete__parameter_checking(void **state) {
+
+ {
+ const f_status_t status = f_thread_barrier_attribute_delete(0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_barrier_attribute_delete__works(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+
+ {
+ will_return(__wrap_pthread_barrierattr_destroy, false);
+
+ const f_status_t status = f_thread_barrier_attribute_delete(&attribute);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__barrier_attribute_delete_h
+#define _TEST__F_thread__barrier_attribute_delete_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_barrier_attribute_delete()
+ */
+extern void test__f_thread_barrier_attribute_delete__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_barrier_attribute_delete()
+ */
+extern void test__f_thread_barrier_attribute_delete__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_barrier_attribute_delete()
+ */
+extern void test__f_thread_barrier_attribute_delete__works(void **state);
+
+#endif // _TEST__F_thread__barrier_attribute_delete_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_attribute_shared_get.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_attribute_shared_get__fails(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ int shared = 0;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_barrierattr_getpshared, true);
+ will_return(__wrap_pthread_barrierattr_getpshared, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_attribute_shared_get(&attribute, &shared);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_attribute_shared_get__parameter_checking(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ int shared = 0;
+
+ {
+ const f_status_t status = f_thread_barrier_attribute_shared_get(0, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+
+ {
+ const f_status_t status = f_thread_barrier_attribute_shared_get(&attribute, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+
+ {
+ const f_status_t status = f_thread_barrier_attribute_shared_get(0, &shared);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_barrier_attribute_shared_get__works(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ int shared = 0;
+
+ {
+ will_return(__wrap_pthread_barrierattr_getpshared, false);
+
+ const f_status_t status = f_thread_barrier_attribute_shared_get(&attribute, &shared);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__barrier_attribute_shared_get_h
+#define _TEST__F_thread__barrier_attribute_shared_get_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_barrier_attribute_shared_get()
+ */
+extern void test__f_thread_barrier_attribute_shared_get__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_barrier_attribute_shared_get()
+ */
+extern void test__f_thread_barrier_attribute_shared_get__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_barrier_attribute_shared_get()
+ */
+extern void test__f_thread_barrier_attribute_shared_get__works(void **state);
+
+#endif // _TEST__F_thread__barrier_attribute_shared_get_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_attribute_shared_set.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_attribute_shared_set__fails(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ int shared = 0;
+
+ int errnos[] = {
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 2; ++i) {
+
+ will_return(__wrap_pthread_barrierattr_setpshared, true);
+ will_return(__wrap_pthread_barrierattr_setpshared, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_attribute_shared_set(shared, &attribute);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_attribute_shared_set__parameter_checking(void **state) {
+
+ int shared = 0;
+
+ {
+ const f_status_t status = f_thread_barrier_attribute_shared_set(shared, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_barrier_attribute_shared_set__works(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ int shared = 0;
+
+ {
+ will_return(__wrap_pthread_barrierattr_setpshared, false);
+
+ const f_status_t status = f_thread_barrier_attribute_shared_set(shared, &attribute);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__barrier_attribute_shared_set_h
+#define _TEST__F_thread__barrier_attribute_shared_set_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_barrier_attribute_shared_set()
+ */
+extern void test__f_thread_barrier_attribute_shared_set__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_barrier_attribute_shared_set()
+ */
+extern void test__f_thread_barrier_attribute_shared_set__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_barrier_attribute_shared_set()
+ */
+extern void test__f_thread_barrier_attribute_shared_set__works(void **state);
+
+#endif // _TEST__F_thread__barrier_attribute_shared_set_h
}
{
+ for (uint8_t i = 0; i < length; ++i) {
+ will_return(__wrap_pthread_barrierattr_destroy, false);
+ } // for
+
const f_status_t status = f_thread_barrier_attributes_decimate_by(length, &data);
assert_int_equal(status, F_none);
}
{
+ for (uint8_t i = 0; i < length; ++i) {
+ will_return(__wrap_pthread_barrierattr_destroy, false);
+ } // for
+
const f_status_t status = f_thread_barrier_attributes_decrease_by(length, &data);
assert_int_equal(status, F_none);
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_create.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_create__fails(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ f_thread_barrier_t barrier = f_thread_barrier_t_initialize;
+ int count = 0;
+
+ int errnos[] = {
+ EAGAIN,
+ EBUSY,
+ EINVAL,
+ ENOMEM,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_resource_not,
+ F_busy,
+ F_parameter,
+ F_memory_not,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 5; ++i) {
+
+ will_return(__wrap_pthread_barrier_init, true);
+ will_return(__wrap_pthread_barrier_init, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_create(count, &attribute, &barrier);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_create__parameter_checking(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ int count = 0;
+
+ {
+ const f_status_t status = f_thread_barrier_create(count, &attribute, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_barrier_create__works(void **state) {
+
+ f_thread_barrier_attribute_t attribute = f_thread_barrier_attribute_t_initialize;
+ f_thread_barrier_t barrier = f_thread_barrier_t_initialize;
+ int count = 0;
+
+ {
+ will_return(__wrap_pthread_barrier_init, false);
+
+ const f_status_t status = f_thread_barrier_create(count, &attribute, &barrier);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__barrier_create_h
+#define _TEST__F_thread__barrier_create_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_barrier_create()
+ */
+extern void test__f_thread_barrier_create__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_barrier_create()
+ */
+extern void test__f_thread_barrier_create__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_barrier_create()
+ */
+extern void test__f_thread_barrier_create__works(void **state);
+
+#endif // _TEST__F_thread__barrier_create_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_delete.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_delete__fails(void **state) {
+
+ f_thread_barrier_t barrier = f_thread_barrier_t_initialize;
+
+ int errnos[] = {
+ EBUSY,
+ EINVAL,
+ mock_errno_generic,
+ };
+
+ f_status_t statuss[] = {
+ F_busy,
+ F_parameter,
+ F_failure,
+ };
+
+ for (uint8_t i = 0; i < 3; ++i) {
+
+ will_return(__wrap_pthread_barrier_destroy, true);
+ will_return(__wrap_pthread_barrier_destroy, errnos[i]);
+
+ const f_status_t status = f_thread_barrier_delete(&barrier);
+
+ assert_int_equal(status, F_status_set_error(statuss[i]));
+ } // for
+}
+
+void test__f_thread_barrier_delete__parameter_checking(void **state) {
+
+ {
+ const f_status_t status = f_thread_barrier_delete(0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_barrier_delete__works(void **state) {
+
+ f_thread_barrier_t barrier = f_thread_barrier_t_initialize;
+
+ {
+ will_return(__wrap_pthread_barrier_destroy, false);
+
+ const f_status_t status = f_thread_barrier_delete(&barrier);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__barrier_delete_h
+#define _TEST__F_thread__barrier_delete_h
+
+/**
+ * Test that function fails.
+ *
+ * @see f_thread_barrier_delete()
+ */
+extern void test__f_thread_barrier_delete__fails(void **state);
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_barrier_delete()
+ */
+extern void test__f_thread_barrier_delete__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_barrier_delete()
+ */
+extern void test__f_thread_barrier_delete__works(void **state);
+
+#endif // _TEST__F_thread__barrier_delete_h
--- /dev/null
+#include "test-thread.h"
+#include "test-thread-barrier_wait.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_thread_barrier_wait__parameter_checking(void **state) {
+
+ {
+ const f_status_t status = f_thread_barrier_wait(0, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_thread_barrier_wait__works(void **state) {
+
+ f_thread_barrier_t attribute = f_thread_barrier_t_initialize;
+ int result = 0;
+
+ {
+ will_return(__wrap_pthread_barrier_wait, false);
+
+ const f_status_t status = f_thread_barrier_wait(&attribute, &result);
+
+ assert_int_equal(status, F_none);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Thread
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the thread project.
+ */
+#ifndef _TEST__F_thread__barrier_wait_h
+#define _TEST__F_thread__barrier_wait_h
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_thread_barrier_wait()
+ */
+extern void test__f_thread_barrier_wait__parameter_checking(void **state);
+
+/**
+ * Test that function works.
+ *
+ * @see f_thread_barrier_wait()
+ */
+extern void test__f_thread_barrier_wait__works(void **state);
+
+#endif // _TEST__F_thread__barrier_wait_h
cmocka_unit_test(test__f_thread_attribute_scheduler_parameter_set__fails),
cmocka_unit_test(test__f_thread_attribute_scheduler_parameter_set__works),
+ cmocka_unit_test(test__f_thread_attribute_scheduler_policy_get__fails),
+ cmocka_unit_test(test__f_thread_attribute_scheduler_policy_get__works),
+
+ cmocka_unit_test(test__f_thread_attribute_scheduler_policy_set__fails),
+ cmocka_unit_test(test__f_thread_attribute_scheduler_policy_set__works),
+
+ cmocka_unit_test(test__f_thread_attribute_scope_get__fails),
+ cmocka_unit_test(test__f_thread_attribute_scope_get__works),
+
+ cmocka_unit_test(test__f_thread_attribute_scope_set__fails),
+ cmocka_unit_test(test__f_thread_attribute_scope_set__works),
+
+ cmocka_unit_test(test__f_thread_attribute_stack_get__fails),
+ cmocka_unit_test(test__f_thread_attribute_stack_get__works),
+
+ cmocka_unit_test(test__f_thread_attribute_stack_set__fails),
+ cmocka_unit_test(test__f_thread_attribute_stack_set__works),
+
+ cmocka_unit_test(test__f_thread_attribute_stack_size_get__fails),
+ cmocka_unit_test(test__f_thread_attribute_stack_size_get__works),
+
+ cmocka_unit_test(test__f_thread_attribute_stack_size_set__fails),
+ cmocka_unit_test(test__f_thread_attribute_stack_size_set__works),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_create__fails),
+ cmocka_unit_test(test__f_thread_barrier_attribute_create__works),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_delete__fails),
+ cmocka_unit_test(test__f_thread_barrier_attribute_delete__works),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_shared_get__fails),
+ cmocka_unit_test(test__f_thread_barrier_attribute_shared_get__works),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_shared_set__fails),
+ cmocka_unit_test(test__f_thread_barrier_attribute_shared_set__works),
+
+ cmocka_unit_test(test__f_thread_barrier_create__fails),
+ cmocka_unit_test(test__f_thread_barrier_create__works),
+
+ cmocka_unit_test(test__f_thread_barrier_delete__fails),
+ cmocka_unit_test(test__f_thread_barrier_delete__works),
+
+ cmocka_unit_test(test__f_thread_barrier_wait__works),
+
#ifndef _di_level_0_parameter_checking_
cmocka_unit_test(test__f_thread_attributes_adjust__parameter_checking),
cmocka_unit_test(test__f_thread_attributes_decimate_by__parameter_checking),
cmocka_unit_test(test__f_thread_attribute_scheduler_parameter_get__parameter_checking),
cmocka_unit_test(test__f_thread_attribute_scheduler_parameter_set__parameter_checking),
+ cmocka_unit_test(test__f_thread_attribute_scheduler_policy_get__parameter_checking),
+ cmocka_unit_test(test__f_thread_attribute_scheduler_policy_set__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_attribute_scope_get__parameter_checking),
+ cmocka_unit_test(test__f_thread_attribute_scope_set__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_attribute_stack_get__parameter_checking),
+ cmocka_unit_test(test__f_thread_attribute_stack_set__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_attribute_stack_size_get__parameter_checking),
+ cmocka_unit_test(test__f_thread_attribute_stack_size_set__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_create__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_delete__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_shared_get__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_barrier_attribute_shared_set__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_barrier_create__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_barrier_delete__parameter_checking),
+
+ cmocka_unit_test(test__f_thread_barrier_wait__parameter_checking),
#endif // _di_level_0_parameter_checking_
// f_thread_user_set() doesn't use parameter checking.
#include "test-thread-attribute_scheduler_inherit_set.h"
#include "test-thread-attribute_scheduler_parameter_get.h"
#include "test-thread-attribute_scheduler_parameter_set.h"
+#include "test-thread-attribute_scheduler_policy_get.h"
+#include "test-thread-attribute_scheduler_policy_set.h"
+#include "test-thread-attribute_scope_get.h"
+#include "test-thread-attribute_scope_set.h"
+#include "test-thread-attribute_stack_get.h"
+#include "test-thread-attribute_stack_set.h"
+#include "test-thread-attribute_stack_size_get.h"
+#include "test-thread-attribute_stack_size_set.h"
+#include "test-thread-barrier_attribute_create.h"
+#include "test-thread-barrier_attribute_delete.h"
+#include "test-thread-barrier_attribute_shared_get.h"
+#include "test-thread-barrier_attribute_shared_set.h"
+#include "test-thread-barrier_create.h"
+#include "test-thread-barrier_delete.h"
+#include "test-thread-barrier_wait.h"
#ifdef __cplusplus
extern "C" {