test-stk: Add test for run at command parser
authorYang Gu <yang.gu@intel.com>
Wed, 19 May 2010 10:24:42 +0000 (18:24 +0800)
committerDenis Kenzior <denkenz@gmail.com>
Tue, 25 May 2010 22:28:55 +0000 (17:28 -0500)
unit/test-stkutil.c

index 0c045bb..9c5b7ae 100644 (file)
@@ -286,6 +286,12 @@ static inline void check_timer_value(const struct stk_timer_value *command,
        g_assert(command->second == test->second);
 }
 
+/* Defined in TS 102.223 Section 8.40 */
+static inline void check_at_command(const char *command, const char *test)
+{
+       check_common_text(command, test);
+}
+
 /* Defined in TS 102.223 Section 8.43 */
 static inline void check_imm_resp(const unsigned char command,
                                        const unsigned char test)
@@ -10717,6 +10723,759 @@ static void test_setup_idle_mode_text(gconstpointer data)
        stk_command_free(command);
 }
 
+struct run_at_command_test {
+       const unsigned char *pdu;
+       unsigned int pdu_len;
+       unsigned char qualifier;
+       char *alpha_id;
+       char *at_command;
+       struct stk_icon_id icon_id;
+       struct stk_text_attribute text_attr;
+       struct stk_frame_id frame_id;
+};
+
+static unsigned char run_at_command_111[] = { 0xD0, 0x12, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0xA8, 0x07, 0x41, 0x54,
+                                               0x2B, 0x43, 0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_121[] = { 0xD0, 0x14, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x00, 0xA8, 0x07,
+                                               0x41, 0x54, 0x2B, 0x43, 0x47,
+                                               0x4D, 0x49 };
+
+static unsigned char run_at_command_131[] = { 0xD0, 0x22, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x0E, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0xA8, 0x07, 0x41,
+                                               0x54, 0x2B, 0x43, 0x47, 0x4D,
+                                               0x49 };
+
+static unsigned char run_at_command_211[] = { 0xD0, 0x22, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x0A, 0x42, 0x61,
+                                               0x73, 0x69, 0x63, 0x20, 0x49,
+                                               0x63, 0x6F, 0x6E, 0xA8, 0x07,
+                                               0x41, 0x54, 0x2B, 0x43, 0x47,
+                                               0x4D, 0x49, 0x9E, 0x02, 0x00,
+                                               0x01 };
+
+/* The 12th byte should be 0x85, instead of 0xA8 */
+static unsigned char run_at_command_221[] = { 0xD0, 0x23, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x0B, 0x43, 0x6F,
+                                               0x6C, 0x6F, 0x75, 0x72, 0x20,
+                                               0x49, 0x63, 0x6F, 0x6E, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0x9E, 0x02,
+                                               0x00, 0x02 };
+
+static unsigned char run_at_command_231[] = { 0xD0, 0x22, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x0A, 0x42, 0x61,
+                                               0x73, 0x69, 0x63, 0x20, 0x49,
+                                               0x63, 0x6F, 0x6E, 0xA8, 0x07,
+                                               0x41, 0x54, 0x2B, 0x43, 0x47,
+                                               0x4D, 0x49, 0x9E, 0x02, 0x01,
+                                               0x01 };
+
+static unsigned char run_at_command_241[] = { 0xD0, 0x23, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x0B, 0x43, 0x6F,
+                                               0x6C, 0x6F, 0x75, 0x72, 0x20,
+                                               0x49, 0x63, 0x6F, 0x6E, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0x9E, 0x02,
+                                               0x01, 0x02 };
+
+static unsigned char run_at_command_251[] = { 0xD0, 0x16, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0xA8, 0x07, 0x41, 0x54,
+                                               0x2B, 0x43, 0x47, 0x4D, 0x49,
+                                               0x9E, 0x02, 0x01, 0x01 };
+
+static unsigned char run_at_command_311[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_312[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_321[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x01, 0xB4 };
+
+static unsigned char run_at_command_322[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_331[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x02, 0xB4 };
+
+static unsigned char run_at_command_332[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_341[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x04, 0xB4 };
+
+static unsigned char run_at_command_342[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_343[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x33, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_351[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x08, 0xB4 };
+
+static unsigned char run_at_command_352[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_353[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x33, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_361[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x10, 0xB4 };
+
+static unsigned char run_at_command_362[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_363[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x33, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_371[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x20, 0xB4 };
+
+static unsigned char run_at_command_372[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_373[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x33, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_381[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x40, 0xB4 };
+
+static unsigned char run_at_command_382[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_383[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x33, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_391[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x80, 0xB4 };
+
+static unsigned char run_at_command_392[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_393[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x33, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+static unsigned char run_at_command_3101[] = { 0xD0, 0x2A, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x31, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49, 0xD0, 0x04,
+                                               0x00, 0x10, 0x00, 0xB4 };
+
+static unsigned char run_at_command_3102[] = { 0xD0, 0x24, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x10, 0x52, 0x75,
+                                               0x6E, 0x20, 0x41, 0x54, 0x20,
+                                               0x43, 0x6F, 0x6D, 0x6D, 0x61,
+                                               0x6E, 0x64, 0x20, 0x32, 0xA8,
+                                               0x07, 0x41, 0x54, 0x2B, 0x43,
+                                               0x47, 0x4D, 0x49 };
+
+/* The 2nd byte (total size) should be 0x2D, instead of 0x21 */
+static unsigned char run_at_command_411[] = { 0xD0, 0x2D, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x19, 0x80, 0x04,
+                                               0x17, 0x04, 0x14, 0x04, 0x20,
+                                               0x04, 0x10, 0x04, 0x12, 0x04,
+                                               0x21, 0x04, 0x22, 0x04, 0x12,
+                                               0x04, 0x23, 0x04, 0x19, 0x04,
+                                               0x22, 0x04, 0x15, 0xA8, 0x07,
+                                               0x41, 0x54, 0x2B, 0x43, 0x47,
+                                               0x4D, 0x49 };
+
+static unsigned char run_at_command_511[] = { 0xD0, 0x19, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x05, 0x80, 0x4F,
+                                               0x60, 0x59, 0x7D, 0xA8, 0x07,
+                                               0x41, 0x54, 0x2B, 0x43, 0x47,
+                                               0x4D, 0x49 };
+
+static unsigned char run_at_command_611[] = { 0xD0, 0x1B, 0x81, 0x03, 0x01,
+                                               0x34, 0x00, 0x82, 0x02, 0x81,
+                                               0x82, 0x85, 0x07, 0x80, 0x00,
+                                               0x38, 0x00, 0x30, 0x30, 0xEB,
+                                               0xA8, 0x07, 0x41, 0x54, 0x2B,
+                                               0x43, 0x47, 0x4D, 0x49 };
+
+static struct run_at_command_test run_at_command_data_111 = {
+       .pdu = run_at_command_111,
+       .pdu_len = sizeof(run_at_command_111),
+       .qualifier = 0x00,
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_121 = {
+       .pdu = run_at_command_121,
+       .pdu_len = sizeof(run_at_command_121),
+       .qualifier = 0x00,
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_131 = {
+       .pdu = run_at_command_131,
+       .pdu_len = sizeof(run_at_command_131),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_211 = {
+       .pdu = run_at_command_211,
+       .pdu_len = sizeof(run_at_command_211),
+       .qualifier = 0x00,
+       .alpha_id = "Basic Icon",
+       .at_command = "AT+CGMI",
+       .icon_id = {
+               .qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY,
+               .id = 0x01
+       }
+};
+
+static struct run_at_command_test run_at_command_data_221 = {
+       .pdu = run_at_command_221,
+       .pdu_len = sizeof(run_at_command_221),
+       .qualifier = 0x00,
+       .alpha_id = "Colour Icon",
+       .at_command = "AT+CGMI",
+       .icon_id = {
+               .qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY,
+               .id = 0x02
+       }
+};
+
+static struct run_at_command_test run_at_command_data_231 = {
+       .pdu = run_at_command_231,
+       .pdu_len = sizeof(run_at_command_231),
+       .qualifier = 0x00,
+       .alpha_id = "Basic Icon",
+       .at_command = "AT+CGMI",
+       .icon_id = {
+               .qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY,
+               .id = 0x01
+       }
+};
+
+/* The qualifier of icon_id should be non self-explanatory */
+static struct run_at_command_test run_at_command_data_241 = {
+       .pdu = run_at_command_241,
+       .pdu_len = sizeof(run_at_command_241),
+       .qualifier = 0x00,
+       .alpha_id = "Colour Icon",
+       .at_command = "AT+CGMI",
+       .icon_id = {
+               .qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY,
+               .id = 0x02
+       }
+};
+
+static struct run_at_command_test run_at_command_data_251 = {
+       .pdu = run_at_command_251,
+       .pdu_len = sizeof(run_at_command_251),
+       .qualifier = 0x00,
+       .at_command = "AT+CGMI",
+       .icon_id = {
+               .qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY,
+               .id = 0x01
+       }
+};
+
+static struct run_at_command_test run_at_command_data_311 = {
+       .pdu = run_at_command_311,
+       .pdu_len = sizeof(run_at_command_311),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_312 = {
+       .pdu = run_at_command_312,
+       .pdu_len = sizeof(run_at_command_312),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_321 = {
+       .pdu = run_at_command_321,
+       .pdu_len = sizeof(run_at_command_321),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x01, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_322 = {
+       .pdu = run_at_command_322,
+       .pdu_len = sizeof(run_at_command_322),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_331 = {
+       .pdu = run_at_command_331,
+       .pdu_len = sizeof(run_at_command_331),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x02, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_332 = {
+       .pdu = run_at_command_332,
+       .pdu_len = sizeof(run_at_command_332),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_341 = {
+       .pdu = run_at_command_341,
+       .pdu_len = sizeof(run_at_command_341),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x04, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_342 = {
+       .pdu = run_at_command_342,
+       .pdu_len = sizeof(run_at_command_342),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_343 = {
+       .pdu = run_at_command_343,
+       .pdu_len = sizeof(run_at_command_343),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 3",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_351 = {
+       .pdu = run_at_command_351,
+       .pdu_len = sizeof(run_at_command_351),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x08, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_352 = {
+       .pdu = run_at_command_352,
+       .pdu_len = sizeof(run_at_command_352),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_353 = {
+       .pdu = run_at_command_353,
+       .pdu_len = sizeof(run_at_command_353),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 3",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_361 = {
+       .pdu = run_at_command_361,
+       .pdu_len = sizeof(run_at_command_361),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x10, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_362 = {
+       .pdu = run_at_command_362,
+       .pdu_len = sizeof(run_at_command_362),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_363 = {
+       .pdu = run_at_command_363,
+       .pdu_len = sizeof(run_at_command_363),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 3",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_371 = {
+       .pdu = run_at_command_371,
+       .pdu_len = sizeof(run_at_command_371),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x20, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_372 = {
+       .pdu = run_at_command_372,
+       .pdu_len = sizeof(run_at_command_372),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_373 = {
+       .pdu = run_at_command_373,
+       .pdu_len = sizeof(run_at_command_373),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 3",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_381 = {
+       .pdu = run_at_command_381,
+       .pdu_len = sizeof(run_at_command_381),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x40, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_382 = {
+       .pdu = run_at_command_382,
+       .pdu_len = sizeof(run_at_command_382),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_383 = {
+       .pdu = run_at_command_383,
+       .pdu_len = sizeof(run_at_command_383),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 3",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_391 = {
+       .pdu = run_at_command_391,
+       .pdu_len = sizeof(run_at_command_391),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x80, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_392 = {
+       .pdu = run_at_command_392,
+       .pdu_len = sizeof(run_at_command_392),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_393 = {
+       .pdu = run_at_command_393,
+       .pdu_len = sizeof(run_at_command_393),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 3",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_3101 = {
+       .pdu = run_at_command_3101,
+       .pdu_len = sizeof(run_at_command_3101),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 1",
+       .at_command = "AT+CGMI",
+       .text_attr = {
+               .len = 4,
+               .attributes = { 0x00, 0x10, 0x00, 0xB4 }
+       }
+};
+
+static struct run_at_command_test run_at_command_data_3102 = {
+       .pdu = run_at_command_3102,
+       .pdu_len = sizeof(run_at_command_3102),
+       .qualifier = 0x00,
+       .alpha_id = "Run AT Command 2",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_411 = {
+       .pdu = run_at_command_411,
+       .pdu_len = sizeof(run_at_command_411),
+       .qualifier = 0x00,
+       .alpha_id = "ЗДРАВСТВУЙТЕ",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_511 = {
+       .pdu = run_at_command_511,
+       .pdu_len = sizeof(run_at_command_511),
+       .qualifier = 0x00,
+       .alpha_id = "你好",
+       .at_command = "AT+CGMI"
+};
+
+static struct run_at_command_test run_at_command_data_611 = {
+       .pdu = run_at_command_611,
+       .pdu_len = sizeof(run_at_command_611),
+       .qualifier = 0x00,
+       .alpha_id = "80ル",
+       .at_command = "AT+CGMI"
+};
+
+static void test_run_at_command(gconstpointer data)
+{
+       const struct run_at_command_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_RUN_AT_COMMAND);
+       g_assert(command->qualifier == test->qualifier);
+
+       g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+       g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL);
+
+       check_alpha_id(command->run_at_command.alpha_id, test->alpha_id);
+       check_at_command(command->run_at_command.at_command, test->at_command);
+       check_icon_id(&command->run_at_command.icon_id, &test->icon_id);
+       check_text_attr(&command->run_at_command.text_attr, &test->text_attr);
+       check_frame_id(&command->run_at_command.frame_id, &test->frame_id);
+
+       stk_command_free(command);
+}
+
 struct terminal_response_test {
        const unsigned char *pdu;
        unsigned int pdu_len;
@@ -13889,5 +14648,80 @@ int main(int argc, char **argv)
        g_test_add_data_func("/teststk/Setup Idle Mode Text 6.1.1",
                &setup_idle_mode_text_data_611, test_setup_idle_mode_text);
 
+       g_test_add_data_func("/teststk/Run At Command 1.1.1",
+                       &run_at_command_data_111, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 1.2.1",
+                       &run_at_command_data_121, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 1.3.1",
+                       &run_at_command_data_131, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 2.1.1",
+                       &run_at_command_data_211, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 2.2.1",
+                       &run_at_command_data_221, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 2.3.1",
+                       &run_at_command_data_231, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 2.4.1",
+                       &run_at_command_data_241, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 2.5.1",
+                       &run_at_command_data_251, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.1.1",
+                       &run_at_command_data_311, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.1.2",
+                       &run_at_command_data_312, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.2.1",
+                       &run_at_command_data_321, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.2.2",
+                       &run_at_command_data_322, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.3.1",
+                       &run_at_command_data_331, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.3.2",
+                       &run_at_command_data_332, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.4.1",
+                       &run_at_command_data_341, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.4.2",
+                       &run_at_command_data_342, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.4.3",
+                       &run_at_command_data_343, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.5.1",
+                       &run_at_command_data_351, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.5.2",
+                       &run_at_command_data_352, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.5.3",
+                       &run_at_command_data_353, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.6.1",
+                       &run_at_command_data_361, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.6.2",
+                       &run_at_command_data_362, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.6.3",
+                       &run_at_command_data_363, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.7.1",
+                       &run_at_command_data_371, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.7.2",
+                       &run_at_command_data_372, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.7.3",
+                       &run_at_command_data_373, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.8.1",
+                       &run_at_command_data_381, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.8.2",
+                       &run_at_command_data_382, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.8.3",
+                       &run_at_command_data_383, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.9.1",
+                       &run_at_command_data_391, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.9.2",
+                       &run_at_command_data_392, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.9.3",
+                       &run_at_command_data_393, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.10.1",
+                       &run_at_command_data_3101, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 3.10.2",
+                       &run_at_command_data_3102, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 4.1.1",
+                       &run_at_command_data_411, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 5.1.1",
+                       &run_at_command_data_511, test_run_at_command);
+       g_test_add_data_func("/teststk/Run At Command 6.1.1",
+                       &run_at_command_data_611, test_run_at_command);
+
        return g_test_run();
 }