]> Kevux Git Server - fll/commitdiff
Bugfix: The f_signal unit tests after significant change.
authorKevin Day <thekevinday@gmail.com>
Tue, 3 Jan 2023 20:47:46 +0000 (14:47 -0600)
committerKevin Day <thekevinday@gmail.com>
Tue, 3 Jan 2023 20:47:46 +0000 (14:47 -0600)
The bugfix from commit 4dfc152aad390be408cb9a20578b337b2a13d993 didn't include checking and updating the unit tests.

level_0/f_signal/tests/unit/c/test-signal-close.c
level_0/f_signal/tests/unit/c/test-signal-close.h
level_0/f_signal/tests/unit/c/test-signal.c

index 910b45739040574acafb03900d1d758627265fa9..4ce6745f983c100899484f66d23c3f08bd498334 100644 (file)
@@ -27,6 +27,8 @@ void test__f_signal_close__fails(void **state) {
     F_failure,
   };
 
+  signal.id = 0;
+
   for (int i = 0; i < 6; ++i) {
 
     will_return(__wrap_close, true);
@@ -47,12 +49,25 @@ void test__f_signal_close__parameter_checking(void **state) {
   }
 }
 
+void test__f_signal_close__returns_data_not(void **state) {
+
+  f_signal_t signal = f_signal_t_initialize;
+
+  {
+    const f_status_t status = f_signal_close(&signal);
+
+    assert_int_equal(status, F_data_not);
+  }
+}
+
 void test__f_signal_close__works(void **state) {
 
   f_signal_t signal = f_signal_t_initialize;
 
+  signal.id = 0;
+
   {
-    will_return(__wrap_close, false);
+    will_return(__wrap_close, 0);
 
     const f_status_t status = f_signal_close(&signal);
 
index 0dcf1c72740e05d8cea93ba866988e83b00352d8..68acfce8944514c23abe80ada86fc0acb8b367d1 100644 (file)
@@ -25,6 +25,13 @@ extern void test__f_signal_close__fails(void **state);
 extern void test__f_signal_close__parameter_checking(void **state);
 
 /**
+ * Test that function works but returns F_data_not when file descriptor is -1.
+ *
+ * @see f_signal_close()
+ */
+extern void test__f_signal_close__returns_data_not(void **state);
+
+/**
  * Test that function works.
  *
  * @see f_signal_close()
index 6e61a621743ac5d3c882facc947127ed6567e4ec..dd7dc8d83b2741fb8ef13a58cc0ca795c858d785 100644 (file)
@@ -23,6 +23,7 @@ int main(void) {
     cmocka_unit_test(test__f_signal_action__works),
 
     cmocka_unit_test(test__f_signal_close__fails),
+    cmocka_unit_test(test__f_signal_close__returns_data_not),
     cmocka_unit_test(test__f_signal_close__works),
 
     cmocka_unit_test(test__f_signal_mask__fails),