From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 13/27] test-stkutil: Add test for refresh parser
Date: Thu, 13 May 2010 18:48:30 +0800 [thread overview]
Message-ID: <1273747724-28019-13-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1273747724-28019-1-git-send-email-yang.gu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 3842 bytes --]
---
unit/test-stkutil.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 75ca258..1f66631 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -194,6 +194,22 @@ static inline void check_tone(const ofono_bool_t command,
check_common_bool(command, test);
}
+/* Defined in TS 102.223 Section 8.18 */
+static void check_file_list(GSList *command, const struct stk_file *test)
+{
+ struct stk_file *sf;
+ GSList *l;
+ unsigned int i = 0;
+
+ for (l = command; l; l = l->next) {
+ sf = l->data;
+ g_assert(sf->len == test[i].len);
+ g_assert(g_mem_equal(sf->file, test[i++].file, sf->len));
+ }
+
+ g_assert(test[i].len == 0);
+}
+
/* Defined in TS 102.223 Section 8.23 */
static inline void check_default_text(const char *command, const char *test)
{
@@ -233,6 +249,13 @@ static inline void check_imm_resp(const unsigned char command,
check_common_byte(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)
+{
+ g_assert(g_mem_equal(command->aid, test->aid, test->len));
+}
+
/* Defined in TS 102.223 Section 8.71 */
static inline void check_cdma_sms_tpdu(
const struct stk_common_byte_array *command,
@@ -8858,6 +8881,69 @@ static void test_setup_call(gconstpointer data)
stk_command_free(command);
}
+struct refresh_test {
+ const unsigned char *pdu;
+ unsigned int pdu_len;
+ unsigned char qualifier;
+ struct stk_file fl[MAX_ITEM];
+ struct stk_aid aid;
+ char *alpha_id;
+ struct stk_icon_id icon_id;
+ struct stk_text_attribute text_attr;
+ struct stk_frame_id frame_id;
+};
+
+static unsigned char refresh_121[] = { 0xD0, 0x10, 0x81, 0x03, 0x01, 0x01,
+ 0x01, 0x82, 0x02, 0x81, 0x82,
+ 0x92, 0x05, 0x01, 0x3F, 0x00,
+ 0x2F, 0xE2 };
+
+static unsigned char refresh_151[] = { 0xD0, 0x09, 0x81, 0x03, 0x01, 0x01,
+ 0x04, 0x82, 0x02, 0x81, 0x82 };
+
+static struct refresh_test refresh_data_121 = {
+ .pdu = refresh_121,
+ .pdu_len = sizeof(refresh_121),
+ .qualifier = 0x01,
+ .fl[0] = {
+ .len = 4,
+ .file = { 0x3F, 0x00, 0x2F, 0xE2 }
+ }
+};
+
+static struct refresh_test refresh_data_151 = {
+ .pdu = refresh_151,
+ .pdu_len = sizeof(refresh_151),
+ .qualifier = 0x04
+};
+
+/* Defined in TS 102.384 Section 27.22.4.7 */
+static void test_refresh(gconstpointer data)
+{
+ const struct refresh_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_REFRESH);
+ 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_file_list(command->refresh.fl, test->fl);
+ check_aid(&command->refresh.aid, &test->aid);
+ check_alpha_id(command->refresh.alpha_id, test->alpha_id);
+ check_icon_id(&command->refresh.icon_id, &test->icon_id);
+ check_text_attr(&command->refresh.text_attr, &test->text_attr);
+ check_frame_id(&command->refresh.frame_id, &test->frame_id);
+
+ stk_command_free(command);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -9484,5 +9570,10 @@ int main(int argc, char **argv)
g_test_add_data_func("/teststk/Setup Call 7.2.1",
&setup_call_data_721, test_setup_call);
+ g_test_add_data_func("/teststk/Refresh 1.2.1",
+ &refresh_data_121, test_refresh);
+ g_test_add_data_func("/teststk/Refresh 1.5.1",
+ &refresh_data_151, test_refresh);
+
return g_test_run();
}
--
1.7.0.4
next prev parent reply other threads:[~2010-05-13 10:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 10:48 [PATCH 01/27] stk: Add poll interval proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 02/27] test-stkutil: Add test for poll interval parser Yang Gu
2010-05-13 10:48 ` [PATCH 03/27] stkutil: Add setup menu proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 04/27] test-stkutil: Add test for setup menu parser Yang Gu
2010-05-13 10:48 ` [PATCH 05/27] stkutil: Add select item proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 06/27] test-stkutil: Add test for select item parser Yang Gu
2010-05-13 10:48 ` [PATCH 07/27] test-stkutil: Use dedicated functions to check Yang Gu
2010-05-13 10:48 ` [PATCH 08/27] test-stkutil: Refactor test for send sms parser Yang Gu
2010-05-13 10:48 ` [PATCH 09/27] stk: Adjust the sequence of dataobj Yang Gu
2010-05-13 10:48 ` [PATCH 10/27] stkutil: Add setup call proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 11/27] test-stkutil: Add unit test for setup call parser Yang Gu
2010-05-13 10:48 ` [PATCH 12/27] stkutil: Add refresh proactive command parser Yang Gu
2010-05-13 10:48 ` Yang Gu [this message]
2010-05-13 10:48 ` [PATCH 14/27] stkutil: Add polling off " Yang Gu
2010-05-13 10:48 ` [PATCH 15/27] test-stkutil: Add test for polling off parser Yang Gu
2010-05-13 10:48 ` [PATCH 16/27] stkutil: Add provide local info command parser Yang Gu
2010-05-13 10:48 ` [PATCH 17/27] test-stk: Add test for provide local info parser Yang Gu
2010-05-13 10:48 ` [PATCH 18/27] stkutil: Add event list command parser Yang Gu
2010-05-13 10:48 ` [PATCH 19/27] test-stkutil: Add test for event list parser Yang Gu
2010-05-13 10:48 ` [PATCH 20/27] stkutil: Add perform card apdu command parser Yang Gu
2010-05-13 10:48 ` [PATCH 21/27] test-stk: Add test for perform card apdu parser Yang Gu
2010-05-13 10:48 ` [PATCH 22/27] stkutil: Add power off card command parser Yang Gu
2010-05-13 10:48 ` [PATCH 23/27] stkutil: Add power on " Yang Gu
2010-05-13 10:48 ` [PATCH 24/27] stkutil: Add get reader status " Yang Gu
2010-05-13 10:48 ` [PATCH 25/27] test-stk: Add test for get reader status parser Yang Gu
2010-05-13 10:48 ` [PATCH 26/27] stkutil: Add timer management command parser Yang Gu
2010-05-13 10:48 ` [PATCH 27/27] test-stk: Add test for timer management parser Yang Gu
2010-05-13 20:37 ` [PATCH 01/27] stk: Add poll interval proactive command parser Denis Kenzior
2010-05-14 8:37 ` Gu, Yang
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=1273747724-28019-13-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