]> Kevux Git Server - fll/commitdiff
Update: Add parameter checking to unit tests, fix ordering, and other minor changes.
authorKevin Day <thekevinday@gmail.com>
Sun, 16 Jan 2022 22:39:40 +0000 (16:39 -0600)
committerKevin Day <thekevinday@gmail.com>
Sun, 16 Jan 2022 22:39:40 +0000 (16:39 -0600)
77 files changed:
level_0/f_capability/tests/c/test-capability-ambient_get.c
level_0/f_capability/tests/c/test-capability-ambient_get.h
level_0/f_capability/tests/c/test-capability-ambient_reset.c
level_0/f_capability/tests/c/test-capability-ambient_reset.h
level_0/f_capability/tests/c/test-capability-ambient_set.c
level_0/f_capability/tests/c/test-capability-ambient_set.h
level_0/f_capability/tests/c/test-capability-clear.c
level_0/f_capability/tests/c/test-capability-clear.h
level_0/f_capability/tests/c/test-capability-clear_flag.c
level_0/f_capability/tests/c/test-capability-clear_flag.h
level_0/f_capability/tests/c/test-capability-compare.c
level_0/f_capability/tests/c/test-capability-compare.h
level_0/f_capability/tests/c/test-capability-copy.c
level_0/f_capability/tests/c/test-capability-copy.h
level_0/f_capability/tests/c/test-capability-copy_external.c
level_0/f_capability/tests/c/test-capability-copy_external.h
level_0/f_capability/tests/c/test-capability-copy_internal.c
level_0/f_capability/tests/c/test-capability-copy_internal.h
level_0/f_capability/tests/c/test-capability-delete.c
level_0/f_capability/tests/c/test-capability-delete.h
level_0/f_capability/tests/c/test-capability-file_descriptor_get.c
level_0/f_capability/tests/c/test-capability-file_descriptor_get.h
level_0/f_capability/tests/c/test-capability-file_descriptor_set.c
level_0/f_capability/tests/c/test-capability-file_descriptor_set.h
level_0/f_capability/tests/c/test-capability-file_get.c
level_0/f_capability/tests/c/test-capability-file_get.h
level_0/f_capability/tests/c/test-capability-file_set.c
level_0/f_capability/tests/c/test-capability-file_set.h
level_0/f_capability/tests/c/test-capability-flag_get.c
level_0/f_capability/tests/c/test-capability-flag_get.h
level_0/f_capability/tests/c/test-capability-flag_set.c
level_0/f_capability/tests/c/test-capability-flag_set.h
level_0/f_capability/tests/c/test-capability-from_name.c
level_0/f_capability/tests/c/test-capability-from_name.h
level_0/f_capability/tests/c/test-capability-from_text.c
level_0/f_capability/tests/c/test-capability-from_text.h
level_0/f_capability/tests/c/test-capability-groups_set.c
level_0/f_capability/tests/c/test-capability-groups_set.h
level_0/f_capability/tests/c/test-capability-initialize.c
level_0/f_capability/tests/c/test-capability-initialize.h
level_0/f_capability/tests/c/test-capability-mode_get.c
level_0/f_capability/tests/c/test-capability-mode_get.h
level_0/f_capability/tests/c/test-capability-mode_get_name.c
level_0/f_capability/tests/c/test-capability-mode_get_name.h
level_0/f_capability/tests/c/test-capability-mode_set.c
level_0/f_capability/tests/c/test-capability-mode_set.h
level_0/f_capability/tests/c/test-capability-owner_get.c
level_0/f_capability/tests/c/test-capability-owner_get.h
level_0/f_capability/tests/c/test-capability-owner_set.c
level_0/f_capability/tests/c/test-capability-owner_set.h
level_0/f_capability/tests/c/test-capability-process_bound_drop.c
level_0/f_capability/tests/c/test-capability-process_bound_drop.h
level_0/f_capability/tests/c/test-capability-process_bound_get.c
level_0/f_capability/tests/c/test-capability-process_bound_get.h
level_0/f_capability/tests/c/test-capability-process_get.c
level_0/f_capability/tests/c/test-capability-process_get.h
level_0/f_capability/tests/c/test-capability-process_get_by_id.c
level_0/f_capability/tests/c/test-capability-process_get_by_id.h
level_0/f_capability/tests/c/test-capability-process_set.c
level_0/f_capability/tests/c/test-capability-process_set.h
level_0/f_capability/tests/c/test-capability-security_bits_get.c
level_0/f_capability/tests/c/test-capability-security_bits_get.h
level_0/f_capability/tests/c/test-capability-security_bits_set.c
level_0/f_capability/tests/c/test-capability-security_bits_set.h
level_0/f_capability/tests/c/test-capability-size.c
level_0/f_capability/tests/c/test-capability-size.h
level_0/f_capability/tests/c/test-capability-supported.h
level_0/f_capability/tests/c/test-capability-supported_ambient.h
level_0/f_capability/tests/c/test-capability-supported_code.c
level_0/f_capability/tests/c/test-capability-supported_code.h
level_0/f_capability/tests/c/test-capability-to_name.c
level_0/f_capability/tests/c/test-capability-to_name.h
level_0/f_capability/tests/c/test-capability-to_text.c
level_0/f_capability/tests/c/test-capability-to_text.h
level_0/f_capability/tests/c/test-capability-user_set.c
level_0/f_capability/tests/c/test-capability-user_set.h
level_0/f_capability/tests/c/test-capability.c

