[glib: 2/4] tests: Improve branch coverage when testing g_time_val_add()



commit 6104e63ec4915442ec10d38e1fe2614ccd96d36e
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Aug 7 11:00:16 2018 +0100

    tests: Improve branch coverage when testing g_time_val_add()
    
    While I’m here…
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/tests/timer.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/glib/tests/timer.c b/glib/tests/timer.c
index f0d070684..c0b9ba802 100644
--- a/glib/tests/timer.c
+++ b/glib/tests/timer.c
@@ -115,6 +115,14 @@ test_timeval_add (void)
   g_time_val_add (&time, 1000);
   g_assert_cmpint (time.tv_sec, ==, 1); 
   g_assert_cmpint (time.tv_usec, ==, 510);
+
+  g_time_val_add (&time, 0);
+  g_assert_cmpint (time.tv_sec, ==, 1);
+  g_assert_cmpint (time.tv_usec, ==, 510);
+
+  g_time_val_add (&time, -210);
+  g_assert_cmpint (time.tv_sec, ==, 1);
+  g_assert_cmpint (time.tv_usec, ==, 300);
 }
 
 typedef struct {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]