Open Source Telephony
 help / color / mirror / Atom feed
From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 8/8] teststk: Add test for language notification parser
Date: Wed, 19 May 2010 18:24:46 +0800	[thread overview]
Message-ID: <1274264686-9706-8-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1274264686-9706-1-git-send-email-yang.gu@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2901 bytes --]

---
 unit/test-stkutil.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index b236e59..97f3c47 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -305,6 +305,12 @@ static inline void check_dtmf_string(const char *command, const char *test)
 	check_common_text(command, test);
 }
 
+/* Defined in TS 102.223 Section 8.45 */
+static inline void check_language(const char *command, const char *test)
+{
+	check_common_text(command, test);
+}
+
 /* Defined in TS 102.223 Section 8.60 */
 static inline void check_aid(const struct stk_aid *command,
 					const struct stk_aid *test)
@@ -12147,6 +12153,56 @@ static void test_send_dtmf(gconstpointer data)
 	stk_command_free(command);
 }
 
+struct language_notification_test {
+	const unsigned char *pdu;
+	unsigned int pdu_len;
+	unsigned char qualifier;
+	char language[3];
+};
+
+static unsigned char language_notification_111[] = { 0xD0, 0x0D, 0x81, 0x03,
+						0x01, 0x35, 0x01, 0x82, 0x02,
+						0x81, 0x82, 0xAD, 0x02, 0x73,
+						0x65 };
+
+static unsigned char language_notification_121[] = { 0xD0, 0x09, 0x81, 0x03,
+						0x01, 0x35, 0x00, 0x82, 0x02,
+						0x81, 0x82 };
+
+static struct language_notification_test language_notification_data_111 = {
+	.pdu = language_notification_111,
+	.pdu_len = sizeof(language_notification_111),
+	.qualifier = 0x01,
+	.language = "se"
+};
+
+static struct language_notification_test language_notification_data_121 = {
+	.pdu = language_notification_121,
+	.pdu_len = sizeof(language_notification_121),
+	.qualifier = 0x00
+};
+
+static void test_language_notification(gconstpointer data)
+{
+	const struct language_notification_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_LANGUAGE_NOTIFICATION);
+	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_language(command->language_notification.language, test->language);
+
+	stk_command_free(command);
+}
+
 int main(int argc, char **argv)
 {
 	g_test_init(&argc, &argv, NULL);
@@ -13127,5 +13183,10 @@ int main(int argc, char **argv)
 	g_test_add_data_func("/teststk/Send DTMF 6.1.1",
 			&send_dtmf_data_611, test_send_dtmf);
 
+	g_test_add_data_func("/teststk/Language Notification 1.1.1",
+		&language_notification_data_111, test_language_notification);
+	g_test_add_data_func("/teststk/Language Notification 1.2.1",
+		&language_notification_data_121, test_language_notification);
+
 	return g_test_run();
 }
-- 
1.7.0.4


  parent reply	other threads:[~2010-05-19 10:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 10:24 [PATCH 1/8] stk: Add parser for setup idle mode text commands Yang Gu
2010-05-19 10:24 ` [PATCH 2/8] test-stk: Add test for setup idle mode text parser Yang Gu
2010-05-19 10:24 ` [PATCH 3/8] stk: Add parser for run at command commands Yang Gu
2010-05-19 10:24 ` [PATCH 4/8] test-stk: Add test for run at command parser Yang Gu
2010-05-19 10:24 ` [PATCH 5/8] stk: Add parser for send dtmf commands Yang Gu
2010-05-19 10:24 ` [PATCH 6/8] test-stk: Add test for send dtmf parser Yang Gu
2010-05-19 10:24 ` [PATCH 7/8] stk: Add parser for language notification commands Yang Gu
2010-05-19 10:24 ` Yang Gu [this message]
2010-05-25 22:56 ` [PATCH 1/8] stk: Add parser for setup idle mode text commands Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274264686-9706-8-git-send-email-yang.gu@intel.com \
    --to=yang.gu@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox