[PATCH] telit: use g_assert instead of g_assert_true / g_assert_false

Ben Chan benchan at chromium.org
Thu Jan 12 06:29:08 UTC 2017


`g_assert_true' and `g_assert_false' are defined in glib 2.38 or later.
The minimum glib version currently required by ModemMamanger is 2.36.
While `g_assert_true' and `g_assert_false' may be preferred over the
more generic `g_assert', it seems like overkill to bump the minimum glib
version requirement just for that. When more code in ModemManager later
requires newer versions of glib, we can migrate all existing code to use
`g_assert_true' and `g_assert_false' when appropriate.
---
 plugins/telit/tests/test-mm-modem-helpers-telit.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/plugins/telit/tests/test-mm-modem-helpers-telit.c b/plugins/telit/tests/test-mm-modem-helpers-telit.c
index 2da60c11..88a889e6 100644
--- a/plugins/telit/tests/test-mm-modem-helpers-telit.c
+++ b/plugins/telit/tests/test-mm-modem-helpers-telit.c
@@ -101,9 +101,9 @@ test_mm_bands_contains (void) {
     for (i = 0; i < 3; i++)
         g_array_append_val (mm_bands, i);
 
-    g_assert_true (mm_telit_bands_contains (mm_bands, 2));
-    g_assert_true (mm_telit_bands_contains (mm_bands, 2));
-    g_assert_false (mm_telit_bands_contains (mm_bands, 3));
+    g_assert (mm_telit_bands_contains (mm_bands, 2));
+    g_assert (mm_telit_bands_contains (mm_bands, 2));
+    g_assert (!mm_telit_bands_contains (mm_bands, 3));
 
     g_array_free (mm_bands, TRUE);
 }
@@ -134,7 +134,7 @@ test_parse_band_flag_str (void) {
                                                    &band_flags,
                                                    &error);
         g_assert_no_error (error);
-        g_assert_true (res);
+        g_assert (res);
 
         for (j = 0; j < band_flag_test[i].band_flags_len; j++) {
             guint ref;
@@ -143,7 +143,7 @@ test_parse_band_flag_str (void) {
             ref = band_flag_test[i].band_flags[j];
             cur = g_array_index (band_flags, guint, j);
 
-            g_assert_true (ref == cur);
+            g_assert (ref == cur);
         }
 
         g_array_free (band_flags, TRUE);
@@ -225,7 +225,7 @@ test_parse_supported_bands_response (void) {
                                            &bands,
                                            &error);
         g_assert_no_error (error);
-        g_assert_true (res);
+        g_assert (res);
 
 
         for (j = 0; j < supported_band_mapping_tests[i].mm_bands_len; j++) {
@@ -302,7 +302,7 @@ test_parse_current_bands_response (void) {
                                            &bands,
                                            &error);
         g_assert_no_error (error);
-        g_assert_true (res);
+        g_assert (res);
 
 
         for (j = 0; j < current_band_mapping_tests[i].mm_bands_len; j++) {
-- 
2.11.0.390.gc69c2f50cf-goog



More information about the ModemManager-devel mailing list