Re: [E-devel] [EGIT] [core/efl] master 04/06: eina: add a test for eina_stringshare_refplace.

2016-12-19 Thread Gustavo Sverzut Barbieri
On Thu, Dec 15, 2016 at 9:24 PM, Cedric BAIL  wrote:
> cedric pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=0ff7bf3611d3769d2da0bc2521586dc285d5765e
>
> commit 0ff7bf3611d3769d2da0bc2521586dc285d5765e
> Author: Cedric BAIL 
> Date:   Thu Dec 15 15:00:58 2016 -0800
>
> eina: add a test for eina_stringshare_refplace.
> ---
>  src/tests/eina/eina_test_stringshare.c | 36 
> ++
>  1 file changed, 36 insertions(+)
>
> diff --git a/src/tests/eina/eina_test_stringshare.c 
> b/src/tests/eina/eina_test_stringshare.c
> index 02e5c81..0aa1beb 100644
> --- a/src/tests/eina/eina_test_stringshare.c
> +++ b/src/tests/eina/eina_test_stringshare.c
> @@ -66,6 +66,41 @@ START_TEST(eina_stringshare_simple)
>  }
>  END_TEST
>
> +START_TEST(eina_stringshare_simple_refplace)
> +{
> +   const char *t0;
> +   const char *t1;
> +   Eina_Slice slice;
> +
> +   eina_init();
> +
> +   t0 = eina_stringshare_add(TEST0);
> +   t1 = eina_stringshare_add(TEST1);
> +
> +   fail_if(t0 == NULL);
> +   fail_if(t1 == NULL);
> +   fail_if(strcmp(t0, TEST0) != 0);
> +   fail_if(strcmp(t1, TEST1) != 0);
> +   fail_if((int)strlen(TEST0) != eina_stringshare_strlen(t0));
> +   fail_if((int)strlen(TEST1) != eina_stringshare_strlen(t1));

see, these things I was talking about the other day.

ck_assert_str_eq() and ck_assert_int_eq() are as simple and produces
much better results.

http://check.sourceforge.net/doc/check_html/check_4.html





-- 
Gustavo Sverzut Barbieri
--
Mobile: +55 (16) 99354-9890

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [EGIT] [core/efl] master 04/06: eina: add a test for eina_stringshare_refplace.

2016-12-20 Thread Cedric BAIL
On Mon, Dec 19, 2016 at 3:31 AM, Gustavo Sverzut Barbieri
 wrote:
> On Thu, Dec 15, 2016 at 9:24 PM, Cedric BAIL  wrote:
>> cedric pushed a commit to branch master.
>>
>> http://git.enlightenment.org/core/efl.git/commit/?id=0ff7bf3611d3769d2da0bc2521586dc285d5765e
>>
>> commit 0ff7bf3611d3769d2da0bc2521586dc285d5765e
>> Author: Cedric BAIL 
>> Date:   Thu Dec 15 15:00:58 2016 -0800
>>
>> eina: add a test for eina_stringshare_refplace.
>> ---
>>  src/tests/eina/eina_test_stringshare.c | 36 
>> ++
>>  1 file changed, 36 insertions(+)
>>
>> diff --git a/src/tests/eina/eina_test_stringshare.c 
>> b/src/tests/eina/eina_test_stringshare.c
>> index 02e5c81..0aa1beb 100644
>> --- a/src/tests/eina/eina_test_stringshare.c
>> +++ b/src/tests/eina/eina_test_stringshare.c
>> @@ -66,6 +66,41 @@ START_TEST(eina_stringshare_simple)
>>  }
>>  END_TEST
>>
>> +START_TEST(eina_stringshare_simple_refplace)
>> +{
>> +   const char *t0;
>> +   const char *t1;
>> +   Eina_Slice slice;
>> +
>> +   eina_init();
>> +
>> +   t0 = eina_stringshare_add(TEST0);
>> +   t1 = eina_stringshare_add(TEST1);
>> +
>> +   fail_if(t0 == NULL);
>> +   fail_if(t1 == NULL);
>> +   fail_if(strcmp(t0, TEST0) != 0);
>> +   fail_if(strcmp(t1, TEST1) != 0);
>> +   fail_if((int)strlen(TEST0) != eina_stringshare_strlen(t0));
>> +   fail_if((int)strlen(TEST1) != eina_stringshare_strlen(t1));
>
> see, these things I was talking about the other day.
>
> ck_assert_str_eq() and ck_assert_int_eq() are as simple and produces
> much better results.

This was mostly a copy and paste of an existing test with very little
change. That's why all the fail_if are there. Will try to take
stringshare as an example for how to improve test suite.
-- 
Cedric BAIL

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel