diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c index 427d7a29..82f2a1ca 100644 --- a/unit/test-stkutil.c +++ b/unit/test-stkutil.c @@ -345,6 +345,941 @@ static void test_display_text(gconstpointer data) stk_command_free(command); } +struct get_inkey_test { + const unsigned char *pdu; + unsigned int pdu_len; + unsigned char qualifier; + char *text; + struct stk_icon_id icon_id; + struct stk_duration duration; + struct stk_text_attribute text_attr; + struct stk_frame_id frame_id; +}; + +static unsigned char get_inkey_111[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22 }; + +static unsigned char get_inkey_121[] = { 0xD0, 0x14, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x09, 0x00, 0x45, 0x37, + 0xBD, 0x2C, 0x07, 0x89, 0x60, + 0x22 }; + +static unsigned char get_inkey_131[] = { 0xD0, 0x1A, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0F, 0x04, 0x3C, 0x47, + 0x4F, 0x2D, 0x42, 0x41, 0x43, + 0x4B, 0x57, 0x41, 0x52, 0x44, + 0x53, 0x3E }; + +static unsigned char get_inkey_141[] = { 0xD0, 0x13, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x08, 0x04, 0x3C, 0x41, + 0x42, 0x4F, 0x52, 0x54, 0x3E }; + +static unsigned char get_inkey_151[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x01, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x71, 0x22 }; + +static unsigned char get_inkey_161[] = { 0xD0, 0x81, 0xAD, 0x81, 0x03, 0x01, + 0x22, 0x01, 0x82, 0x02, 0x81, + 0x82, 0x8D, 0x81, 0xA1, 0x04, + 0x45, 0x6E, 0x74, 0x65, 0x72, + 0x20, 0x22, 0x78, 0x22, 0x2E, + 0x20, 0x54, 0x68, 0x69, 0x73, + 0x20, 0x63, 0x6F, 0x6D, 0x6D, + 0x61, 0x6E, 0x64, 0x20, 0x69, + 0x6E, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x73, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x4D, 0x45, + 0x20, 0x74, 0x6F, 0x20, 0x64, + 0x69, 0x73, 0x70, 0x6C, 0x61, + 0x79, 0x20, 0x74, 0x65, 0x78, + 0x74, 0x2C, 0x20, 0x61, 0x6E, + 0x64, 0x20, 0x74, 0x6F, 0x20, + 0x65, 0x78, 0x70, 0x65, 0x63, + 0x74, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x75, 0x73, 0x65, 0x72, + 0x20, 0x74, 0x6F, 0x20, 0x65, + 0x6E, 0x74, 0x65, 0x72, 0x20, + 0x61, 0x20, 0x73, 0x69, 0x6E, + 0x67, 0x6C, 0x65, 0x20, 0x63, + 0x68, 0x61, 0x72, 0x61, 0x63, + 0x74, 0x65, 0x72, 0x2E, 0x20, + 0x41, 0x6E, 0x79, 0x20, 0x72, + 0x65, 0x73, 0x70, 0x6F, 0x6E, + 0x73, 0x65, 0x20, 0x65, 0x6E, + 0x74, 0x65, 0x72, 0x65, 0x64, + 0x20, 0x62, 0x79, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x75, 0x73, + 0x65, 0x72, 0x20, 0x73, 0x68, + 0x61, 0x6C, 0x6C, 0x20, 0x62, + 0x65, 0x20, 0x70, 0x61, 0x73, + 0x73, 0x65, 0x64, 0x20, 0x74 }; + +static unsigned char get_inkey_211[] = { 0xD0, 0x16, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0B, 0x04, 0x3C, 0x54, + 0x49, 0x4D, 0x45, 0x2D, 0x4F, + 0x55, 0x54, 0x3E }; + +static unsigned char get_inkey_311[] = { 0xD0, 0x24, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x19, 0x08, 0x04, 0x17, + 0x04, 0x14, 0x04, 0x20, 0x04, + 0x10, 0x04, 0x12, 0x04, 0x21, + 0x04, 0x22, 0x04, 0x12, 0x04, + 0x23, 0x04, 0x19, 0x04, 0x22, + 0x04, 0x15 }; + +static unsigned char get_inkey_321[] = { 0xD0, 0x81, 0x99, 0x81, 0x03, 0x01, + 0x22, 0x00, 0x82, 0x02, 0x81, + 0x82, 0x8D, 0x81, 0x8D, 0x08, + 0x04, 0x17, 0x04, 0x14, 0x04, + 0x20, 0x04, 0x10, 0x04, 0x12, + 0x04, 0x21, 0x04, 0x22, 0x04, + 0x12, 0x04, 0x23, 0x04, 0x19, + 0x04, 0x22, 0x04, 0x15, 0x04, + 0x17, 0x04, 0x14, 0x04, 0x20, + 0x04, 0x10, 0x04, 0x12, 0x04, + 0x21, 0x04, 0x22, 0x04, 0x12, + 0x04, 0x23, 0x04, 0x19, 0x04, + 0x22, 0x04, 0x15, 0x04, 0x17, + 0x04, 0x14, 0x04, 0x20, 0x04, + 0x10, 0x04, 0x12, 0x04, 0x21, + 0x04, 0x22, 0x04, 0x12, 0x04, + 0x23, 0x04, 0x19, 0x04, 0x22, + 0x04, 0x15, 0x04, 0x17, 0x04, + 0x14, 0x04, 0x20, 0x04, 0x10, + 0x04, 0x12, 0x04, 0x21, 0x04, + 0x22, 0x04, 0x12, 0x04, 0x23, + 0x04, 0x19, 0x04, 0x22, 0x04, + 0x15, 0x04, 0x17, 0x04, 0x14, + 0x04, 0x20, 0x04, 0x10, 0x04, + 0x12, 0x04, 0x21, 0x04, 0x22, + 0x04, 0x12, 0x04, 0x23, 0x04, + 0x19, 0x04, 0x22, 0x04, 0x15, + 0x04, 0x17, 0x04, 0x14, 0x04, + 0x20, 0x04, 0x10, 0x04, 0x12, + 0x04, 0x21, 0x04, 0x22, 0x04, + 0x12, 0x04, 0x23, 0x04, 0x19 }; + +static unsigned char get_inkey_411[] = { 0xD0, 0x11, 0x81, 0x03, 0x01, 0x22, + 0x03, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x06, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72 }; + +static unsigned char get_inkey_511[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x04, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x59, + 0x45, 0x53 }; + +static unsigned char get_inkey_512[] = { 0xD0, 0x14, 0x81, 0x03, 0x01, 0x22, + 0x04, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x09, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x4E, + 0x4F }; + +static unsigned char get_inkey_611[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x3C, 0x4E, + 0x4F, 0x2D, 0x49, 0x43, 0x4F, + 0x4E, 0x3E, 0x1E, 0x02, 0x00, + 0x01 }; + +static unsigned char get_inkey_621[] = { 0xD0, 0x1C, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0D, 0x04, 0x3C, 0x42, + 0x41, 0x53, 0x49, 0x43, 0x2D, + 0x49, 0x43, 0x4F, 0x4E, 0x3E, + 0x1E, 0x02, 0x01, 0x01 }; + +static unsigned char get_inkey_631[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x3C, 0x4E, + 0x4F, 0x2D, 0x49, 0x43, 0x4F, + 0x4E, 0x3E, 0x1E, 0x02, 0x00, + 0x02 }; + +static unsigned char get_inkey_641[] = { 0xD0, 0x1D, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0E, 0x04, 0x3C, 0x43, + 0x4F, 0x4C, 0x4F, 0x55, 0x52, + 0x2D, 0x49, 0x43, 0x4F, 0x4E, + 0x3E, 0x1E, 0x02, 0x01, 0x02 }; + +static unsigned char get_inkey_711[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x80, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22 }; + +static unsigned char get_inkey_712[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x80, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22 }; + +static unsigned char get_inkey_811[] = { 0xD0, 0x19, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0x84, 0x02, 0x01, + 0x0A }; + +static unsigned char get_inkey_911[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_912[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_921[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x01, 0xB4 }; + +static unsigned char get_inkey_922[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_931[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x02, 0xB4 }; + +static unsigned char get_inkey_932[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_941[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x04, 0xB4 }; + +static unsigned char get_inkey_942[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_943[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_951[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x08, 0xB4 }; + +static unsigned char get_inkey_952[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_953[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_961[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x10, 0xB4 }; + +static unsigned char get_inkey_962[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_963[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_971[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x20, 0xB4 }; + +static unsigned char get_inkey_972[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_973[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_981[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x40, 0xB4 }; + +static unsigned char get_inkey_982[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_983[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_991[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x80, 0xB4 }; + +static unsigned char get_inkey_992a[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_992b[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_993[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_9101[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x2B, 0x22, 0xD0, 0x04, 0x00, + 0x09, 0x00, 0xB4 }; + +static unsigned char get_inkey_9102[] = { 0xD0, 0x15, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x0A, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72, 0x20, 0x22, + 0x23, 0x22 }; + +static unsigned char get_inkey_1011[] = { 0xD0, 0x10, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x05, 0x08, 0x4F, 0x60, + 0x59, 0x7D }; + +static unsigned char get_inkey_1021[] = { 0xD0, 0x81, 0x99, 0x81, 0x03, 0x01, + 0x22, 0x00, 0x82, 0x02, 0x81, + 0x82, 0x8D, 0x81, 0x8D, 0x08, + 0x4F, 0x60, 0x59, 0x7D, 0x4F, + 0x60, 0x59, 0x7D, 0x4F, 0x60, + 0x59, 0x7D, 0x4F, 0x60, 0x59, + 0x7D, 0x4F, 0x60, 0x59, 0x7D, + 0x4F, 0x60, 0x59, 0x7D, 0x4F, + 0x60, 0x59, 0x7D, 0x4F, 0x60, + 0x59, 0x7D, 0x4F, 0x60, 0x59, + 0x7D, 0x4F, 0x60, 0x59, 0x7D, + 0x4F, 0x60, 0x59, 0x7D, 0x4F, + 0x60, 0x59, 0x7D, 0x4F, 0x60, + 0x59, 0x7D, 0x4F, 0x60, 0x59, + 0x7D, 0x4F, 0x60, 0x59, 0x7D, + 0x4F, 0x60, 0x59, 0x7D, 0x4F, + 0x60, 0x59, 0x7D, 0x4F, 0x60, + 0x59, 0x7D, 0x4F, 0x60, 0x59, + 0x7D, 0x4F, 0x60, 0x59, 0x7D, + 0x4F, 0x60, 0x59, 0x7D, 0x4F, + 0x60, 0x59, 0x7D, 0x4F, 0x60, + 0x59, 0x7D, 0x4F, 0x60, 0x59, + 0x7D, 0x4F, 0x60, 0x59, 0x7D, + 0x4F, 0x60, 0x59, 0x7D, 0x4F, + 0x60, 0x59, 0x7D, 0x4F, 0x60, + 0x59, 0x7D, 0x4F, 0x60, 0x59, + 0x7D, 0x4F, 0x60, 0x59, 0x7D, + 0x4F, 0x60, 0x59, 0x7D, 0x4F, + 0x60, 0x59, 0x7D, 0x4F, 0x60, + 0x59, 0x7D, 0x4F, 0x60, 0x59, + 0x7D, 0x4F, 0x60, 0x59, 0x7D }; + +static unsigned char get_inkey_1111[] = { 0xD0, 0x11, 0x81, 0x03, 0x01, 0x22, + 0x03, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x06, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72 }; + +static unsigned char get_inkey_1211[] = { 0xD0, 0x0E, 0x81, 0x03, 0x01, 0x22, + 0x00, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x03, 0x08, 0x30, 0xEB }; + +static unsigned char get_inkey_1221[] = { 0xD0, 0x81, 0x99, 0x81, 0x03, 0x01, + 0x22, 0x00, 0x82, 0x02, 0x81, + 0x82, 0x8D, 0x81, 0x8D, 0x08, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB, + 0x30, 0xEB, 0x30, 0xEB, 0x30, + 0xEB, 0x30, 0xEB, 0x30, 0xEB }; + +static unsigned char get_inkey_1311[] = { 0xD0, 0x11, 0x81, 0x03, 0x01, 0x22, + 0x03, 0x82, 0x02, 0x81, 0x82, + 0x8D, 0x06, 0x04, 0x45, 0x6E, + 0x74, 0x65, 0x72 }; + +static struct get_inkey_test get_inkey_data_111 = { + .pdu = get_inkey_111, + .pdu_len = sizeof(get_inkey_111), + .qualifier = 0x00, + .text = "Enter \"+\"" +}; + +static struct get_inkey_test get_inkey_data_121 = { + .pdu = get_inkey_121, + .pdu_len = sizeof(get_inkey_121), + .qualifier = 0x00, + .text = "Enter \"0\"" +}; + +static struct get_inkey_test get_inkey_data_131 = { + .pdu = get_inkey_131, + .pdu_len = sizeof(get_inkey_131), + .qualifier = 0x00, + .text = "" +}; + +static struct get_inkey_test get_inkey_data_141 = { + .pdu = get_inkey_141, + .pdu_len = sizeof(get_inkey_141), + .qualifier = 0x00, + .text = "" +}; + +static struct get_inkey_test get_inkey_data_151 = { + .pdu = get_inkey_151, + .pdu_len = sizeof(get_inkey_151), + .qualifier = 0x01, + .text = "Enter \"q\"" +}; + +static struct get_inkey_test get_inkey_data_161 = { + .pdu = get_inkey_161, + .pdu_len = sizeof(get_inkey_161), + .qualifier = 0x01, + .text = "Enter \"x\". This command instructs the ME to display text, " + "and to expect the user to enter a single character. Any " + "response entered by the user shall be passed t" +}; + +static struct get_inkey_test get_inkey_data_211 = { + .pdu = get_inkey_211, + .pdu_len = sizeof(get_inkey_211), + .qualifier = 0x00, + .text = "" +}; + +static struct get_inkey_test get_inkey_data_311 = { + .pdu = get_inkey_311, + .pdu_len = sizeof(get_inkey_311), + .qualifier = 0x00, + .text = "ЗДРАВСТВУЙТЕ" +}; + +static struct get_inkey_test get_inkey_data_321 = { + .pdu = get_inkey_321, + .pdu_len = sizeof(get_inkey_321), + .qualifier = 0x00, + .text = "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" + "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ" + "ЗДРАВСТВУЙТЕЗДРАВСТВУЙ" +}; + +static struct get_inkey_test get_inkey_data_411 = { + .pdu = get_inkey_411, + .pdu_len = sizeof(get_inkey_411), + .qualifier = 0x03, + .text = "Enter" +}; + +static struct get_inkey_test get_inkey_data_511 = { + .pdu = get_inkey_511, + .pdu_len = sizeof(get_inkey_511), + .qualifier = 0x04, + .text = "Enter YES" +}; + +static struct get_inkey_test get_inkey_data_512 = { + .pdu = get_inkey_512, + .pdu_len = sizeof(get_inkey_512), + .qualifier = 0x04, + .text = "Enter NO" +}; + +static struct get_inkey_test get_inkey_data_611 = { + .pdu = get_inkey_611, + .pdu_len = sizeof(get_inkey_611), + .qualifier = 0x00, + .text = "", + .icon_id = { + .qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY, + .id = 0x01 + } +}; + +static struct get_inkey_test get_inkey_data_621 = { + .pdu = get_inkey_621, + .pdu_len = sizeof(get_inkey_621), + .qualifier = 0x00, + .text = "", + .icon_id = { + .qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY, + .id = 0x01 + } +}; + +static struct get_inkey_test get_inkey_data_631 = { + .pdu = get_inkey_631, + .pdu_len = sizeof(get_inkey_631), + .qualifier = 0x00, + .text = "", + .icon_id = { + .qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY, + .id = 0x02 + } +}; + +static struct get_inkey_test get_inkey_data_641 = { + .pdu = get_inkey_641, + .pdu_len = sizeof(get_inkey_641), + .qualifier = 0x00, + .text = "", + .icon_id = { + .qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY, + .id = 0x02 + } +}; + +static struct get_inkey_test get_inkey_data_711 = { + .pdu = get_inkey_711, + .pdu_len = sizeof(get_inkey_711), + .qualifier = 0x80, + .text = "Enter \"+\"" +}; + +static struct get_inkey_test get_inkey_data_712 = { + .pdu = get_inkey_712, + .pdu_len = sizeof(get_inkey_712), + .qualifier = 0x80, + .text = "Enter \"+\"" +}; + +static struct get_inkey_test get_inkey_data_811 = { + .pdu = get_inkey_811, + .pdu_len = sizeof(get_inkey_811), + .qualifier = 0x00, + .text = "Enter \"+\"", + .duration = { + .unit = STK_DURATION_TYPE_SECONDS, + .interval = 10 + } +}; + +static struct get_inkey_test get_inkey_data_911 = { + .pdu = get_inkey_911, + .pdu_len = sizeof(get_inkey_911), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_912 = { + .pdu = get_inkey_912, + .pdu_len = sizeof(get_inkey_912), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_921 = { + .pdu = get_inkey_921, + .pdu_len = sizeof(get_inkey_921), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x01, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_922 = { + .pdu = get_inkey_922, + .pdu_len = sizeof(get_inkey_922), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_931 = { + .pdu = get_inkey_931, + .pdu_len = sizeof(get_inkey_931), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x02, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_932 = { + .pdu = get_inkey_932, + .pdu_len = sizeof(get_inkey_932), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_941 = { + .pdu = get_inkey_941, + .pdu_len = sizeof(get_inkey_941), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x04, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_942 = { + .pdu = get_inkey_942, + .pdu_len = sizeof(get_inkey_942), + .qualifier = 0x00, + .text = "Enter \"#\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_943 = { + .pdu = get_inkey_943, + .pdu_len = sizeof(get_inkey_943), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_951 = { + .pdu = get_inkey_951, + .pdu_len = sizeof(get_inkey_951), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x08, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_952 = { + .pdu = get_inkey_952, + .pdu_len = sizeof(get_inkey_952), + .qualifier = 0x00, + .text = "Enter \"#\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_953 = { + .pdu = get_inkey_953, + .pdu_len = sizeof(get_inkey_953), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_961 = { + .pdu = get_inkey_961, + .pdu_len = sizeof(get_inkey_961), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x10, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_962 = { + .pdu = get_inkey_962, + .pdu_len = sizeof(get_inkey_962), + .qualifier = 0x00, + .text = "Enter \"#\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_963 = { + .pdu = get_inkey_963, + .pdu_len = sizeof(get_inkey_963), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_971 = { + .pdu = get_inkey_971, + .pdu_len = sizeof(get_inkey_971), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x20, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_972 = { + .pdu = get_inkey_972, + .pdu_len = sizeof(get_inkey_972), + .qualifier = 0x00, + .text = "Enter \"#\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_973 = { + .pdu = get_inkey_973, + .pdu_len = sizeof(get_inkey_973), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_981 = { + .pdu = get_inkey_981, + .pdu_len = sizeof(get_inkey_981), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x40, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_982 = { + .pdu = get_inkey_982, + .pdu_len = sizeof(get_inkey_982), + .qualifier = 0x00, + .text = "Enter \"#\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_983 = { + .pdu = get_inkey_983, + .pdu_len = sizeof(get_inkey_983), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_991 = { + .pdu = get_inkey_991, + .pdu_len = sizeof(get_inkey_991), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x80, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_992a = { + .pdu = get_inkey_992a, + .pdu_len = sizeof(get_inkey_992a), + .qualifier = 0x00, + .text = "Enter \"#\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_992b = { + .pdu = get_inkey_992b, + .pdu_len = sizeof(get_inkey_992b), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_993 = { + .pdu = get_inkey_993, + .pdu_len = sizeof(get_inkey_993), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_9101 = { + .pdu = get_inkey_9101, + .pdu_len = sizeof(get_inkey_9101), + .qualifier = 0x00, + .text = "Enter \"+\"", + .text_attr = { + .len = 4, + .attributes = { 0x00, 0x09, 0x00, 0xB4 } + } +}; + +static struct get_inkey_test get_inkey_data_9102 = { + .pdu = get_inkey_9102, + .pdu_len = sizeof(get_inkey_9102), + .qualifier = 0x00, + .text = "Enter \"#\"" +}; + +static struct get_inkey_test get_inkey_data_1011 = { + .pdu = get_inkey_1011, + .pdu_len = sizeof(get_inkey_1011), + .qualifier = 0x00, + .text = "你好" +}; + +static struct get_inkey_test get_inkey_data_1021 = { + .pdu = get_inkey_1021, + .pdu_len = sizeof(get_inkey_1021), + .qualifier = 0x00, + .text = "你好你好你好你好你好你好你好你好你好你好" + "你好你好你好你好你好你好你好你好你好你好" + "你好你好你好你好你好你好你好你好你好你好" + "你好你好你好你好你好" +}; + +static struct get_inkey_test get_inkey_data_1111 = { + .pdu = get_inkey_1111, + .pdu_len = sizeof(get_inkey_1111), + .qualifier = 0x03, + .text = "Enter" +}; + +static struct get_inkey_test get_inkey_data_1211 = { + .pdu = get_inkey_1211, + .pdu_len = sizeof(get_inkey_1211), + .qualifier = 0x00, + .text = "ル" +}; + +static struct get_inkey_test get_inkey_data_1221 = { + .pdu = get_inkey_1221, + .pdu_len = sizeof(get_inkey_1221), + .qualifier = 0x00, + .text = "ルルルルルルルルルルルルルルルルルルルル" + "ルルルルルルルルルルルルルルルルルルルル" + "ルルルルルルルルルルルルルルルルルルルル" + "ルルルルルルルルルル" +}; + +static struct get_inkey_test get_inkey_data_1311 = { + .pdu = get_inkey_1311, + .pdu_len = sizeof(get_inkey_1311), + .qualifier = 0x03, + .text = "Enter" +}; + +/* Defined in TS 102.384 Section 27.22.4.2 */ +static void test_get_inkey(gconstpointer data) +{ + const struct get_inkey_test *test = data; + struct stk_command *command; + + command = stk_command_new_from_pdu(test->pdu, test->pdu_len); + + g_assert(command); + + g_assert(command->number == 1); + g_assert(command->type == STK_COMMAND_TYPE_GET_INKEY); + g_assert(command->qualifier == test->qualifier); + + g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC); + g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL); + + g_assert(command->get_inkey.text); + check_text(command->get_inkey.text, test->text); + check_icon_id(&command->get_inkey.icon_id, &test->icon_id); + check_duration(&command->get_inkey.duration, &test->duration); + check_text_attr(&command->get_inkey.text_attr, + &test->text_attr); + check_frame_id(&command->get_inkey.frame_id, &test->frame_id); + + stk_command_free(command); +} + struct get_input_test { const unsigned char *pdu; unsigned int pdu_len; @@ -548,6 +1483,111 @@ int main(int argc, char **argv) g_test_add_data_func("/teststk/Display Text 10.1.1", &display_text_data_1011, test_display_text); + g_test_add_data_func("/teststk/Get Inkey 1.1.1", + &get_inkey_data_111, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 1.2.1", + &get_inkey_data_121, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 1.3.1", + &get_inkey_data_131, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 1.4.1", + &get_inkey_data_141, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 1.5.1", + &get_inkey_data_151, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 1.6.1", + &get_inkey_data_161, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 2.1.1", + &get_inkey_data_211, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 3.1.1", + &get_inkey_data_311, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 3.2.1", + &get_inkey_data_321, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 4.1.1", + &get_inkey_data_411, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 5.1.1", + &get_inkey_data_511, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 5.1.2", + &get_inkey_data_512, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 6.1.1", + &get_inkey_data_611, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 6.2.1", + &get_inkey_data_621, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 6.3.1", + &get_inkey_data_631, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 6.4.1", + &get_inkey_data_641, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 7.1.1", + &get_inkey_data_711, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 7.1.2", + &get_inkey_data_712, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 8.1.1", + &get_inkey_data_811, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.1.1", + &get_inkey_data_911, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.1.2", + &get_inkey_data_912, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.2.1", + &get_inkey_data_921, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.2.2", + &get_inkey_data_922, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.3.1", + &get_inkey_data_931, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.3.2", + &get_inkey_data_932, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.4.1", + &get_inkey_data_941, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.4.2", + &get_inkey_data_942, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.4.3", + &get_inkey_data_943, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.5.1", + &get_inkey_data_951, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.5.2", + &get_inkey_data_952, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.5.3", + &get_inkey_data_953, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.6.1", + &get_inkey_data_961, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.6.2", + &get_inkey_data_962, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.6.3", + &get_inkey_data_963, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.7.1", + &get_inkey_data_971, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.7.2", + &get_inkey_data_972, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.7.3", + &get_inkey_data_973, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.8.1", + &get_inkey_data_981, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.8.2", + &get_inkey_data_982, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.8.3", + &get_inkey_data_983, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.9.1", + &get_inkey_data_991, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.9.2a", + &get_inkey_data_992a, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.9.2b", + &get_inkey_data_992b, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.9.3", + &get_inkey_data_993, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.10.1", + &get_inkey_data_9101, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 9.10.2", + &get_inkey_data_9102, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 10.1.1", + &get_inkey_data_1011, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 10.2.1", + &get_inkey_data_1021, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 11.1.1", + &get_inkey_data_1111, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 12.1.1", + &get_inkey_data_1211, test_get_inkey); + g_test_add_data_func("/teststk/Get Inkey 12.2.1", + &get_inkey_data_1221, test_get_inkey); + 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 Input 1.1.1", &get_input_data_111, test_get_input);