diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2014-11-09 17:21:03 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-11-09 17:58:13 +0100 |
commit | 11c76f35c5cf2cddb83cc954661b09d391650b8a (patch) | |
tree | de8a77461c4f093f5d1c31fc255a907afca03741 | |
parent | 88ac76dc006ee904acd51fd6791366f700ab3036 (diff) | |
download | external_libqmi-11c76f35c5cf2cddb83cc954661b09d391650b8a.zip external_libqmi-11c76f35c5cf2cddb83cc954661b09d391650b8a.tar.gz external_libqmi-11c76f35c5cf2cddb83cc954661b09d391650b8a.tar.bz2 |
libqmi,test: check message builder/parser for "DMS UIM Get PIN Status"
-rw-r--r-- | src/libqmi-glib/test/test-generated.c | 94 |
1 files changed, 93 insertions, 1 deletions
diff --git a/src/libqmi-glib/test/test-generated.c b/src/libqmi-glib/test/test-generated.c index f2941fa..cc27546 100644 --- a/src/libqmi-glib/test/test-generated.c +++ b/src/libqmi-glib/test/test-generated.c @@ -104,6 +104,96 @@ test_generated_dms_get_ids (TestFixture *fixture) } /*****************************************************************************/ +/* DMS UIM Get PIN Status */ + +static void +dms_uim_get_pin_status_ready (QmiClientDms *client, + GAsyncResult *res, + TestFixture *fixture) +{ + QmiMessageDmsUimGetPinStatusOutput *output; + GError *error = NULL; + gboolean st; + QmiDmsUimPinStatus current_status; + guint8 verify_retries_left; + guint8 unblock_retries_left; + + output = qmi_client_dms_uim_get_pin_status_finish (client, res, &error); + g_assert_no_error (error); + g_assert (output); + + st = qmi_message_dms_uim_get_pin_status_output_get_result (output, &error); + g_assert_no_error (error); + g_assert (st); + + /* [/dev/cdc-wdm3] PIN1: + * Status: enabled-not-verified + * Verify: 3 + * Unblock: 10 + * [/dev/cdc-wdm3] PIN2: + * Status: enabled-not-verified + * Verify: 2 + * Unblock: 10 + */ + + st = (qmi_message_dms_uim_get_pin_status_output_get_pin1_status ( + output, + ¤t_status, + &verify_retries_left, + &unblock_retries_left, + &error)); + g_assert_no_error (error); + g_assert (st); + g_assert_cmpuint (current_status, ==, QMI_DMS_UIM_PIN_STATUS_ENABLED_NOT_VERIFIED); + g_assert_cmpuint (verify_retries_left, ==, 3); + g_assert_cmpuint (unblock_retries_left, ==, 10); + + st = (qmi_message_dms_uim_get_pin_status_output_get_pin2_status ( + output, + ¤t_status, + &verify_retries_left, + &unblock_retries_left, + &error)); + g_assert_no_error (error); + g_assert (st); + g_assert_cmpuint (current_status, ==, QMI_DMS_UIM_PIN_STATUS_ENABLED_NOT_VERIFIED); + g_assert_cmpuint (verify_retries_left, ==, 2); + g_assert_cmpuint (unblock_retries_left, ==, 10); + + qmi_message_dms_uim_get_pin_status_output_unref (output); + + test_fixture_loop_stop (fixture); +} + +static void +test_generated_dms_uim_get_pin_status (TestFixture *fixture) +{ + guint8 expected[] = { + 0x01, + 0x0C, 0x00, 0x00, 0x02, 0x01, + 0x00, 0xFF, 0xFF, 0x2B, 0x00, 0x00, 0x00 + }; + guint8 response[] = { + 0x01, + 0x1F, 0x00, 0x80, 0x02, 0x01, + 0x02, 0xFF, 0xFF, 0x2B, 0x00, 0x13, 0x00, 0x02, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x03, + 0x00, 0x01, 0x02, 0x0A, 0x11, 0x03, 0x00, 0x01, + 0x03, 0x0A + }; + + test_port_context_set_command (fixture->ctx, + expected, G_N_ELEMENTS (expected), + response, G_N_ELEMENTS (response), + fixture->service_info[QMI_SERVICE_DMS].transaction_id++); + + qmi_client_dms_uim_get_pin_status (QMI_CLIENT_DMS (fixture->service_info[QMI_SERVICE_DMS].client), NULL, 3, NULL, + (GAsyncReadyCallback) dms_uim_get_pin_status_ready, + fixture); + test_fixture_loop_run (fixture); +} + +/*****************************************************************************/ int main (int argc, char **argv) { @@ -114,7 +204,9 @@ int main (int argc, char **argv) TEST_ADD ("/libqmi-glib/generated/core", test_generated_core); /* DMS */ - TEST_ADD ("/libqmi-glib/generated/dms/get-ids", test_generated_dms_get_ids); + TEST_ADD ("/libqmi-glib/generated/dms/get-ids", test_generated_dms_get_ids); + TEST_ADD ("/libqmi-glib/generated/dms/uim-get-pin-status", test_generated_dms_uim_get_pin_status); + return g_test_run (); } |