aboutsummaryrefslogtreecommitdiff
path: root/src/tests/test-modem-helpers.c
diff options
context:
space:
mode:
authorCarlo Lobrano <c.lobrano@gmail.com>2016-03-09 11:27:43 +0100
committerAleksander Morgado <aleksander@aleksander.es>2016-03-09 14:43:08 +0100
commitbe317e8b80cd984149ea152c9d00c6bb814e7c88 (patch)
treeb59255b3611d3be0804a0f081e298c967d4b44c5 /src/tests/test-modem-helpers.c
parent7c2d5b1aa358c4edb94203d7de586d489b656576 (diff)
broadband-modem: fix +CPMS empty parameter support
* Add new async virtual method init_current_storages to MMIfaceModemMessaging * Add logic of init_current_storages to MMBroadbandModem * Add step "INIT_CURRENT_STORAGES" in MMIfaceModemMessaging initialization in order to load and store current SMS storages for mem1 and mem2. * Add usage of current sms storage value for mem1 in place of an empty string parameter when the command AT+CPMS is used. https://bugs.freedesktop.org/show_bug.cgi?id=93135
Diffstat (limited to 'src/tests/test-modem-helpers.c')
-rw-r--r--src/tests/test-modem-helpers.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
index db84f016..ddd25af4 100644
--- a/src/tests/test-modem-helpers.c
+++ b/src/tests/test-modem-helpers.c
@@ -2070,6 +2070,40 @@ test_cpms_response_empty_fields (void *f, gpointer d)
g_array_unref (mem3);
}
+typedef struct {
+ const gchar *query;
+ MMSmsStorage mem1_want;
+ MMSmsStorage mem2_want;
+} CpmsQueryTest;
+
+CpmsQueryTest cpms_query_test[] = {
+ {"+CPMS: \"ME\",1,100,\"MT\",5,100,\"TA\",1,100", 2, 3},
+ {"+CPMS: \"SM\",100,100,\"SR\",5,10,\"TA\",1,100", 1, 4},
+ {"+CPMS: \"XX\",100,100,\"BM\",5,10,\"TA\",1,100", 0, 5},
+ {"+CPMS: \"XX\",100,100,\"YY\",5,10,\"TA\",1,100", 0, 0},
+ {NULL, 0, 0}
+};
+
+static void
+test_cpms_query_response (void *f, gpointer d) {
+ MMSmsStorage mem1;
+ MMSmsStorage mem2;
+ gboolean ret;
+ GError *error = NULL;
+ int i;
+
+ for (i = 0; cpms_query_test[i].query != NULL; i++){
+ ret = mm_3gpp_parse_cpms_query_response (cpms_query_test[i].query,
+ &mem1,
+ &mem2,
+ &error);
+ g_assert(ret);
+ g_assert_no_error (error);
+ g_assert_cmpuint (cpms_query_test[i].mem1_want, ==, mem1);
+ g_assert_cmpuint (cpms_query_test[i].mem2_want, ==, mem2);
+ }
+}
+
/*****************************************************************************/
/* Test CNUM responses */
@@ -2821,6 +2855,7 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_cpms_response_mixed, NULL));
g_test_suite_add (suite, TESTCASE (test_cpms_response_mixed_spaces, NULL));
g_test_suite_add (suite, TESTCASE (test_cpms_response_empty_fields, NULL));
+ g_test_suite_add (suite, TESTCASE (test_cpms_query_response, NULL));
g_test_suite_add (suite, TESTCASE (test_cgdcont_test_response_single, NULL));
g_test_suite_add (suite, TESTCASE (test_cgdcont_test_response_multiple, NULL));