From 9d2c2a75cc23a878ff48a1c70377dd49a488cd1a Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 2 Aug 2016 11:28:43 +0200 Subject: ublox: new 'AT+UBMCONF?' response parser --- plugins/ublox/tests/test-modem-helpers-ublox.c | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'plugins/ublox/tests/test-modem-helpers-ublox.c') diff --git a/plugins/ublox/tests/test-modem-helpers-ublox.c b/plugins/ublox/tests/test-modem-helpers-ublox.c index 17b6ba22..078d1c1a 100644 --- a/plugins/ublox/tests/test-modem-helpers-ublox.c +++ b/plugins/ublox/tests/test-modem-helpers-ublox.c @@ -66,6 +66,42 @@ test_uusbconf_response (void) } } +/*****************************************************************************/ +/* Test UBMCONF? responses */ + +typedef struct { + const gchar *str; + MMUbloxNetworkingMode mode; +} UbmconfResponseTest; + +static const UbmconfResponseTest ubmconf_response_tests[] = { + { + .str = "+UBMCONF: 1\r\n", + .mode = MM_UBLOX_NETWORKING_MODE_ROUTER + }, + { + .str = "+UBMCONF: 2\r\n", + .mode = MM_UBLOX_NETWORKING_MODE_BRIDGE + }, +}; + +static void +test_ubmconf_response (void) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (ubmconf_response_tests); i++) { + MMUbloxNetworkingMode mode = MM_UBLOX_NETWORKING_MODE_UNKNOWN; + GError *error = NULL; + gboolean success; + + success = mm_ublox_parse_ubmconf_response (ubmconf_response_tests[i].str, &mode, &error); + g_assert_no_error (error); + g_assert (success); + g_assert_cmpuint (ubmconf_response_tests[i].mode, ==, mode); + } +} + /*****************************************************************************/ void @@ -96,6 +132,7 @@ int main (int argc, char **argv) g_test_init (&argc, &argv, NULL); g_test_add_func ("/MM/ublox/uusbconf/response", test_uusbconf_response); + g_test_add_func ("/MM/ublox/ubmconf/response", test_ubmconf_response); return g_test_run (); } -- cgit v1.2.3-70-g09d2