Open Source Telephony
 help / color / mirror / Atom feed
From: Guillaume Zajac <guillaume.zajac@linux.intel.com>
To: ofono@ofono.org
Subject: Re: [PATCH] unit: Update test_invalid() unit test
Date: Wed, 18 Jul 2012 17:17:07 +0200	[thread overview]
Message-ID: <5006D373.5090902@linux.intel.com> (raw)
In-Reply-To: <1342624403-3484-1-git-send-email-guillaume.zajac@linux.intel.com>

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

Hi,

On 18/07/2012 17:13, Guillaume Zajac wrote:
> ---
>   unit/test-util.c |   27 ++++++++++++++++++++++++---
>   1 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/unit/test-util.c b/unit/test-util.c
> index 079d775..f65f3ee 100644
> --- a/unit/test-util.c
> +++ b/unit/test-util.c
> @@ -345,7 +345,9 @@ static void test_invalid(void)
>   {
>   	long nwritten;
>   	long nread;
> -	char *res;
> +	short unsigned int exp_code;
> +	long exp_res_length;
> +	char *res, *temp, *exp_res = NULL;
>   	unsigned char *gsm;
>   
>   	res = convert_gsm_to_utf8(invalid_gsm_extended, 0, &nread, &nwritten,
> @@ -356,15 +358,34 @@ static void test_invalid(void)
>   	g_assert(res[0] == '\0');
>   	g_free(res);
>   
> +	/*
> +	 * In case of invalid GSM extended code, we should display
> +	 * the character of the main default alphabet table.
> +	 */
>   	res = convert_gsm_to_utf8(invalid_gsm_extended,
>   					sizeof(invalid_gsm_extended),
>   					&nread, &nwritten, 0);
> -	g_assert(res == NULL);
> -	g_assert(nread == 1);
> +
> +	exp_code = gsm_to_unicode_map[invalid_gsm_extended[1]*2 + 1];
> +
> +	exp_res_length = UTF8_LENGTH(exp_code);
> +	exp_res = g_try_malloc(exp_res_length + 1);
> +
> +	g_assert(exp_res != NULL);
> +
> +	temp = exp_res;
> +	temp += g_unichar_to_utf8(exp_code, temp);
> +	*temp = '\0';
> +
> +	g_assert(g_strcmp0(res, exp_res) == 0);
> +	g_assert(nread == exp_res_length);
> +	g_free(exp_res);
> +	g_free(res);
>   
>   	res = convert_gsm_to_utf8(invalid_gsm_extended_len,
>   					sizeof(invalid_gsm_extended_len),
>   					&nread, &nwritten, 0);
> +

I added blank line although I shouldn't have done it.
I will send a new version.

>   	g_assert(res == NULL);
>   	g_assert(nread == 3);
>   

Kind regards,
Guillaume

      reply	other threads:[~2012-07-18 15:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 15:13 [PATCH] unit: Update test_invalid() unit test Guillaume Zajac
2012-07-18 15:17 ` Guillaume Zajac [this message]

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=5006D373.5090902@linux.intel.com \
    --to=guillaume.zajac@linux.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