[PATCH] tests: use memcmp() instead of g_assert_cmpmem() for now
Aleksander Morgado
aleksander at aleksander.es
Thu Nov 8 16:01:56 UTC 2018
On 11/7/18 7:26 PM, Ben Chan wrote:
> g_assert_cmpmem() isn't available until glib 2.46, while the minimum
> glib version required by ModemManager is 2.36. This patch replaces the
> uses of g_assert_cmpmem() with memcmp() instead.
> ---
Pushed, thanks
> libmm-glib/tests/test-pco.c | 3 +--
> plugins/altair/tests/test-modem-helpers-altair-lte.c | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/libmm-glib/tests/test-pco.c b/libmm-glib/tests/test-pco.c
> index c25606fc..086ce3ba 100644
> --- a/libmm-glib/tests/test-pco.c
> +++ b/libmm-glib/tests/test-pco.c
> @@ -76,8 +76,7 @@ test_pco_list_add (void)
> pco_data = mm_pco_get_data (pco, &pco_data_size);
> g_assert (pco_data != NULL);
> g_assert_cmpuint (pco_data_size, ==, expected_pco->pco_data_size);
> - g_assert_cmpmem (pco_data, pco_data_size,
> - expected_pco->pco_data, expected_pco->pco_data_size);
> + g_assert_cmpint (memcmp (pco_data, expected_pco->pco_data, pco_data_size), ==, 0);
> }
>
> mm_pco_list_free (list);
> diff --git a/plugins/altair/tests/test-modem-helpers-altair-lte.c b/plugins/altair/tests/test-modem-helpers-altair-lte.c
> index ec25e5f8..da9eaf32 100644
> --- a/plugins/altair/tests/test-modem-helpers-altair-lte.c
> +++ b/plugins/altair/tests/test-modem-helpers-altair-lte.c
> @@ -164,8 +164,7 @@ test_parse_vendor_pco_info (void)
> pco_data = mm_pco_get_data (pco, &pco_data_size);
> g_assert (pco_data != NULL);
> g_assert_cmpuint (pco_data_size, ==, good_pco_infos[i].pco_data_size);
> - g_assert_cmpmem (pco_data, pco_data_size,
> - good_pco_infos[i].pco_data, good_pco_infos[i].pco_data_size);
> + g_assert_cmpint (memcmp (pco_data, good_pco_infos[i].pco_data, pco_data_size), ==, 0);
> g_object_unref (pco);
> }
>
>
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list