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

Aleksander Morgado aleksander at aleksander.es
Thu Jan 12 10:39:53 UTC 2017


On 12/01/17 07:29, Ben Chan wrote:
> `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.
> ---

Thanks, yes, pushed to git master and mm-1-6.

>  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++) {
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list