---
unit/test-stkutil.c | 534 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 534 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 8e703e5..7574fa1 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -1660,6 +1660,488 @@ static const struct terminal_response_test
display_text_response_data_511b = {
},
};
+#define NO_DURATION { .interval = 0x00, }
+#define NO_TEXT { .text = NULL, .yesno = FALSE, }
+
+static const unsigned char get_inkey_response_111[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x2b,
+};
+
+static const struct terminal_response_test get_inkey_response_data_111 = {
+ .pdu = get_inkey_response_111,
+ .pdu_len = sizeof(get_inkey_response_111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "+",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_121[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x30,
+};
+
+static const struct terminal_response_test get_inkey_response_data_121 = {
+ .pdu = get_inkey_response_121,
+ .pdu_len = sizeof(get_inkey_response_121),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "0",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_131[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x11,
+};
+
+static const struct terminal_response_test get_inkey_response_data_131 = {
+ .pdu = get_inkey_response_131,
+ .pdu_len = sizeof(get_inkey_response_131),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_GO_BACK,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = NO_TEXT,
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_141[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x10,
+};
+
+static const struct terminal_response_test get_inkey_response_data_141 = {
+ .pdu = get_inkey_response_141,
+ .pdu_len = sizeof(get_inkey_response_141),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_USER_TERMINATED,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = NO_TEXT,
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_151[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x71,
+};
+
+static const struct terminal_response_test get_inkey_response_data_151 = {
+ .pdu = get_inkey_response_151,
+ .pdu_len = sizeof(get_inkey_response_151),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x01,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "q",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_161[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x01, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x78,
+};
+
+static const struct terminal_response_test get_inkey_response_data_161 = {
+ .pdu = get_inkey_response_161,
+ .pdu_len = sizeof(get_inkey_response_161),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x01,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "x",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_211[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x12,
+};
+
+static const struct terminal_response_test get_inkey_response_data_211 = {
+ .pdu = get_inkey_response_211,
+ .pdu_len = sizeof(get_inkey_response_211),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_RESPONSE,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = NO_TEXT,
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_411[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x03, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x03, 0x08, 0x04,
+ 0x14,
+};
+
+static const struct terminal_response_test get_inkey_response_data_411 = {
+ .pdu = get_inkey_response_411,
+ .pdu_len = sizeof(get_inkey_response_411),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x03,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "Д",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_511[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x04, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x01,
+};
+
+static const struct terminal_response_test get_inkey_response_data_511 = {
+ .pdu = get_inkey_response_511,
+ .pdu_len = sizeof(get_inkey_response_511),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x04,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "Yes",
+ .packed = FALSE,
+ .yesno = TRUE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_512[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x04, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x00,
+};
+
+static const struct terminal_response_test get_inkey_response_data_512 = {
+ .pdu = get_inkey_response_512,
+ .pdu_len = sizeof(get_inkey_response_512),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x04,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = NULL,
+ .packed = FALSE,
+ .yesno = TRUE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_611b[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x04, 0x8d, 0x02, 0x04, 0x2b,
+};
+
+static const struct terminal_response_test get_inkey_response_data_611b = {
+ .pdu = get_inkey_response_611b,
+ .pdu_len = sizeof(get_inkey_response_611b),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_ICON,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "+",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_711[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x80, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x13,
+};
+
+static const struct terminal_response_test get_inkey_response_data_711 = {
+ .pdu = get_inkey_response_711,
+ .pdu_len = sizeof(get_inkey_response_711),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x80,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_HELP_REQUESTED,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = NO_TEXT,
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_712[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x80, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x2b,
+};
+
+static const struct terminal_response_test get_inkey_response_data_712 = {
+ .pdu = get_inkey_response_712,
+ .pdu_len = sizeof(get_inkey_response_712),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x80,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "+",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_811[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x12, 0x04, 0x02, 0x01, 0x11,
+};
+
+static const struct terminal_response_test get_inkey_response_data_811 = {
+ .pdu = get_inkey_response_811,
+ .pdu_len = sizeof(get_inkey_response_811),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_NO_RESPONSE,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = NO_TEXT,
+ .duration = {
+ .unit = STK_DURATION_TYPE_SECONDS,
+ .interval = 17,
+ },
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_912[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x00, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x02, 0x04, 0x23,
+};
+
+static const struct terminal_response_test get_inkey_response_data_912 = {
+ .pdu = get_inkey_response_912,
+ .pdu_len = sizeof(get_inkey_response_912),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x00,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "#",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_1111[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x03, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x03, 0x08, 0x59,
+ 0x7d,
+};
+
+static const struct terminal_response_test get_inkey_response_data_1111 = {
+ .pdu = get_inkey_response_1111,
+ .pdu_len = sizeof(get_inkey_response_1111),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x03,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "好",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
+static const unsigned char get_inkey_response_1311[] = {
+ 0x81, 0x03, 0x01, 0x22, 0x03, 0x82, 0x02, 0x82,
+ 0x81, 0x83, 0x01, 0x00, 0x8d, 0x03, 0x08, 0x30,
+ 0xeb,
+};
+
+static const struct terminal_response_test get_inkey_response_data_1311 = {
+ .pdu = get_inkey_response_1311,
+ .pdu_len = sizeof(get_inkey_response_1311),
+ .response = {
+ .number = 1,
+ .type = STK_COMMAND_TYPE_GET_INKEY,
+ .qualifier = 0x03,
+ .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+ .dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+ .result = {
+ .type = STK_RESULT_TYPE_SUCCESS,
+ .additional_len = 0,
+ },
+ { .get_inkey = {
+ .text = {
+ .text = "ル",
+ .packed = FALSE,
+ .yesno = FALSE,
+ },
+ .duration = NO_DURATION,
+ }},
+ },
+};
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -1824,6 +2306,58 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Get Inkey 13.1.1",
&get_inkey_data_1311, test_get_inkey);
+ g_test_add_data_func("/teststk/Get Inkey response 1.1.1",
+ &get_inkey_response_data_111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 1.2.1",
+ &get_inkey_response_data_121,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 1.3.1",
+ &get_inkey_response_data_131,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 1.4.1",
+ &get_inkey_response_data_141,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 1.5.1",
+ &get_inkey_response_data_151,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 1.6.1",
+ &get_inkey_response_data_161,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 2.1.1",
+ &get_inkey_response_data_211,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 4.1.1",
+ &get_inkey_response_data_411,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 5.1.1",
+ &get_inkey_response_data_511,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 5.1.2",
+ &get_inkey_response_data_512,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 6.1.1B",
+ &get_inkey_response_data_611b,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 7.1.1",
+ &get_inkey_response_data_711,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 7.1.2",
+ &get_inkey_response_data_712,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 8.1.1",
+ &get_inkey_response_data_811,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 9.1.2",
+ &get_inkey_response_data_912,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 11.1.1",
+ &get_inkey_response_data_1111,
+ test_terminal_response_encoding);
+ g_test_add_data_func("/teststk/Get Inkey response 13.1.1",
+ &get_inkey_response_data_1311,
+ test_terminal_response_encoding);
+
g_test_add_data_func("/teststk/Get Input 1.1.1",
&get_input_data_111, test_get_input);
--
1.6.1