| 1 |
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 3 |
/* |
| 4 |
* Copyright (C) 2013 - 2014 Aleksander Morgado <[email protected]> |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <config.h> |
| 8 |
|
| 9 |
#include "mbim-cid.h" |
| 10 |
|
| 11 |
static void |
| 12 |
test_common (MbimService service, |
| 13 |
guint cid, |
| 14 |
gboolean can_set, |
| 15 |
gboolean can_query, |
| 16 |
gboolean can_notify) |
| 17 |
{ |
| 18 |
g_assert (mbim_cid_can_set (service, cid) == can_set); |
| 19 |
g_assert (mbim_cid_can_query (service, cid) == can_query); |
| 20 |
g_assert (mbim_cid_can_notify (service, cid) == can_notify); |
| 21 |
} |
| 22 |
|
| 23 |
static void |
| 24 |
test_cid_basic_connect (void) |
| 25 |
{ |
| 26 |
test_common (MBIM_SERVICE_BASIC_CONNECT, |
| 27 |
MBIM_CID_BASIC_CONNECT_DEVICE_CAPS, |
| 28 |
FALSE, TRUE, FALSE); |
| 29 |
|
| 30 |
test_common (MBIM_SERVICE_BASIC_CONNECT, |
| 31 |
MBIM_CID_BASIC_CONNECT_MULTICARRIER_PROVIDERS, |
| 32 |
TRUE, TRUE, TRUE); |
| 33 |
} |
| 34 |
|
| 35 |
static void |
| 36 |
test_cid_sms (void) |
| 37 |
{ |
| 38 |
test_common (MBIM_SERVICE_SMS, |
| 39 |
MBIM_CID_SMS_CONFIGURATION, |
| 40 |
TRUE, TRUE, TRUE); |
| 41 |
|
| 42 |
test_common (MBIM_SERVICE_SMS, |
| 43 |
MBIM_CID_SMS_MESSAGE_STORE_STATUS, |
| 44 |
FALSE, TRUE, TRUE); |
| 45 |
} |
| 46 |
|
| 47 |
static void |
| 48 |
test_cid_ussd (void) |
| 49 |
{ |
| 50 |
test_common (MBIM_SERVICE_USSD, |
| 51 |
MBIM_CID_USSD, |
| 52 |
TRUE, FALSE, TRUE); |
| 53 |
} |
| 54 |
|
| 55 |
static void |
| 56 |
test_cid_phonebook (void) |
| 57 |
{ |
| 58 |
test_common (MBIM_SERVICE_PHONEBOOK, |
| 59 |
MBIM_CID_PHONEBOOK_CONFIGURATION, |
| 60 |
FALSE, TRUE, TRUE); |
| 61 |
|
| 62 |
test_common (MBIM_SERVICE_PHONEBOOK, |
| 63 |
MBIM_CID_PHONEBOOK_WRITE, |
| 64 |
TRUE, FALSE, FALSE); |
| 65 |
} |
| 66 |
|
| 67 |
static void |
| 68 |
test_cid_stk (void) |
| 69 |
{ |
| 70 |
test_common (MBIM_SERVICE_STK, |
| 71 |
MBIM_CID_STK_PAC, |
| 72 |
TRUE, TRUE, TRUE); |
| 73 |
|
| 74 |
test_common (MBIM_SERVICE_STK, |
| 75 |
MBIM_CID_STK_ENVELOPE, |
| 76 |
TRUE, TRUE, FALSE); |
| 77 |
} |
| 78 |
|
| 79 |
static void |
| 80 |
test_cid_auth (void) |
| 81 |
{ |
| 82 |
test_common (MBIM_SERVICE_AUTH, |
| 83 |
MBIM_CID_AUTH_AKA, |
| 84 |
FALSE, TRUE, FALSE); |
| 85 |
|
| 86 |
test_common (MBIM_SERVICE_AUTH, |
| 87 |
MBIM_CID_AUTH_SIM, |
| 88 |
FALSE, TRUE, FALSE); |
| 89 |
} |
| 90 |
|
| 91 |
static void |
| 92 |
test_cid_dss (void) |
| 93 |
{ |
| 94 |
test_common (MBIM_SERVICE_DSS, |
| 95 |
MBIM_CID_DSS_CONNECT, |
| 96 |
TRUE, FALSE, FALSE); |
| 97 |
} |
| 98 |
|
| 99 |
static void |
| 100 |
test_cid_ms_firmware_id (void) |
| 101 |
{ |
| 102 |
test_common (MBIM_SERVICE_MS_FIRMWARE_ID, |
| 103 |
MBIM_CID_MS_FIRMWARE_ID_GET, |
| 104 |
FALSE, TRUE, FALSE); |
| 105 |
} |
| 106 |
|
| 107 |
static void |
| 108 |
test_cid_ms_host_shutdown (void) |
| 109 |
{ |
| 110 |
test_common (MBIM_SERVICE_MS_HOST_SHUTDOWN, |
| 111 |
MBIM_CID_MS_HOST_SHUTDOWN_NOTIFY, |
| 112 |
TRUE, FALSE, FALSE); |
| 113 |
} |
| 114 |
|
| 115 |
static void |
| 116 |
test_cid_ms_sar (void) |
| 117 |
{ |
| 118 |
test_common (MBIM_SERVICE_MS_SAR, |
| 119 |
MBIM_CID_MS_SAR_CONFIG, |
| 120 |
TRUE, TRUE, TRUE); |
| 121 |
} |
| 122 |
|
| 123 |
int main (int argc, char **argv) |
| 124 |
{ |
| 125 |
g_test_init (&argc, &argv, NULL); |
| 126 |
|
| 127 |
g_test_add_func ("/libmbim-glib/cid/basic-connect", test_cid_basic_connect); |
| 128 |
g_test_add_func ("/libmbim-glib/cid/sms", test_cid_sms); |
| 129 |
g_test_add_func ("/libmbim-glib/cid/ussd", test_cid_ussd); |
| 130 |
g_test_add_func ("/libmbim-glib/cid/phonebook", test_cid_phonebook); |
| 131 |
g_test_add_func ("/libmbim-glib/cid/stk", test_cid_stk); |
| 132 |
g_test_add_func ("/libmbim-glib/cid/auth", test_cid_auth); |
| 133 |
g_test_add_func ("/libmbim-glib/cid/dss", test_cid_dss); |
| 134 |
g_test_add_func ("/libmbim-glib/cid/ms-firmware-id", test_cid_ms_firmware_id); |
| 135 |
g_test_add_func ("/libmbim-glib/cid/ms-host-shutdown", test_cid_ms_host_shutdown); |
| 136 |
g_test_add_func ("/libmbim-glib/cid/ms-sar", test_cid_ms_sar); |
| 137 |
|
| 138 |
return g_test_run (); |
| 139 |
} |