aboutsummaryrefslogtreecommitdiff
path: root/plugins/altair/tests
diff options
context:
space:
mode:
authorPrathmesh Prabhu <pprabhu@chromium.org>2013-10-09 10:06:27 -0700
committerAleksander Morgado <aleksander@lanedo.com>2013-10-10 08:29:56 +0200
commit09ea458f78f417df0b5e7ff86dafc1b5ab326d5a (patch)
tree32ed29e24e1e117ee833d8f2e10a08faccd45e60 /plugins/altair/tests
parent92a2953e938e7687d8f2a534b38b26647517c99a (diff)
altair-lte: obtain subscription state of SIM from registration failure code
This patch uses the extended error code after a registration failure to determine if the SIM in the relevant modem is associated with a non-provisioned account. It uses the standard AT+CEER command, but the implementation is restricted to the altair plugin.
Diffstat (limited to 'plugins/altair/tests')
-rw-r--r--plugins/altair/tests/test-modem-helpers-altair-lte.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/plugins/altair/tests/test-modem-helpers-altair-lte.c b/plugins/altair/tests/test-modem-helpers-altair-lte.c
new file mode 100644
index 00000000..665b928f
--- /dev/null
+++ b/plugins/altair/tests/test-modem-helpers-altair-lte.c
@@ -0,0 +1,75 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details:
+ *
+ * Copyright (C) 2013 Google Inc.
+ *
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <locale.h>
+
+#include "mm-modem-helpers-altair-lte.h"
+
+/*****************************************************************************/
+/* Test +CEER responses */
+
+typedef struct {
+ const gchar *str;
+ const gchar *result;
+} CeerTest;
+
+static const CeerTest ceer_tests[] = {
+ { "", "" }, /* Special case, sometimes the response is empty, treat it as a valid response. */
+ { "+CEER:", "" },
+ { "+CEER: EPS_AND_NON_EPS_SERVICES_NOT_ALLOWED", "EPS_AND_NON_EPS_SERVICES_NOT_ALLOWED" },
+ { "+CEER: NO_SUITABLE_CELLS_IN_TRACKING_AREA", "NO_SUITABLE_CELLS_IN_TRACKING_AREA" },
+ { "WRONG RESPONSE", NULL },
+ { NULL, NULL }
+};
+
+static void
+test_ceer (void)
+{
+ guint i;
+
+ for (i = 0; ceer_tests[i].str; ++i) {
+ GError *error = NULL;
+ gchar *result;
+
+ result = mm_altair_parse_ceer_response (ceer_tests[i].str, &error);
+ if (ceer_tests[i].result) {
+ g_assert_cmpstr (ceer_tests[i].result, ==, result);
+ g_assert_no_error (error);
+ g_free (result);
+ }
+ else {
+ g_assert (result == NULL);
+ g_assert (error != NULL);
+ g_error_free (error);
+ }
+ }
+}
+
+int main (int argc, char **argv)
+{
+ setlocale (LC_ALL, "");
+
+ g_type_init ();
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/MM/altair/ceer", test_ceer);
+
+ return g_test_run ();
+}