index 9125894466eecf8a845624f8f122c2414155cb74..42a9baa9881fd86700698379bd365d68a5aa850f 100644 (file)
@@ -5,9 +5,39 @@
 extern "C" {
 #endif
 
+void test__f_capability_ambient_get__fails(void **state) {
+
+  #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
+    f_capability_value_t value = f_capability_value_t_initialize;
+    int ambient = 0;
+
+    {
+      will_return(__wrap_cap_get_ambient, true);
+
+      const f_status_t status = f_capability_ambient_get(value, &ambient);
+
+      assert_int_equal(F_status_set_fine(status), F_supported_not);
+      assert_int_equal(ambient, -1);
+    }
+  #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
+}
+
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_ambient_get__parameter_checking(void **state) {
+
+    const f_capability_value_t value = f_capability_value_t_initialize;
+
+    {
+      const f_status_t status = f_capability_ambient_get(value, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
 void test__f_capability_ambient_get__works(void **state) {
 
-  f_capability_value_t value = f_capability_value_t_initialize;
+  const f_capability_value_t value = f_capability_value_t_initialize;
   int ambient = 0;
 
   #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
@@ -28,23 +58,6 @@ void test__f_capability_ambient_get__works(void **state) {
   }
 }
 
-void test__f_capability_ambient_get__fails(void **state) {
-
-  #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-    f_capability_value_t value = f_capability_value_t_initialize;
-    int ambient = 0;
-
-    {
-      will_return(__wrap_cap_get_ambient, true);
-
-      const f_status_t status = f_capability_ambient_get(value, &ambient);
-
-      assert_int_equal(F_status_set_fine(status), F_supported_not);
-      assert_int_equal(ambient, -1);
-    }
-  #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-}
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 89bcafeb67df75f8477cd70b6390005953c98576..edaad3c8f9c1ecf4630eb4434d8f668ef1ffaa85 100644 (file)
 #define _TEST__F_capability__ambient_get
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_ambient_get()
  */
-extern void test__f_capability_ambient_get__works(void **state);
+extern void test__f_capability_ambient_get__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_ambient_get()
  */
-extern void test__f_capability_ambient_get__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_ambient_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_ambient_get()
+ */
+extern void test__f_capability_ambient_get__works(void **state);
 
 #endif // _TEST__F_capability__ambient_get
index c17e3ea50c99321ace4729e6e342729b1fca982f..3459bb9851d2abda4438728678dc9ffe6feab1da 100644 (file)
@@ -5,25 +5,6 @@
 extern "C" {
 #endif
 
-void test__f_capability_ambient_reset__works(void **state) {
-
-  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-    printf("[  WARN    ] f_capability_ambient_reset() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_ambient, false);
-  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-
-  {
-    const f_status_t status = f_capability_ambient_reset();
-
-    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-  }
-}
-
 void test__f_capability_ambient_reset__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
@@ -60,6 +41,25 @@ void test__f_capability_ambient_reset__fails(void **state) {
   #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
 }
 
+void test__f_capability_ambient_reset__works(void **state) {
+
+  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+    printf("[  WARN    ] f_capability_ambient_reset() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_ambient, false);
+  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+
+  {
+    const f_status_t status = f_capability_ambient_reset();
+
+    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 8391ff893af28a392475fc67e6f381f6ca273c68..7e6c91ae5617424b6171dac52182962340d3db83 100644 (file)
 #define _TEST__F_capability__ambient_reset
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_ambient_reset()
  */
-extern void test__f_capability_ambient_reset__works(void **state);
+extern void test__f_capability_ambient_reset__fails(void **state);
+
+// f_capability_ambient_reset() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_ambient_reset()
  */
-extern void test__f_capability_ambient_reset__fails(void **state);
+extern void test__f_capability_ambient_reset__works(void **state);
 
 #endif // _TEST__F_capability__ambient_reset
index db698684a75073646559356528c20936a52b848d..584592abebb98a5a1cbdb21ae36c229973f651cd 100644 (file)
@@ -5,32 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_ambient_set__works(void **state) {
-
-  f_capability_value_t value = f_capability_value_t_initialize;
-  f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
-
-  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-    printf("[  WARN    ] f_capability_ambient_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_ambient, false);
-  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-
-  {
-    const f_status_t status = f_capability_ambient_set(value, flag_value);
-
-    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-  }
-}
-
 void test__f_capability_ambient_set__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-    f_capability_value_t value = f_capability_value_t_initialize;
+    const f_capability_value_t value = f_capability_value_t_initialize;
     f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
 
     int errnos[] = {
@@ -57,6 +35,28 @@ void test__f_capability_ambient_set__fails(void **state) {
   #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
 }
 
+void test__f_capability_ambient_set__works(void **state) {
+
+  const f_capability_value_t value = f_capability_value_t_initialize;
+  f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
+
+  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+    printf("[  WARN    ] f_capability_ambient_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_ambient, false);
+  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+
+  {
+    const f_status_t status = f_capability_ambient_set(value, flag_value);
+
+    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 633fc7d5876c568e6b4ff6a4bd87714384332884..d57dde116294fbb47a06ec34b150809d38e6fc63 100644 (file)
 #define _TEST__F_capability__ambient_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_ambient_set()
  */
-extern void test__f_capability_ambient_set__works(void **state);
+extern void test__f_capability_ambient_set__fails(void **state);
+
+// f_capability_ambient_reset() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_ambient_set()
  */
-extern void test__f_capability_ambient_set__fails(void **state);
+extern void test__f_capability_ambient_set__works(void **state);
 
 #endif // _TEST__F_capability__ambient_set
index bff320f4a08a211ca7f98a4f14d18e408335de9e..8d481db3ece732671149daf6809de3448e0d726d 100644 (file)
@@ -5,27 +5,6 @@
 extern "C" {
 #endif
 
-void test__f_capability_clear__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_clear() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_clear, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_clear(&capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_clear__fails(void **state) {
 
   #if !defined(_di_libcap_)
@@ -57,6 +36,38 @@ void test__f_capability_clear__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_clear__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_capability_clear(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_clear__works(void **state) {
+
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_clear() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_clear, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_clear(&capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index a09104b645a4c0f58874bd2e39d3823cbb58cfa3..61a4011da519092641d42281693efac60de1391d 100644 (file)
 #define _TEST__F_capability__clear
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_clear()
  */
-extern void test__f_capability_clear__works(void **state);
+extern void test__f_capability_clear__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_clear()
  */
-extern void test__f_capability_clear__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_clear__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_clear()
+ */
+extern void test__f_capability_clear__works(void **state);
 
 #endif // _TEST__F_capability__clear
index 280024a7ced073509ba74ec72a67a0e2c6ce964c..f2bf87e128fc47026e4c134773f5eaf42450e9b1 100644 (file)
@@ -5,10 +5,23 @@
 extern "C" {
 #endif
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_clear_flag__parameter_checking(void **state) {
+
+  const f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
+
+    {
+      const f_status_t status = f_capability_clear_flag(flag_value, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
 void test__f_capability_clear_flag__works(void **state) {
 
   f_capability_t capability = f_capability_t_initialize;
-  f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
+  const f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
 
   #if defined(_di_libcap_)
     printf("[  WARN    ] f_capability_clear_flag() is not implemented and cannot be fully tested.\n");
@@ -31,7 +44,7 @@ void test__f_capability_clear_flag__fails(void **state) {
 
   #if !defined(_di_libcap_)
     f_capability_t capability = f_capability_t_initialize;
-    f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
+    const f_capability_flag_value_t flag_value = f_capability_flag_value_t_initialize;
 
     int errnos[] = {
       EINVAL,
index 23a8492408fc225269cc3a14d3b207f2a9eef631..4f9fe5ff09353c321589ee859f4e3f1a11476f99 100644 (file)
 #define _TEST__F_capability__clear_flag
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_clear_flag()
  */
-extern void test__f_capability_clear_flag__works(void **state);
+extern void test__f_capability_clear_flag__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_clear_flag()
  */
-extern void test__f_capability_clear_flag__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_clear_flag__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_clear_flag()
+ */
+extern void test__f_capability_clear_flag__works(void **state);
 
 #endif // _TEST__F_capability__clear_flag
index 3762786f9499c2ef522895666da1ddf0a76f48a8..15833b9e4ababee04a4bb331c83f0d57bf8674c7 100644 (file)
@@ -5,10 +5,39 @@
 extern "C" {
 #endif
 
+void test__f_capability_compare__fails(void **state) {
+
+  #if !defined(_di_libcap_)
+    const f_capability_t capability_1 = f_capability_t_initialize;
+    const f_capability_t capability_2 = f_capability_t_initialize;
+    int flags = 0;
+
+    int errnos[] = {
+      EINVAL,
+      mock_errno_generic,
+    };
+
+    f_status_t statuss[] = {
+      F_parameter,
+      F_failure,
+    };
+
+    for (int i = 0; i < 2; ++i) {
+
+      will_return(__wrap_cap_compare, true);
+      will_return(__wrap_cap_compare, errnos[i]);
+
+      const f_status_t status = f_capability_compare(capability_1, capability_2, &flags);
+
+      assert_int_equal(F_status_set_fine(status), statuss[i]);
+    } // for
+  #endif // !defined(_di_libcap_)
+}
+
 void test__f_capability_compare__works(void **state) {
 
-  f_capability_t capability_1 = f_capability_t_initialize;
-  f_capability_t capability_2 = f_capability_t_initialize;
+  const f_capability_t capability_1 = f_capability_t_initialize;
+  const f_capability_t capability_2 = f_capability_t_initialize;
   int flags = 0;
 
   #if defined(_di_libcap_)
@@ -41,35 +70,6 @@ void test__f_capability_compare__works(void **state) {
   #endif // defined(_di_libcap_)
 }
 
-void test__f_capability_compare__fails(void **state) {
-
-  #if !defined(_di_libcap_)
-    f_capability_t capability_1 = f_capability_t_initialize;
-    f_capability_t capability_2 = f_capability_t_initialize;
-    int flags = 0;
-
-    int errnos[] = {
-      EINVAL,
-      mock_errno_generic,
-    };
-
-    f_status_t statuss[] = {
-      F_parameter,
-      F_failure,
-    };
-
-    for (int i = 0; i < 2; ++i) {
-
-      will_return(__wrap_cap_compare, true);
-      will_return(__wrap_cap_compare, errnos[i]);
-
-      const f_status_t status = f_capability_compare(capability_1, capability_2, &flags);
-
-      assert_int_equal(F_status_set_fine(status), statuss[i]);
-    } // for
-  #endif // !defined(_di_libcap_)
-}
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index fd044160b78b16cb34c9d7acd1a3275ed6d80860..2c087c42d2ac0f8aaa3a7be6e543330f3da2c307 100644 (file)
 #define _TEST__F_capability__compare
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_compare()
  */
-extern void test__f_capability_compare__works(void **state);
+extern void test__f_capability_compare__fails(void **state);
+
+// f_capability_compare() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_compare()
  */
-extern void test__f_capability_compare__fails(void **state);
+extern void test__f_capability_compare__works(void **state);
 
 #endif // _TEST__F_capability__compare
index 5c5e0c3297542d240c600fac457a32ccf43d6007..c9407f944089215515ed645259baaa5b6587803a 100644 (file)
@@ -5,33 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_copy__works(void **state) {
-
-  f_capability_t capability_1 = f_capability_t_initialize;
-  f_capability_t capability_2 = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_copy() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_dup, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_copy(capability_1, &capability_2);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(capability_2, 1);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_copy__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_t capability_1 = f_capability_t_initialize;
+    const f_capability_t capability_1 = f_capability_t_initialize;
     f_capability_t capability_2 = f_capability_t_initialize;
 
     int errnos[] = {
@@ -58,6 +35,42 @@ void test__f_capability_copy__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_copy__parameter_checking(void **state) {
+
+    const f_capability_t capability = f_capability_t_initialize;
+
+    {
+      const f_status_t status = f_capability_copy(capability, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_copy__works(void **state) {
+
+  const f_capability_t capability_1 = f_capability_t_initialize;
+  f_capability_t capability_2 = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_copy() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_dup, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_copy(capability_1, &capability_2);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(capability_2, 1);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index e1bfea8d7e8ae5b7525befb334bf1bf89577a6ac..0b4f45305660c000a89bf5494411029eb0373251 100644 (file)
 #define _TEST__F_capability__copy
 
 /**
+ * Test that function fails.
+ *
+ * @see f_capability_copy()
+ */
+extern void test__f_capability_copy__fails(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_capability_copy()
 extern void test__f_capability_copy__works(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_copy()
  */
-extern void test__f_capability_copy__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_copy__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
 
 #endif // _TEST__F_capability__copy
index 66b487a6956396e9f7a1a930eb12535ab3c02d54..418ed4aada95ce3a54d578df1e7a480cb43d4c03 100644 (file)
@@ -5,37 +5,11 @@
 extern "C" {
 #endif
 
-void test__f_capability_copy_external__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-  ssize_t max = 0;
-  int stub = 0;
-  void *external = (void *) &stub;
-  ssize_t size = 0;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_copy_external() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_copy_ext, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_copy_external(capability, max, external, &size);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(size, 1);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_copy_external__fails(void **state) {
 
   #if !defined(_di_libcap_)
     f_capability_t capability = f_capability_t_initialize;
-    ssize_t max = 0;
+    const ssize_t max = 0;
     int stub = 0;
     void *external = (void *) &stub;
     ssize_t size = 0;
@@ -64,6 +38,45 @@ void test__f_capability_copy_external__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_copy_external__parameter_checking(void **state) {
+
+    f_capability_t capability = f_capability_t_initialize;
+
+    {
+      const f_status_t status = f_capability_copy_external(capability, 0, 0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_copy_external__works(void **state) {
+
+  f_capability_t capability = f_capability_t_initialize;
+  const ssize_t max = 0;
+  int stub = 0;
+  void *external = (void *) &stub;
+  ssize_t size = 0;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_copy_external() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_copy_ext, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_copy_external(capability, max, external, &size);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(size, 1);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 32c23eeb149cd3802c0dfb311aeb43edba5051ce..358f3ac1c4911067cf3e5964c16892d422b153a7 100644 (file)
 #define _TEST__F_capability__copy_external
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_copy_external()
  */
-extern void test__f_capability_copy_external__works(void **state);
+extern void test__f_capability_copy_external__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_copy_external()
  */
-extern void test__f_capability_copy_external__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_copy_external__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_copy_external()
+ */
+extern void test__f_capability_copy_external__works(void **state);
 
 #endif // _TEST__F_capability__copy_external
index 8aad5f3bc50b39f729f47717d26244548b4fb3fa..ccd3794d14a805102d2a9a87e7cd5d9a2cc60571 100644 (file)
@@ -5,30 +5,6 @@
 extern "C" {
 #endif
 
-void test__f_capability_copy_internal__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-  int stub = 0;
-  void *external = (void *) &stub;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_copy_internal() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_copy_int, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_copy_internal(external, &capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(capability, 1);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_copy_internal__fails(void **state) {
 
   #if !defined(_di_libcap_)
@@ -60,6 +36,51 @@ void test__f_capability_copy_internal__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_copy_internal__parameter_checking(void **state) {
+
+    f_capability_t capability = f_capability_t_initialize;
+    int stub = 0;
+    void *external = (void *) &stub;
+
+    {
+      const f_status_t status = f_capability_copy_internal(0, &capability);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+
+    {
+      const f_status_t status = f_capability_copy_internal(external, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_copy_internal__works(void **state) {
+
+  f_capability_t capability = f_capability_t_initialize;
+  int stub = 0;
+  void *external = (void *) &stub;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_copy_internal() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_copy_int, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_copy_internal(external, &capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(capability, 1);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 078a93991bc2b04e00cc88ed98d01a2877e6e3bd..6e2bac1ff504f42592eeb37683b2d3ab14327632 100644 (file)
 #define _TEST__F_capability__copy_internal
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_copy_internal()
  */
-extern void test__f_capability_copy_internal__works(void **state);
+extern void test__f_capability_copy_internal__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_copy_internal()
  */
-extern void test__f_capability_copy_internal__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_copy_internal__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_copy_internal()
+ */
+extern void test__f_capability_copy_internal__works(void **state);
 
 #endif // _TEST__F_capability__copy_internal
index 1b468780a36893f093341d9a43d82993416e18ab..3eadd39aa28a776ce1efbab7d86a44dbc494ea8a 100644 (file)
@@ -5,28 +5,6 @@
 extern "C" {
 #endif
 
-void test__f_capability_delete__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_delete() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_free, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_delete(&capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(capability, 0);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_delete__fails(void **state) {
 
   #if !defined(_di_libcap_)
@@ -56,6 +34,39 @@ void test__f_capability_delete__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_delete__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_capability_delete(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_delete__works(void **state) {
+
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_delete() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_free, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_delete(&capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(capability, 0);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 6018b2ae4f9db0b6b0ef75489796b66ccf9ed58b..6d6e6bd79062216fbb1f810bbfb6f58b6fc2a3ad 100644 (file)
 #define _TEST__F_capability__delete
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_delete()
  */
-extern void test__f_capability_delete__works(void **state);
+extern void test__f_capability_delete__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_delete()
  */
-extern void test__f_capability_delete__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_delete__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_delete()
+ */
+extern void test__f_capability_delete__works(void **state);
 
 #endif // _TEST__F_capability__delete
index 0d1f3ffdf0f91427416418e91062f88a5bd411be..461d47686da3cbaf2207573b551f41d930f9909a 100644 (file)
@@ -5,32 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_file_descriptor_get__works(void **state) {
-
-  int descriptor = 0;
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_file_descriptor_get() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_fd, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_file_descriptor_get(descriptor, &capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_file_descriptor_get__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    int descriptor = 0;
+    const int descriptor = 0;
     f_capability_t capability = f_capability_t_initialize;
 
     int errnos[] = {
@@ -69,6 +47,41 @@ void test__f_capability_file_descriptor_get__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_file_descriptor_get__parameter_checking(void **state) {
+
+    const int descriptor = 0;
+
+    {
+      const f_status_t status = f_capability_file_descriptor_get(descriptor, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_file_descriptor_get__works(void **state) {
+
+  const int descriptor = 0;
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_file_descriptor_get() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_fd, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_file_descriptor_get(descriptor, &capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index b436024ac1a15e9dea9c0d38d705ce604f4c5d53..b4e0db3898c607477d5cf380d395067e22d96329 100644 (file)
 #define _TEST__F_capability__file_descriptor_get
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_file_descriptor_get()
  */
-extern void test__f_capability_file_descriptor_get__works(void **state);
+extern void test__f_capability_file_descriptor_get__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_file_descriptor_get()
  */
-extern void test__f_capability_file_descriptor_get__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_file_descriptor_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_file_descriptor_get()
+ */
+extern void test__f_capability_file_descriptor_get__works(void **state);
 
 #endif // _TEST__F_capability__file_descriptor_get
index 89dccfe99227d67ca4a3c615a1497a9c2c6f6e61..f8462aec935cc9f853da9af9f7bc1359c6fb05fc 100644 (file)
@@ -5,32 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_file_descriptor_set__works(void **state) {
-
-  int descriptor = 0;
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_file_descriptor_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_set_fd, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_file_descriptor_set(descriptor, capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_file_descriptor_set__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    int descriptor = 0;
+    const int descriptor = 0;
     f_capability_t capability = f_capability_t_initialize;
 
     int errnos[] = {
@@ -69,6 +47,28 @@ void test__f_capability_file_descriptor_set__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+void test__f_capability_file_descriptor_set__works(void **state) {
+
+  const int descriptor = 0;
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_file_descriptor_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_set_fd, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_file_descriptor_set(descriptor, capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 13e76237cebab677b1b00d79fb6b6d445831f157..bbb762811e9246f27b1c2f07197b797388a0e53f 100644 (file)
 #define _TEST__F_capability__file_descriptor_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_file_descriptor_set()
  */
-extern void test__f_capability_file_descriptor_set__works(void **state);
+extern void test__f_capability_file_descriptor_set__fails(void **state);
+
+// f_capability_file_descriptor_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_file_descriptor_set()
  */
-extern void test__f_capability_file_descriptor_set__fails(void **state);
+extern void test__f_capability_file_descriptor_set__works(void **state);
 
 #endif // _TEST__F_capability__file_descriptor_set
index 31dbb46a1f98d1af16bff6c6e4565521e8e921a0..e02a9a64981d17d6a02402a8740943c486a81df4 100644 (file)
@@ -5,32 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_file_get__works(void **state) {
-
-  f_string_t path = f_string_t_initialize;
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_file_get() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_file, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_file_get(path, &capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_file_get__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_string_t path = f_string_t_initialize;
+    const f_string_t path = f_string_t_initialize;
     f_capability_t capability = f_capability_t_initialize;
 
     int errnos[] = {
@@ -69,6 +47,41 @@ void test__f_capability_file_get__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_file_get__parameter_checking(void **state) {
+
+  const f_string_t path = f_string_t_initialize;
+
+    {
+      const f_status_t status = f_capability_file_get(path, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_file_get__works(void **state) {
+
+  const f_string_t path = f_string_t_initialize;
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_file_get() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_file, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_file_get(path, &capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 55afbce13a89464a427abf55eaf8747ea285eff7..bc77e5ae9efd03a3ec88524f176f9cca07358285 100644 (file)
 #define _TEST__F_capability__file_get
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_file_get()
  */
-extern void test__f_capability_file_get__works(void **state);
+extern void test__f_capability_file_get__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_file_get()
  */
-extern void test__f_capability_file_get__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_file_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_file_get()
+ */
+extern void test__f_capability_file_get__works(void **state);
 
 #endif // _TEST__F_capability__file_get
index 6ccf9291a5bac56894fb458e0e5c69d3b9051498..25ca06973be8b008d872ff405bc624ec128e5f02 100644 (file)
@@ -5,32 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_file_set__works(void **state) {
-
-  f_string_t path = f_string_t_initialize;
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_file_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_set_file, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_file_set(path, capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_file_set__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_string_t path = f_string_t_initialize;
+    const f_string_t path = f_string_t_initialize;
     f_capability_t capability = f_capability_t_initialize;
 
     int errnos[] = {
@@ -69,6 +47,28 @@ void test__f_capability_file_set__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+void test__f_capability_file_set__works(void **state) {
+
+  const f_string_t path = f_string_t_initialize;
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_file_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_set_file, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_file_set(path, capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index dd54e2e22bec80e370da1e4a3d2cdec4b5efaada..cf2ee1deaeae7b979cc4f960a194861ecd9aa8e1 100644 (file)
 #define _TEST__F_capability__file_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_file_set()
  */
-extern void test__f_capability_file_set__works(void **state);
+extern void test__f_capability_file_set__fails(void **state);
+
+// f_capability_file_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_file_set()
  */
-extern void test__f_capability_file_set__fails(void **state);
+extern void test__f_capability_file_set__works(void **state);
 
 #endif // _TEST__F_capability__file_set
index 59109514591bd47a00086a2409fe0f27bea764c7..8de3529898f2b5b84034e200580b843f90f23031 100644 (file)
@@ -5,37 +5,13 @@
 extern "C" {
 #endif
 
-void test__f_capability_flag_get__works(void **state) {
-
-  f_capability_flag_t flag = f_capability_flag_t_initialize;
-  f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
-  f_capability_t capability = f_capability_t_initialize;
-  f_capability_value_t capability_value = f_capability_value_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_flag_get() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_flag, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_flag_get(capability, capability_value, flag, &value);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_flag_get__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_flag_t flag = f_capability_flag_t_initialize;
+    const f_capability_flag_t flag = f_capability_flag_t_initialize;
+    const f_capability_t capability = f_capability_t_initialize;
+    const f_capability_value_t capability_value = f_capability_value_t_initialize;
     f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
-    f_capability_t capability = f_capability_t_initialize;
-    f_capability_value_t capability_value = f_capability_value_t_initialize;
 
     int errnos[] = {
       EINVAL,
@@ -59,6 +35,45 @@ void test__f_capability_flag_get__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_flag_get__parameter_checking(void **state) {
+
+    const f_capability_flag_t flag = f_capability_flag_t_initialize;
+    const f_capability_t capability = f_capability_t_initialize;
+    const f_capability_value_t capability_value = f_capability_value_t_initialize;
+
+    {
+      const f_status_t status = f_capability_flag_get(capability, capability_value, flag, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_flag_get__works(void **state) {
+
+  const f_capability_flag_t flag = f_capability_flag_t_initialize;
+  const f_capability_t capability = f_capability_t_initialize;
+  const f_capability_value_t capability_value = f_capability_value_t_initialize;
+  f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_flag_get() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_flag, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_flag_get(capability, capability_value, flag, &value);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index eb1b5f98e0455b403648d4e025622b91b0cc5f8c..dfbdea8ed2c9a65e5bf58cc728e7cbbee77639df 100644 (file)
 #define _TEST__F_capability__flag_get
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_flag_get()
  */
-extern void test__f_capability_flag_get__works(void **state);
+extern void test__f_capability_flag_get__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_flag_get()
  */
-extern void test__f_capability_flag_get__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_flag_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_flag_get()
+ */
+extern void test__f_capability_flag_get__works(void **state);
 
 #endif // _TEST__F_capability__flag_get
index fd0f430632c9c06e01a4d37c4ea1e98a7d18002e..afc0c70dc66323aef45fe3520c4bc631446450e3 100644 (file)
@@ -5,36 +5,12 @@
 extern "C" {
 #endif
 
-void test__f_capability_flag_set__works(void **state) {
-
-  f_capability_flag_t flag = f_capability_flag_t_initialize;
-  f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
-  f_int32s_t codes = f_int32s_t_initialize;
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_flag_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_set_flag, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_flag_set(flag, value, codes, &capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_flag_set__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_flag_t flag = f_capability_flag_t_initialize;
-    f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
-    f_int32s_t codes = f_int32s_t_initialize;
+    const f_capability_flag_t flag = f_capability_flag_t_initialize;
+    const f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
+    const f_int32s_t codes = f_int32s_t_initialize;
     f_capability_t capability = f_capability_t_initialize;
 
     int errnos[] = {
@@ -59,6 +35,45 @@ void test__f_capability_flag_set__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_flag_set__parameter_checking(void **state) {
+
+    const f_capability_flag_t flag = f_capability_flag_t_initialize;
+    const f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
+    const f_int32s_t codes = f_int32s_t_initialize;
+
+    {
+      const f_status_t status = f_capability_flag_set(flag, value, codes, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_flag_set__works(void **state) {
+
+  const f_capability_flag_t flag = f_capability_flag_t_initialize;
+  const f_capability_flag_value_t value = f_capability_flag_value_t_initialize;
+  const f_int32s_t codes = f_int32s_t_initialize;
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_flag_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_set_flag, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_flag_set(flag, value, codes, &capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 623594b6257a2fea83bd857dfaa78d8c7224f3a8..6c2638c357ea11952b5cf6c83ab84068c127f365 100644 (file)
 #define _TEST__F_capability__flag_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_flag_set()
  */
-extern void test__f_capability_flag_set__works(void **state);
+extern void test__f_capability_flag_set__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_flag_set()
  */
-extern void test__f_capability_flag_set__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_flag_set__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_flag_set()
+ */
+extern void test__f_capability_flag_set__works(void **state);
 
 #endif // _TEST__F_capability__flag_set
index e1327e8f99e5f90ba5033237d7db2661497c60ec..73ba3dfddd0681faba9fd90c61b9deaf3eade7a8 100644 (file)
@@ -5,32 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_from_name__works(void **state) {
-
-  f_string_t name = f_string_t_initialize;
-  f_capability_value_t capability_value = f_capability_value_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_from_name() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_from_name, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_from_name(name, &capability_value);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_from_name__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_string_t name = f_string_t_initialize;
+    const f_string_t name = f_string_t_initialize;
     f_capability_value_t capability_value = f_capability_value_t_initialize;
 
     int errnos[] = {
@@ -57,6 +35,41 @@ void test__f_capability_from_name__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_from_name__parameter_checking(void **state) {
+
+    const f_string_t name = f_string_t_initialize;
+
+    {
+      const f_status_t status = f_capability_from_name(name, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_from_name__works(void **state) {
+
+  const f_string_t name = f_string_t_initialize;
+  f_capability_value_t capability_value = f_capability_value_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_from_name() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_from_name, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_from_name(name, &capability_value);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index c33ea132c6eff9d6698234d082c4a5b632ca9268..7eaea9c95c772b65c577b32a7a6b273fd8b68bfb 100644 (file)
 #define _TEST__F_capability__from_name
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_from_name()
  */
-extern void test__f_capability_from_name__works(void **state);
+extern void test__f_capability_from_name__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_from_name()
  */
-extern void test__f_capability_from_name__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_from_name__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_from_name()
+ */
+extern void test__f_capability_from_name__works(void **state);
 
 #endif // _TEST__F_capability__from_name
index 2dd90c70aa4db85d24348d4c92e874577e1957e6..672dbc02c0e9a2f5034660a2e72239f94b8d8a8f 100644 (file)
@@ -5,32 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_from_text__works(void **state) {
-
-  f_string_t text = f_string_t_initialize;
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_from_text() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_from_text, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_from_text(text, &capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_from_text__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_string_t text = f_string_t_initialize;
+    const f_string_t text = f_string_t_initialize;
     f_capability_t capability = f_capability_t_initialize;
 
     int errnos[] = {
@@ -57,6 +35,41 @@ void test__f_capability_from_text__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_from_text__parameter_checking(void **state) {
+
+    const f_string_t text = f_string_t_initialize;
+
+    {
+      const f_status_t status = f_capability_from_text(text, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_from_text__works(void **state) {
+
+  const f_string_t text = f_string_t_initialize;
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_from_text() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_from_text, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_from_text(text, &capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 8c54a0cd3a43f409d2b4f905793517ef425d6691..751948bcb2cf50a0313bd51cf6d1217ac259769b 100644 (file)
 #define _TEST__F_capability__from_text
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_from_text()
  */
-extern void test__f_capability_from_text__works(void **state);
+extern void test__f_capability_from_text__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_from_text()
  */
-extern void test__f_capability_from_text__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_from_text__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_from_text()
+ */
+extern void test__f_capability_from_text__works(void **state);
 
 #endif // _TEST__F_capability__from_text
index ac3f3a087d5aa4c427ae2634d080a8a72a3bf278..669b8b9556127742564c6374495957d164942a10 100644 (file)
@@ -5,35 +5,12 @@
 extern "C" {
 #endif
 
-void test__f_capability_groups_set__works(void **state) {
-
-  gid_t group;
-  size_t total = 2;
-  gid_t groups[total];
-
-  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-    printf("[  WARN    ] f_capability_groups_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_setgroups, false);
-  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-
-  {
-    const f_status_t status = f_capability_groups_set(group, total, groups);
-
-    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-  }
-}
-
 void test__f_capability_groups_set__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-    gid_t group;
-    size_t total = 2;
-    gid_t groups[total];
+    const gid_t group = 1;
+    const size_t total = 2;
+    const gid_t groups[] = { 3, 4 };
 
     int errnos[] = {
       EINVAL,
@@ -61,6 +38,29 @@ void test__f_capability_groups_set__fails(void **state) {
   #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
 }
 
+void test__f_capability_groups_set__works(void **state) {
+
+  const gid_t group = 1;
+  const size_t total = 2;
+  const gid_t groups[] = { 3, 4 };
+
+  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+    printf("[  WARN    ] f_capability_groups_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_setgroups, false);
+  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+
+  {
+    const f_status_t status = f_capability_groups_set(group, total, groups);
+
+    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index afb8fddd8ffd13522ad94f451ba196e01f054f92..9374f0f76431d5535246b71bc1599cabe7459438 100644 (file)
 #define _TEST__F_capability__groups_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_groups_set()
  */
-extern void test__f_capability_groups_set__works(void **state);
+extern void test__f_capability_groups_set__fails(void **state);
+
+// f_capability_groups_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_groups_set()
  */
-extern void test__f_capability_groups_set__fails(void **state);
+extern void test__f_capability_groups_set__works(void **state);
 
 #endif // _TEST__F_capability__groups_set
index 665e41ed0b2fc37143700e350719d0efc79af5c5..b4458529941a530bdbc18487b36e8839edde203c 100644 (file)
@@ -5,27 +5,6 @@
 extern "C" {
 #endif
 
-void test__f_capability_initialize__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_initialize() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_init, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_initialize(&capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_initialize__fails(void **state) {
 
   #if !defined(_di_libcap_)
@@ -55,6 +34,38 @@ void test__f_capability_initialize__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_initialize__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_capability_initialize(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_initialize__works(void **state) {
+
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_initialize() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_init, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_initialize(&capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 3f436b45e27a3d53ee3b230d5c604656de4dde27..224763b32a29c4ad83462b3543d21e947f446eff 100644 (file)
 #define _TEST__F_capability__initialize
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_initialize()
  */
-extern void test__f_capability_initialize__works(void **state);
+extern void test__f_capability_initialize__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_initialize()
  */
-extern void test__f_capability_initialize__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_initialize__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_initialize()
+ */
+extern void test__f_capability_initialize__works(void **state);
 
 #endif // _TEST__F_capability__initialize
index 7733a600a3632aec0fbb35a3f983f4a6436e19a2..78dcc8d7773272dffb84a78d93b00cd3f4953690 100644 (file)
@@ -5,6 +5,17 @@
 extern "C" {
 #endif
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_mode_get__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_capability_mode_get(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
 void test__f_capability_mode_get__works(void **state) {
 
   f_capability_mode_t mode = f_capability_mode_t_initialize;
index d30ddedc35774ebe8ace789574371256979d43fb..0350e9089cdefddb7a5486b4e5849c2ff752e3b7 100644 (file)
 #ifndef _TEST__F_capability__mode_get
 #define _TEST__F_capability__mode_get
 
+// cap_get_mode() doesn't return failure.
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_capability_mode_get()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_mode_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
 /**
  * Test that function works.
  *
@@ -17,6 +28,4 @@
  */
 extern void test__f_capability_mode_get__works(void **state);
 
-// cap_get_mode() doesn't return failure.
-
 #endif // _TEST__F_capability__mode_get
index 71b324b98dee8075a017e0b57355a817cbdc2444..78a0b3bd2e27b289331b87a1bfb47e46a2be7d47 100644 (file)
@@ -5,9 +5,22 @@
 extern "C" {
 #endif
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_mode_get_name__parameter_checking(void **state) {
+
+    const f_capability_mode_t mode = f_capability_mode_t_initialize;
+
+    {
+      const f_status_t status = f_capability_mode_get_name(mode, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
 void test__f_capability_mode_get_name__works(void **state) {
 
-  f_capability_mode_t mode = f_capability_mode_t_initialize;
+  const f_capability_mode_t mode = f_capability_mode_t_initialize;
   f_string_constant_t constant = f_string_constant_t_initialize;
 
   #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
index f36776a1a089329156d402128057d5fec150e86c..d9f368f64175a5976b466019331c0da08eac7e32 100644 (file)
 #ifndef _TEST__F_capability__mode_get_name
 #define _TEST__F_capability__mode_get_name
 
+// cap_mode_name() doesn't return failure.
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_capability_mode_get_name()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_mode_get_name__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
 /**
  * Test that function works.
  *
@@ -17,6 +28,4 @@
  */
 extern void test__f_capability_mode_get_name__works(void **state);
 
-// cap_mode_name() doesn't return failure.
-
 #endif // _TEST__F_capability__mode_get_name
index 32f56ce0fb2979f858871fbdc8306c8db5f78932..f1e05881429a587d14e1f9d25fffc5c142cdec6f 100644 (file)
@@ -5,31 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_mode_set__works(void **state) {
-
-  f_capability_mode_t mode = f_capability_mode_t_initialize;
-
-  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-    printf("[  WARN    ] f_capability_mode_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_mode_set, false);
-  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-
-  {
-    const f_status_t status = f_capability_mode_set(mode);
-
-    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-  }
-}
-
 void test__f_capability_mode_set__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-    f_capability_mode_t mode = f_capability_mode_t_initialize;
+    const f_capability_mode_t mode = f_capability_mode_t_initialize;
 
     int errnos[] = {
       EINVAL,
@@ -57,6 +36,27 @@ void test__f_capability_mode_set__fails(void **state) {
   #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
 }
 
+void test__f_capability_mode_set__works(void **state) {
+
+  const f_capability_mode_t mode = f_capability_mode_t_initialize;
+
+  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+    printf("[  WARN    ] f_capability_mode_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_mode_set, false);
+  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+
+  {
+    const f_status_t status = f_capability_mode_set(mode);
+
+    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index d1c875383f215af3a317d4fe0604aa6d5a97c1af..621b6b6a89cc4a8f52c6b47c870daac7b7c91f08 100644 (file)
 #define _TEST__F_capability__mode_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_mode_set()
  */
-extern void test__f_capability_mode_set__works(void **state);
+extern void test__f_capability_mode_set__fails(void **state);
+
+// f_capability_mode_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_mode_set()
  */
-extern void test__f_capability_mode_set__fails(void **state);
+extern void test__f_capability_mode_set__works(void **state);
 
 #endif // _TEST__F_capability__mode_set
index 51f0081aa2da451711fb629d9a810bbf3fc2319f..be036d2b06c546a543873f828b3b9b25ea9e5b88 100644 (file)
@@ -5,9 +5,22 @@
 extern "C" {
 #endif
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_owner_get__parameter_checking(void **state) {
+
+    const f_capability_t capability = f_capability_t_initialize;
+
+    {
+      const f_status_t status = f_capability_owner_get(capability, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
 void test__f_capability_owner_get__works(void **state) {
 
-  f_capability_t capability = f_capability_t_initialize;
+  const f_capability_t capability = f_capability_t_initialize;
   uid_t id;
 
   #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
index 04991c94dff76d488ef821f78232381dfad843e8..08bcf63259faa811a6dcc5f43a8d111e1ad7a447 100644 (file)
 #ifndef _TEST__F_capability__owner_get
 #define _TEST__F_capability__owner_get
 
+// cap_mode_name() doesn't return failure.
+
+/**
+ * Test that parameter checking works as expected.
+ *
+ * @see f_capability_owner_get()
+ */
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_owner_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
 /**
  * Test that function works.
  *
@@ -17,6 +28,4 @@
  */
 extern void test__f_capability_owner_get__works(void **state);
 
-// cap_mode_name() doesn't return failure.
-
 #endif // _TEST__F_capability__owner_get
index 02da0763a9bf43881237fe27391f5eb1a495638e..7e57945f4588f57693183561ffc7de829fbcb91d 100644 (file)
@@ -5,33 +5,11 @@
 extern "C" {
 #endif
 
-void test__f_capability_owner_set__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-  uid_t id;
-
-  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-    printf("[  WARN    ] f_capability_owner_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_set_nsowner, false);
-  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-
-  {
-    const f_status_t status = f_capability_owner_set(capability, id);
-
-    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-  }
-}
-
 void test__f_capability_owner_set__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-    f_capability_t capability = f_capability_t_initialize;
-    uid_t id;
+    const f_capability_t capability = f_capability_t_initialize;
+    const uid_t id;
 
     int errnos[] = {
       EACCES,
@@ -69,6 +47,28 @@ void test__f_capability_owner_set__fails(void **state) {
   #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
 }
 
+void test__f_capability_owner_set__works(void **state) {
+
+  const f_capability_t capability = f_capability_t_initialize;
+  const uid_t id;
+
+  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+    printf("[  WARN    ] f_capability_owner_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_set_nsowner, false);
+  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+
+  {
+    const f_status_t status = f_capability_owner_set(capability, id);
+
+    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index b2687fdf3b9a1871feec32561a4a60679478a3e6..60c0c4a9efd513c95b89ac0c15e861741d30159d 100644 (file)
 #define _TEST__F_capability__owner_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_owner_set()
  */
-extern void test__f_capability_owner_set__works(void **state);
+extern void test__f_capability_owner_set__fails(void **state);
+
+// f_capability_owner_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_owner_set()
  */
-extern void test__f_capability_owner_set__fails(void **state);
+extern void test__f_capability_owner_set__works(void **state);
 
 #endif // _TEST__F_capability__owner_set
index a6bb5ab6dfc3e45bb3bb64ee888be6e847f15b63..c3fa114cc129d55c8f7ba7ebac0e257119e8c42b 100644 (file)
@@ -5,33 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_process_bound_drop__works(void **state) {
-
-  f_capability_value_t value = f_capability_value_t_initialize;
-  int bound = 0;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_process_bound_drop() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_drop_bound, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_process_bound_drop(value, &bound);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(bound, 1);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_process_bound_drop__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_value_t value = f_capability_value_t_initialize;
+    const f_capability_value_t value = f_capability_value_t_initialize;
     int bound = 0;
 
     int errnos[] = {
@@ -60,6 +37,42 @@ void test__f_capability_process_bound_drop__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_process_bound_drop__parameter_checking(void **state) {
+
+    const f_capability_value_t value = f_capability_value_t_initialize;
+
+    {
+      const f_status_t status = f_capability_process_bound_drop(value, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_process_bound_drop__works(void **state) {
+
+  const f_capability_value_t value = f_capability_value_t_initialize;
+  int bound = 0;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_process_bound_drop() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_drop_bound, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_process_bound_drop(value, &bound);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(bound, 1);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 4143d90aaf21355292fae06ccda606c1ee4a7cc1..4981054c5de276fa753a98207e0c3af576940af6 100644 (file)
 #define _TEST__F_capability__process_bound_drop
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_process_bound_drop()
  */
-extern void test__f_capability_process_bound_drop__works(void **state);
+extern void test__f_capability_process_bound_drop__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_process_bound_drop()
  */
-extern void test__f_capability_process_bound_drop__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_process_bound_drop__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_process_bound_drop()
+ */
+extern void test__f_capability_process_bound_drop__works(void **state);
 
 #endif // _TEST__F_capability__process_bound_drop
index 409d5417c23b4e141c7739e9c7cd39e4c1f52c31..32c85d3f186bec879e85a00528bd0f47ab822e94 100644 (file)
@@ -5,33 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_process_bound_get__works(void **state) {
-
-  f_capability_value_t value = f_capability_value_t_initialize;
-  int bound = 0;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_process_bound_get() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_bound, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_process_bound_get(value, &bound);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(bound, 1);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_process_bound_get__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_value_t value = f_capability_value_t_initialize;
+    const f_capability_value_t value = f_capability_value_t_initialize;
     int bound = 0;
 
     int errnos[] = {
@@ -54,6 +31,42 @@ void test__f_capability_process_bound_get__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_process_bound_get__parameter_checking(void **state) {
+
+    const f_capability_value_t value = f_capability_value_t_initialize;
+
+    {
+      const f_status_t status = f_capability_process_bound_get(value, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_process_bound_get__works(void **state) {
+
+  const f_capability_value_t value = f_capability_value_t_initialize;
+  int bound = 0;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_process_bound_get() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_bound, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_process_bound_get(value, &bound);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(bound, 1);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index cfa3f9b07617f6ca60b1cb33674c3fb26db70ad3..58bd2e86a16537fa9a88d7fa842503f7b509a429 100644 (file)
 #define _TEST__F_capability__process_bound_get
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_process_bound_get()
  */
-extern void test__f_capability_process_bound_get__works(void **state);
+extern void test__f_capability_process_bound_get__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_process_bound_get()
  */
-extern void test__f_capability_process_bound_get__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_process_bound_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_process_bound_get()
+ */
+extern void test__f_capability_process_bound_get__works(void **state);
 
 #endif // _TEST__F_capability__process_bound_get
index 60aded0710daa1f45bdeb38cbcd143a53e2adfcc..8d34dfc218fe09959d51acf9663bff358090104a 100644 (file)
@@ -5,27 +5,6 @@
 extern "C" {
 #endif
 
-void test__f_capability_process_get__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_process_get() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_proc, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_process_get(&capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_process_get__fails(void **state) {
 
   #if !defined(_di_libcap_)
@@ -55,6 +34,38 @@ void test__f_capability_process_get__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_process_get__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_capability_process_get(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_process_get__works(void **state) {
+
+  f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_process_get() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_proc, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_process_get(&capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 2397ab29df4c63deadb81165b4f027f5e58a4cae..eb01f17c8aeec859d7e27eb4d586e9330fd615bd 100644 (file)
 #define _TEST__F_capability__process_get
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_process_get()
  */
-extern void test__f_capability_process_get__works(void **state);
+extern void test__f_capability_process_get__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_process_get()
  */
-extern void test__f_capability_process_get__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_process_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_process_get()
+ */
+extern void test__f_capability_process_get__works(void **state);
 
 #endif // _TEST__F_capability__process_get
index 7087f20a249f792c21082e314f03e03b6c1031e8..723b99818aa8dab203c30a3aff59a905f4901105 100644 (file)
@@ -5,34 +5,11 @@
 extern "C" {
 #endif
 
-void test__f_capability_process_get_by_id__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-  pid_t pid;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_process_get_by_id() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_pid, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_process_get_by_id(pid, &capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(capability, 1);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_process_get_by_id__fails(void **state) {
 
   #if !defined(_di_libcap_)
     f_capability_t capability = f_capability_t_initialize;
-    pid_t pid;
+    const pid_t pid = 0;
 
     int errnos[] = {
       mock_errno_generic,
@@ -54,6 +31,40 @@ void test__f_capability_process_get_by_id__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_process_get_by_id__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_capability_process_get_by_id(0, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_process_get_by_id__works(void **state) {
+
+  f_capability_t capability = f_capability_t_initialize;
+  const pid_t pid = 0;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_process_get_by_id() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_pid, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_process_get_by_id(pid, &capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(capability, 1);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index d5c93570f5ed35f0801399f2535ff90b47488734..6688dd3e9414feef22b37ed1215da8b1db5ee169 100644 (file)
 #define _TEST__F_capability__process_get_by_id
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_process_get_by_id()
  */
-extern void test__f_capability_process_get_by_id__works(void **state);
+extern void test__f_capability_process_get_by_id__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_process_get_by_id()
  */
-extern void test__f_capability_process_get_by_id__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_process_get_by_id__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_process_get_by_id()
+ */
+extern void test__f_capability_process_get_by_id__works(void **state);
 
 #endif // _TEST__F_capability__process_get_by_id
index 00b26cd0d0d184591b2491211358314965c1eb65..a16bd13759456fe863228e260b3c25c5f89a049c 100644 (file)
@@ -5,31 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_process_set__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_process_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_set_proc, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_process_set(capability);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_process_set__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_t capability = f_capability_t_initialize;
+    const f_capability_t capability = f_capability_t_initialize;
 
     int errnos[] = {
       EINVAL,
@@ -57,6 +36,27 @@ void test__f_capability_process_set__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+void test__f_capability_process_set__works(void **state) {
+
+  const f_capability_t capability = f_capability_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_process_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_set_proc, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_process_set(capability);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index dccdc6dd492bf1dc6149d579a32bf0031717a9c2..f27f7aa6dd6ebab169cc9e58eed898a9fd084f2e 100644 (file)
 #define _TEST__F_capability__process_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_process_set()
  */
-extern void test__f_capability_process_set__works(void **state);
+extern void test__f_capability_process_set__fails(void **state);
+
+// f_capability_process_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_process_set()
  */
-extern void test__f_capability_process_set__fails(void **state);
+extern void test__f_capability_process_set__works(void **state);
 
 #endif // _TEST__F_capability__process_set
index d2bb8afdc228acb21291773e980dd6bb12dd3ecd..fc13d0be1d88f99af550551ed749e7563d4e41a9 100644 (file)
@@ -5,27 +5,6 @@
 extern "C" {
 #endif
 
-void test__f_capability_security_bits_get__works(void **state) {
-
-  f_capability_bits_t bits = f_capability_bits_t_initialize;
-
-  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-    printf("[  WARN    ] f_capability_security_bits_get() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_get_secbits, false);
-  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-
-  {
-    const f_status_t status = f_capability_security_bits_get(&bits);
-
-    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-  }
-}
-
 void test__f_capability_security_bits_get__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
@@ -57,6 +36,38 @@ void test__f_capability_security_bits_get__fails(void **state) {
   #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_security_bits_get__parameter_checking(void **state) {
+
+    {
+      const f_status_t status = f_capability_security_bits_get(0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_security_bits_get__works(void **state) {
+
+  f_capability_bits_t bits = f_capability_bits_t_initialize;
+
+  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+    printf("[  WARN    ] f_capability_security_bits_get() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_get_secbits, false);
+  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+
+  {
+    const f_status_t status = f_capability_security_bits_get(&bits);
+
+    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index c1ae69611c0052606fb5a8fcbebef540dfa4ea8c..72e1fd1fd8920571343629859055d31d5ce20f03 100644 (file)
 #define _TEST__F_capability__security_bits_get
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_security_bits_get()
  */
-extern void test__f_capability_security_bits_get__works(void **state);
+extern void test__f_capability_security_bits_get__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_security_bits_get()
  */
-extern void test__f_capability_security_bits_get__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_security_bits_get__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_security_bits_get()
+ */
+extern void test__f_capability_security_bits_get__works(void **state);
 
 #endif // _TEST__F_capability__security_bits_get
index 55e2621ebbc814bd710e098709c94c2c7a67f76e..3e93ecf4b2b2890ee33052c4d2fbc5858fa9a5d7 100644 (file)
@@ -5,31 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_security_bits_set__works(void **state) {
-
-  f_capability_bits_t bits = f_capability_bits_t_initialize;
-
-  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-    printf("[  WARN    ] f_capability_security_bits_set() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_set_secbits, false);
-  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-
-  {
-    const f_status_t status = f_capability_security_bits_set(bits);
-
-    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
-  }
-}
-
 void test__f_capability_security_bits_set__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-    f_capability_bits_t bits = f_capability_bits_t_initialize;
+    const f_capability_bits_t bits = f_capability_bits_t_initialize;
 
     int errnos[] = {
       EACCES,
@@ -67,6 +46,27 @@ void test__f_capability_security_bits_set__fails(void **state) {
   #endif // !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
 }
 
+void test__f_capability_security_bits_set__works(void **state) {
+
+  const f_capability_bits_t bits = f_capability_bits_t_initialize;
+
+  #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+    printf("[  WARN    ] f_capability_security_bits_set() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_set_secbits, false);
+  #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+
+  {
+    const f_status_t status = f_capability_security_bits_set(bits);
+
+    #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+    #endif // defined(_di_libcap_) || defined(_libcap_legacy_only_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index ec29fa39ab0042e201f097572ab52cc03e827cf6..3e7bb2da2ae6d7c5f3ae92d5425f0ee957eb4596 100644 (file)
 #define _TEST__F_capability__security_bits_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_security_bits_set()
  */
-extern void test__f_capability_security_bits_set__works(void **state);
+extern void test__f_capability_security_bits_set__fails(void **state);
+
+// f_capability_security_bits_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_security_bits_set()
  */
-extern void test__f_capability_security_bits_set__fails(void **state);
+extern void test__f_capability_security_bits_set__works(void **state);
 
 #endif // _TEST__F_capability__security_bits_set
index 10378c394d29fe566902dd5b039ecb3f4449e4d8..05475996061cba0a4dc2e4998bac97b724d83b83 100644 (file)
@@ -5,33 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_size__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-  ssize_t size = 0;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_size() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_size, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_size(capability, &size);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_int_equal(status, F_none);
-      assert_int_equal(size, 1);
-    #endif // defined(_di_libcap_)
-  }
-}
-
 void test__f_capability_size__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_t capability = f_capability_t_initialize;
+    const f_capability_t capability = f_capability_t_initialize;
     ssize_t size = 0;
 
     int errnos[] = {
@@ -60,6 +37,42 @@ void test__f_capability_size__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_size__parameter_checking(void **state) {
+
+    const f_capability_t capability = f_capability_t_initialize;
+
+    {
+      const f_status_t status = f_capability_size(capability, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_size__works(void **state) {
+
+  const f_capability_t capability = f_capability_t_initialize;
+  ssize_t size = 0;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_size() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_size, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_size(capability, &size);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_int_equal(status, F_none);
+      assert_int_equal(size, 1);
+    #endif // defined(_di_libcap_)
+  }
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 5115f290cc713b12347088e728f817952cdba58f..cf2701e9c9bc9f41610a0b9efd370190753bcba5 100644 (file)
 #define _TEST__F_capability__size
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_size()
  */
-extern void test__f_capability_size__works(void **state);
+extern void test__f_capability_size__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_size()
  */
-extern void test__f_capability_size__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_size__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_size()
+ */
+extern void test__f_capability_size__works(void **state);
 
 #endif // _TEST__F_capability__size
index 8cb992585ccb873e8a9ec87a05239f12ea8a4baf..2519ea5c1df618b2bac9615cf080a73d3d13ddea 100644 (file)
 #ifndef _TEST__F_capability__supported
 #define _TEST__F_capability__supported
 
+// f_capability_supported() doesn't return failure.
+
+// f_capability_supported() doesn't use parameter checking.
+
 /**
  * Test that function works.
  *
@@ -17,6 +21,4 @@
  */
 extern void test__f_capability_supported__works(void **state);
 
-// f_capability_supported() doesn't return failure.
-
 #endif // _TEST__F_capability__supported
index 66bd54c1e7183a62499cf00a051b8ea89314fad9..90db89c61ec52f945768bfdc1359e80e7b6a6511 100644 (file)
 #ifndef _TEST__F_capability__supported_ambient
 #define _TEST__F_capability__supported_ambient
 
+// f_capability_supported_ambient() doesn't return failure.
+
+// f_capability_supported_ambient() doesn't use parameter checking.
+
 /**
  * Test that function works.
  *
@@ -17,6 +21,4 @@
  */
 extern void test__f_capability_supported_ambient__works(void **state);
 
-// f_capability_supported_ambient() doesn't return failure.
-
 #endif // _TEST__F_capability__supported_ambient
index c1b54f25601d459dbea29709b6a26c4619d31c15..c415e813dbba63245cc9c903b8c6e4cdc6b12b44 100644 (file)
@@ -7,7 +7,7 @@ extern "C" {
 
 void test__f_capability_supported_code__works(void **state) {
 
-  f_capability_value_t value = f_capability_value_t_initialize;
+  const f_capability_value_t value = f_capability_value_t_initialize;
 
   #if defined(_di_libcap_)
     {
index 7ec5a84d2ffd9a020620a543e38d2cd097c243b7..3a263e2545afb81e24c8a336c9442ed9f3519da7 100644 (file)
 #ifndef _TEST__F_capability__supported_code
 #define _TEST__F_capability__supported_code
 
+// f_capability_supported_code() doesn't return failure.
+
+// f_capability_supported_code() doesn't use parameter checking.
+
 /**
  * Test that function works.
  *
@@ -17,6 +21,4 @@
  */
 extern void test__f_capability_supported_code__works(void **state);
 
-// f_capability_supported_code() doesn't return failure.
-
 #endif // _TEST__F_capability__supported_code
index 1d122f79286a6dee739b1a52fa32dd248d36208e..96ab5432839b06c97fe9778ecdc612df94160501 100644 (file)
@@ -5,38 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_to_name__works(void **state) {
-
-  int code = CAP_CHOWN;
-  char string[] = "CAP_CHOWN";
-  f_string_dynamic_t name = f_string_dynamic_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_to_name() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_to_name, false);
-    will_return(__wrap_cap_to_name, string);
-    will_return(__wrap_cap_free, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_to_name(code, &name);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_string_equal(name.string, string);
-      assert_int_equal(name.used, 9);
-    #endif // defined(_di_libcap_)
-  }
-
-  f_string_dynamic_resize(0, &name);
-}
-
 void test__f_capability_to_name__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    int code = CAP_CHOWN;
+    const int code = CAP_CHOWN;
     f_string_dynamic_t name = f_string_dynamic_t_initialize;
 
     int errnos[] = {
@@ -64,6 +36,47 @@ void test__f_capability_to_name__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_to_name__parameter_checking(void **state) {
+
+    const int code = CAP_CHOWN;
+
+    {
+      const f_status_t status = f_capability_to_name(code, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_to_name__works(void **state) {
+
+  const int code = CAP_CHOWN;
+  char string[] = "CAP_CHOWN";
+  f_string_dynamic_t name = f_string_dynamic_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_to_name() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_to_name, false);
+    will_return(__wrap_cap_to_name, string);
+    will_return(__wrap_cap_free, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_to_name(code, &name);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_string_equal(name.string, string);
+      assert_int_equal(name.used, 9);
+    #endif // defined(_di_libcap_)
+  }
+
+  f_string_dynamic_resize(0, &name);
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index c02cfb2ed2c92bebdab25397e23e12f7db2bfd87..034fdc36f19abb547f1e32f856f61d84f745aa99 100644 (file)
 #define _TEST__F_capability__to_name
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_to_name()
  */
-extern void test__f_capability_to_name__works(void **state);
+extern void test__f_capability_to_name__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_to_name()
  */
-extern void test__f_capability_to_name__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_to_name__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_to_name()
+ */
+extern void test__f_capability_to_name__works(void **state);
 
 #endif // _TEST__F_capability__to_name
index e10069aec85f31d1305b4b02c010c2b1ad0c21e9..4308e3a7ce4d1f854e8d9c8446cf4d25054321b8 100644 (file)
@@ -5,39 +5,10 @@
 extern "C" {
 #endif
 
-void test__f_capability_to_text__works(void **state) {
-
-  f_capability_t capability = f_capability_t_initialize;
-  char string[] = "CAP_CHOWN";
-  f_string_dynamic_t text = f_string_dynamic_t_initialize;
-
-  #if defined(_di_libcap_)
-    printf("[  WARN    ] f_capability_to_text() is not implemented and cannot be fully tested.\n");
-  #else
-    will_return(__wrap_cap_to_text, false);
-    will_return(__wrap_cap_to_text, 9);
-    will_return(__wrap_cap_to_text, string);
-    will_return(__wrap_cap_free, false);
-  #endif // defined(_di_libcap_)
-
-  {
-    const f_status_t status = f_capability_to_text(capability, &text);
-
-    #if defined(_di_libcap_)
-      assert_int_equal(F_status_set_fine(status), F_implemented_not);
-    #else
-      assert_string_equal(text.string, string);
-      assert_int_equal(text.used, 9);
-    #endif // defined(_di_libcap_)
-  }
-
-  f_string_dynamic_resize(0, &text);
-}
-
 void test__f_capability_to_text__fails(void **state) {
 
   #if !defined(_di_libcap_)
-    f_capability_t capability = f_capability_t_initialize;
+    const f_capability_t capability = f_capability_t_initialize;
     f_string_dynamic_t text = f_string_dynamic_t_initialize;
 
     int errnos[] = {
@@ -65,6 +36,48 @@ void test__f_capability_to_text__fails(void **state) {
   #endif // !defined(_di_libcap_)
 }
 
+#ifndef _di_level_0_parameter_checking_
+  void test__f_capability_to_text__parameter_checking(void **state) {
+
+    const f_capability_t capability = f_capability_t_initialize;
+
+    {
+      const f_status_t status = f_capability_to_text(capability, 0);
+
+      assert_int_equal(F_status_set_fine(status), F_parameter);
+    }
+  }
+#endif // _di_level_0_parameter_checking_
+
+void test__f_capability_to_text__works(void **state) {
+
+  const f_capability_t capability = f_capability_t_initialize;
+  char string[] = "CAP_CHOWN";
+  f_string_dynamic_t text = f_string_dynamic_t_initialize;
+
+  #if defined(_di_libcap_)
+    printf("[  WARN    ] f_capability_to_text() is not implemented and cannot be fully tested.\n");
+  #else
+    will_return(__wrap_cap_to_text, false);
+    will_return(__wrap_cap_to_text, 9);
+    will_return(__wrap_cap_to_text, string);
+    will_return(__wrap_cap_free, false);
+  #endif // defined(_di_libcap_)
+
+  {
+    const f_status_t status = f_capability_to_text(capability, &text);
+
+    #if defined(_di_libcap_)
+      assert_int_equal(F_status_set_fine(status), F_implemented_not);
+    #else
+      assert_string_equal(text.string, string);
+      assert_int_equal(text.used, 9);
+    #endif // defined(_di_libcap_)
+  }
+
+  f_string_dynamic_resize(0, &text);
+}
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 4612b2c87972377b736c4bf23d8912c9d8f9367e..5330e9c33e194122695cbe4b522b11f76adc700d 100644 (file)
 #define _TEST__F_capability__to_text
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_to_text()
  */
-extern void test__f_capability_to_text__works(void **state);
+extern void test__f_capability_to_text__fails(void **state);
 
 /**
- * Test that function fails.
+ * Test that parameter checking works as expected.
  *
  * @see f_capability_to_text()
  */
-extern void test__f_capability_to_text__fails(void **state);
+#ifndef _di_level_0_parameter_checking_
+  extern void test__f_capability_to_text__parameter_checking(void **state);
+#endif // _di_level_0_parameter_checking_
+
+/**
+ * Test that function works.
+ *
+ * @see f_capability_to_text()
+ */
+extern void test__f_capability_to_text__works(void **state);
 
 #endif // _TEST__F_capability__to_text
index 20e4d024949580f94a99bb7acede99f4e5036d62..81aae3d6b28981caac879ac5e199e4c12beb6039 100644 (file)
@@ -7,7 +7,7 @@ extern "C" {
 
 void test__f_capability_user_set__works(void **state) {
 
-  uid_t uid;
+  const uid_t uid = 0;
 
   #if defined(_di_libcap_) || defined(_libcap_legacy_only_)
     printf("[  WARN    ] f_capability_user_set() is not implemented and cannot be fully tested.\n");
@@ -29,7 +29,7 @@ void test__f_capability_user_set__works(void **state) {
 void test__f_capability_user_set__fails(void **state) {
 
   #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_)
-    uid_t uid;
+    const uid_t uid = 0;
 
     int errnos[] = {
       EINVAL,
index 44b9b6d8bb27762e74bff0606ce02dd62f1c5ebb..c48355fab4abff08a54925f9a3c0bee133a457e5 100644 (file)
 #define _TEST__F_capability__user_set
 
 /**
- * Test that function works.
+ * Test that function fails.
  *
  * @see f_capability_user_set()
  */
-extern void test__f_capability_user_set__works(void **state);
+extern void test__f_capability_user_set__fails(void **state);
+
+// f_capability_user_set() doesn't use parameter checking.
 
 /**
- * Test that function fails.
+ * Test that function works.
  *
  * @see f_capability_user_set()
  */
-extern void test__f_capability_user_set__fails(void **state);
+extern void test__f_capability_user_set__works(void **state);
 
 #endif // _TEST__F_capability__user_set
index 96d9e27269e44867afdec03df52cadc06e8ab848..4a2dbe63ebef111a347854e0a6e77968df1a27e5 100644 (file)
@@ -19,122 +19,164 @@ int setdown(void **state) {
 int main(void) {
 
   const struct CMUnitTest tests[] = {
-    cmocka_unit_test(test__f_capability_ambient_get__works),
     cmocka_unit_test(test__f_capability_ambient_get__fails),
+    cmocka_unit_test(test__f_capability_ambient_get__works),
 
-    cmocka_unit_test(test__f_capability_ambient_reset__works),
     cmocka_unit_test(test__f_capability_ambient_reset__fails),
+    cmocka_unit_test(test__f_capability_ambient_reset__works),
 
-    cmocka_unit_test(test__f_capability_ambient_set__works),
     cmocka_unit_test(test__f_capability_ambient_set__fails),
+    cmocka_unit_test(test__f_capability_ambient_set__works),
 
-    cmocka_unit_test(test__f_capability_clear__works),
     cmocka_unit_test(test__f_capability_clear__fails),
+    cmocka_unit_test(test__f_capability_clear__works),
 
-    cmocka_unit_test(test__f_capability_clear_flag__works),
     cmocka_unit_test(test__f_capability_clear_flag__fails),
+    cmocka_unit_test(test__f_capability_clear_flag__works),
 
-    cmocka_unit_test(test__f_capability_compare__works),
     cmocka_unit_test(test__f_capability_compare__fails),
+    cmocka_unit_test(test__f_capability_compare__works),
 
-    cmocka_unit_test(test__f_capability_copy__works),
     cmocka_unit_test(test__f_capability_copy__fails),
+    cmocka_unit_test(test__f_capability_copy__works),
 
-    cmocka_unit_test(test__f_capability_copy_external__works),
     cmocka_unit_test(test__f_capability_copy_external__fails),
+    cmocka_unit_test(test__f_capability_copy_external__works),
 
-    cmocka_unit_test(test__f_capability_copy_internal__works),
     cmocka_unit_test(test__f_capability_copy_internal__fails),
+    cmocka_unit_test(test__f_capability_copy_internal__works),
 
-    cmocka_unit_test(test__f_capability_delete__works),
     cmocka_unit_test(test__f_capability_delete__fails),
+    cmocka_unit_test(test__f_capability_delete__works),
 
-    cmocka_unit_test(test__f_capability_file_descriptor_get__works),
     cmocka_unit_test(test__f_capability_file_descriptor_get__fails),
+    cmocka_unit_test(test__f_capability_file_descriptor_get__works),
 
-    cmocka_unit_test(test__f_capability_file_descriptor_set__works),
     cmocka_unit_test(test__f_capability_file_descriptor_set__fails),
+    cmocka_unit_test(test__f_capability_file_descriptor_set__works),
 
-    cmocka_unit_test(test__f_capability_file_get__works),
     cmocka_unit_test(test__f_capability_file_get__fails),
+    cmocka_unit_test(test__f_capability_file_get__works),
 
-    cmocka_unit_test(test__f_capability_file_set__works),
     cmocka_unit_test(test__f_capability_file_set__fails),
+    cmocka_unit_test(test__f_capability_file_set__works),
 
-    cmocka_unit_test(test__f_capability_flag_get__works),
     cmocka_unit_test(test__f_capability_flag_get__fails),
+    cmocka_unit_test(test__f_capability_flag_get__works),
 
-    cmocka_unit_test(test__f_capability_flag_set__works),
     cmocka_unit_test(test__f_capability_flag_set__fails),
+    cmocka_unit_test(test__f_capability_flag_set__works),
 
-    cmocka_unit_test(test__f_capability_from_name__works),
     cmocka_unit_test(test__f_capability_from_name__fails),
+    cmocka_unit_test(test__f_capability_from_name__works),
 
-    cmocka_unit_test(test__f_capability_from_text__works),
     cmocka_unit_test(test__f_capability_from_text__fails),
+    cmocka_unit_test(test__f_capability_from_text__works),
 
-    cmocka_unit_test(test__f_capability_groups_set__works),
     cmocka_unit_test(test__f_capability_groups_set__fails),
+    cmocka_unit_test(test__f_capability_groups_set__works),
 
-    cmocka_unit_test(test__f_capability_initialize__works),
     cmocka_unit_test(test__f_capability_initialize__fails),
+    cmocka_unit_test(test__f_capability_initialize__works),
 
-    cmocka_unit_test(test__f_capability_mode_get__works),
     // cap_get_mode() doesn't return failure.
+    cmocka_unit_test(test__f_capability_mode_get__works),
 
-    cmocka_unit_test(test__f_capability_mode_get_name__works),
     // cap_mode_name() doesn't return failure.
+    cmocka_unit_test(test__f_capability_mode_get_name__works),
 
-    cmocka_unit_test(test__f_capability_mode_set__works),
     cmocka_unit_test(test__f_capability_mode_set__fails),
+    cmocka_unit_test(test__f_capability_mode_set__works),
 
-    cmocka_unit_test(test__f_capability_owner_get__works),
     // cap_get_nsowner() doesn't return failure.
+    cmocka_unit_test(test__f_capability_owner_get__works),
 
-    cmocka_unit_test(test__f_capability_owner_set__works),
     cmocka_unit_test(test__f_capability_owner_set__fails),
+    cmocka_unit_test(test__f_capability_owner_set__works),
 
-    cmocka_unit_test(test__f_capability_process_bound_drop__works),
     cmocka_unit_test(test__f_capability_process_bound_drop__fails),
+    cmocka_unit_test(test__f_capability_process_bound_drop__works),
 
-    cmocka_unit_test(test__f_capability_process_bound_get__works),
     cmocka_unit_test(test__f_capability_process_bound_get__fails),
+    cmocka_unit_test(test__f_capability_process_bound_get__works),
 
-    cmocka_unit_test(test__f_capability_process_get_by_id__works),
     cmocka_unit_test(test__f_capability_process_get_by_id__fails),
+    cmocka_unit_test(test__f_capability_process_get_by_id__works),
 
-    cmocka_unit_test(test__f_capability_process_get__works),
     cmocka_unit_test(test__f_capability_process_get__fails),
+    cmocka_unit_test(test__f_capability_process_get__works),
 
-    cmocka_unit_test(test__f_capability_process_set__works),
     cmocka_unit_test(test__f_capability_process_set__fails),
+    cmocka_unit_test(test__f_capability_process_set__works),
 
-    cmocka_unit_test(test__f_capability_security_bits_get__works),
     cmocka_unit_test(test__f_capability_security_bits_get__fails),
+    cmocka_unit_test(test__f_capability_security_bits_get__works),
 
-    cmocka_unit_test(test__f_capability_security_bits_set__works),
     cmocka_unit_test(test__f_capability_security_bits_set__fails),
+    cmocka_unit_test(test__f_capability_security_bits_set__works),
 
-    cmocka_unit_test(test__f_capability_size__works),
     cmocka_unit_test(test__f_capability_size__fails),
+    cmocka_unit_test(test__f_capability_size__works),
 
-    cmocka_unit_test(test__f_capability_supported__works),
     // f_capability_supported() doesn't return failure.
+    cmocka_unit_test(test__f_capability_supported__works),
 
-    cmocka_unit_test(test__f_capability_supported_ambient__works),
     // f_capability_supported_ambient() doesn't return failure.
+    cmocka_unit_test(test__f_capability_supported_ambient__works),
 
-    cmocka_unit_test(test__f_capability_supported_code__works),
     // f_capability_supported_code() doesn't return failure.
+    cmocka_unit_test(test__f_capability_supported_code__works),
 
-    cmocka_unit_test(test__f_capability_to_name__works),
     cmocka_unit_test(test__f_capability_to_name__fails),
+    cmocka_unit_test(test__f_capability_to_name__works),
 
-    cmocka_unit_test(test__f_capability_to_text__works),
     cmocka_unit_test(test__f_capability_to_text__fails),
+    cmocka_unit_test(test__f_capability_to_text__works),
 
-    cmocka_unit_test(test__f_capability_user_set__works),
     cmocka_unit_test(test__f_capability_user_set__fails),
+    cmocka_unit_test(test__f_capability_user_set__works),
+
+    #ifndef _di_level_0_parameter_checking_
+      cmocka_unit_test(test__f_capability_ambient_get__parameter_checking),
+      // f_capability_ambient_reset() doesn't use parameter checking.
+      // f_capability_ambient_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_clear__parameter_checking),
+      cmocka_unit_test(test__f_capability_clear_flag__parameter_checking),
+      // f_capability_compare() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_copy__parameter_checking),
+      cmocka_unit_test(test__f_capability_copy_external__parameter_checking),
+      cmocka_unit_test(test__f_capability_copy_internal__parameter_checking),
+      cmocka_unit_test(test__f_capability_delete__parameter_checking),
+      cmocka_unit_test(test__f_capability_file_descriptor_get__parameter_checking),
+      // f_capability_file_descriptor_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_file_get__parameter_checking),
+      // f_capability_file_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_flag_get__parameter_checking),
+      cmocka_unit_test(test__f_capability_flag_set__parameter_checking),
+      cmocka_unit_test(test__f_capability_from_name__parameter_checking),
+      cmocka_unit_test(test__f_capability_from_text__parameter_checking),
+      // f_capability_groups_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_initialize__parameter_checking),
+      cmocka_unit_test(test__f_capability_mode_get__parameter_checking),
+      cmocka_unit_test(test__f_capability_mode_get_name__parameter_checking),
+      // f_capability_mode_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_owner_get__parameter_checking),
+      // f_capability_owner_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_process_bound_drop__parameter_checking),
+      cmocka_unit_test(test__f_capability_process_bound_get__parameter_checking),
+      cmocka_unit_test(test__f_capability_process_get_by_id__parameter_checking),
+      cmocka_unit_test(test__f_capability_process_get__parameter_checking),
+      // f_capability_process_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_security_bits_get__parameter_checking),
+      // f_capability_security_bits_set() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_size__parameter_checking),
+      // f_capability_supported() doesn't use parameter checking.
+      // f_capability_supported_ambient() doesn't use parameter checking.
+      // f_capability_supported_code() doesn't use parameter checking.
+      cmocka_unit_test(test__f_capability_to_name__parameter_checking),
+      cmocka_unit_test(test__f_capability_to_text__parameter_checking),
+      // f_capability_user_set() doesn't use parameter checking.
+    #endif // _di_level_0_parameter_checking_
   };
 
   return cmocka_run_group_tests(tests, setup, setdown);