Skip to contentSkip to conversation

test-stkutil: Add Run AT Command response builder tests.

PATCH In review Andrzej Zaborowski 1 participant 1 message May 23, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 10/16 test-stkutil: Add Run AT Command response builder tests.

---
 unit/test-stkutil.c |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 78 insertions(+), 0 deletions(-)
unit/test-stkutil.c +78 -0
index aef2451..5195455 100644
@@ -13670,6 +13670,74 @@ static const struct terminal_response_test
 	},
 };
 
+static const unsigned char run_at_command_response_111[] = {
+	0x81, 0x03, 0x01, 0x34, 0x00, 0x82, 0x02, 0x82,
+	0x81, 0x83, 0x01, 0x00, 0xA9, 0x05, 0x2b, 0x43,
+	0x47, 0x4d, 0x49,
+};
+
+static const struct terminal_response_test run_at_command_response_data_111 = {
+	.pdu = run_at_command_response_111,
+	.pdu_len = sizeof(run_at_command_response_111),
+	.response = {
+		.number = 1,
+		.type = STK_COMMAND_TYPE_RUN_AT_COMMAND,
+		.qualifier = 0x00,
+		.src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+		.dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+		.result = {
+			.type = STK_RESULT_TYPE_SUCCESS,
+		},
+		{ .run_at_command = {
+			.at_response = "+CGMI",
+		}},
+	},
+};
+
+static const unsigned char run_at_command_response_211b[] = {
+	0x81, 0x03, 0x01, 0x34, 0x00, 0x82, 0x02, 0x82,
+	0x81, 0x83, 0x01, 0x04, 0xA9, 0x05, 0x2b, 0x43,
+	0x47, 0x4d, 0x49,
+};
+
+static const struct terminal_response_test run_at_command_response_data_211b = {
+	.pdu = run_at_command_response_211b,
+	.pdu_len = sizeof(run_at_command_response_211b),
+	.response = {
+		.number = 1,
+		.type = STK_COMMAND_TYPE_RUN_AT_COMMAND,
+		.qualifier = 0x00,
+		.src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+		.dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+		.result = {
+			.type = STK_RESULT_TYPE_NO_ICON,
+		},
+		{ .run_at_command = {
+			.at_response = "+CGMI",
+		}},
+	},
+};
+
+static const unsigned char run_at_command_response_251[] = {
+	0x81, 0x03, 0x01, 0x34, 0x00, 0x82, 0x02, 0x82,
+	0x81, 0x83, 0x01, 0x32,
+};
+
+static const struct terminal_response_test run_at_command_response_data_251 = {
+	.pdu = run_at_command_response_251,
+	.pdu_len = sizeof(run_at_command_response_251),
+	.response = {
+		.number = 1,
+		.type = STK_COMMAND_TYPE_RUN_AT_COMMAND,
+		.qualifier = 0x00,
+		.src = STK_DEVICE_IDENTITY_TYPE_TERMINAL,
+		.dst = STK_DEVICE_IDENTITY_TYPE_UICC,
+		.result = {
+			.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD,
+		},
+	},
+};
+
 int main(int argc, char **argv)
 {
 	g_test_init(&argc, &argv, NULL);
@@ -14897,5 +14965,15 @@ int main(int argc, char **argv)
 			&set_up_idle_mode_text_response_data_241,
 			test_terminal_response_encoding);
 
+	g_test_add_data_func("/teststk/Run AT Command response 1.1.1",
+			&run_at_command_response_data_111,
+			test_terminal_response_encoding);
+	g_test_add_data_func("/teststk/Run AT Command response 2.1.1B",
+			&run_at_command_response_data_211b,
+			test_terminal_response_encoding);
+	g_test_add_data_func("/teststk/Run AT Command response 2.5.1",
+			&run_at_command_response_data_251,
+			test_terminal_response_encoding);
+
 	return g_test_run();
 }
Signature · 1 line
1.7.1.86.g0e460.dirty