Open Source Telephony
 help / color / mirror / Atom feed
From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 25/27] test-stk: Add test for get reader status parser
Date: Thu, 13 May 2010 18:48:42 +0800	[thread overview]
Message-ID: <1273747724-28019-25-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: 2068 bytes --]

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

diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 340f15f..5a6d2a4 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -9421,6 +9421,48 @@ static void test_perform_card_apdu(gconstpointer data)
 	stk_command_free(command);
 }
 
+struct get_reader_status_test {
+	const unsigned char *pdu;
+	unsigned int pdu_len;
+	unsigned char qualifier;
+};
+
+static unsigned char get_reader_status_111[] = { 0xD0, 0x09, 0x81, 0x03, 0x01,
+						0x33, 0x00, 0x82, 0x02, 0x81,
+						0x82 };
+
+static struct get_reader_status_test get_reader_status_data_111 = {
+	.pdu = get_reader_status_111,
+	.pdu_len = sizeof(get_reader_status_111),
+	.qualifier = STK_QUALIFIER_TYPE_CARD_READER_STATUS,
+};
+
+static void test_get_reader_status(gconstpointer data)
+{
+	const struct get_reader_status_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_READER_STATUS);
+	g_assert(command->qualifier == test->qualifier);
+
+	g_assert(command->src == STK_DEVICE_IDENTITY_TYPE_UICC);
+
+	if (command->qualifier == STK_QUALIFIER_TYPE_CARD_READER_STATUS)
+		g_assert(command->dst == STK_DEVICE_IDENTITY_TYPE_TERMINAL);
+	else
+		g_assert(command->dst <
+				STK_DEVICE_IDENTITY_TYPE_CARD_READER_0 ||
+			command->dst >
+				STK_DEVICE_IDENTITY_TYPE_CARD_READER_7);
+
+	stk_command_free(command);
+}
+
 int main(int argc, char **argv)
 {
 	g_test_init(&argc, &argv, NULL);
@@ -10100,5 +10142,8 @@ int main(int argc, char **argv)
 	g_test_add_data_func("/teststk/Perform Card APDU 2.1.1",
 			&perform_card_apdu_data_211, test_perform_card_apdu);
 
+	g_test_add_data_func("/teststk/Get Reader Status 1.1.1",
+			&get_reader_status_data_111, test_get_reader_status);
+
 	return g_test_run();
 }
-- 
1.7.0.4


  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 ` [PATCH 13/27] test-stkutil: Add test for refresh parser Yang Gu
2010-05-13 10:48 ` [PATCH 14/27] stkutil: Add polling off proactive command parser 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 ` Yang Gu [this message]
2010-05-13 10:48 ` [PATCH 26/27] stkutil: Add timer management " 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-25-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