diff options
author | Dan Williams <dan@ioncontrol.co> | 2025-04-12 23:17:45 -0500 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-04-12 23:37:00 -0500 |
commit | 9e205f47847ab9ef5887b79c077ef8468d769af0 (patch) | |
tree | e0f1c76a6524264024f955970c1cd261c182f22e /src/tests/test-modem-helpers.c | |
parent | 66c3631a2f5352da7842436983b82d2bc0ecddda (diff) |
modem-helpers: fix checking of CDMA/EVDO access technology
Missing ! for strncmp() meant the test was backwards and would
erroneously report 1xRTT and EVDOr0 when those access technologies
were not in use.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/tests/test-modem-helpers.c')
-rw-r--r-- | src/tests/test-modem-helpers.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c index 6692e56d..6836bbdd 100644 --- a/src/tests/test-modem-helpers.c +++ b/src/tests/test-modem-helpers.c @@ -4866,6 +4866,29 @@ test_mnc_length (void) /*****************************************************************************/ +typedef struct { + const gchar *str; + const MMModemAccessTechnology act; +} TestActData; + +static const TestActData test_act_data[] = { + { "EDGE", MM_MODEM_ACCESS_TECHNOLOGY_EDGE }, + /* Ensure WCDMA does not get counted as 3GPP2 CDMA */ + { "WCDMA", MM_MODEM_ACCESS_TECHNOLOGY_UMTS }, + { "CDMA-EVDO", MM_MODEM_ACCESS_TECHNOLOGY_1XRTT | MM_MODEM_ACCESS_TECHNOLOGY_EVDO0 }, +}; + +static void +test_string_to_access_tech (void) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (test_act_data); i++) + g_assert_cmpint (mm_string_to_access_tech (test_act_data[i].str), ==, test_act_data[i].act); +} + +/*****************************************************************************/ + #define TESTCASE(t, d) g_test_create_case (#t, 0, d, NULL, (GTestFixtureFunc) t, NULL) int main (int argc, char **argv) @@ -5111,6 +5134,8 @@ int main (int argc, char **argv) g_test_suite_add (suite, TESTCASE (test_spn_to_utf8, NULL)); g_test_suite_add (suite, TESTCASE (test_mnc_length, NULL)); + g_test_suite_add (suite, TESTCASE (test_string_to_access_tech, NULL)); + result = g_test_run (); reg_test_data_free (reg_data); |