cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6c33bbfa807e3935ba36d9956c24fd8a93d928fa

commit 6c33bbfa807e3935ba36d9956c24fd8a93d928fa
Author: Vivek Ellur <vivek.el...@samsung.com>
Date:   Tue May 19 14:13:17 2015 +0200

    eina: add tests cases for eina_rectangle and eina_str functions
    
    Summary:
    Added test cases for eina_rectangle_union and eina_streq functions
    
    Signed-off-by: Vivek Ellur <vivek.el...@samsung.com>
    
    Reviewers: cedric
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2541
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/tests/eina/eina_test_rectangle.c | 36 +++++++++++++++++++++++++++++++++---
 src/tests/eina/eina_test_str.c       |  7 +++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/src/tests/eina/eina_test_rectangle.c 
b/src/tests/eina/eina_test_rectangle.c
index e5a211f..089b68b 100644
--- a/src/tests/eina/eina_test_rectangle.c
+++ b/src/tests/eina/eina_test_rectangle.c
@@ -72,9 +72,9 @@ START_TEST(eina_rectangle_pool)
 }
 END_TEST
 
-START_TEST(eina_rectangle_intersect)
+START_TEST(eina_rectangle_union_intersect)
 {
-   Eina_Rectangle r1, r2, r3, r4, rd;
+   Eina_Rectangle r1, r2, r3, r4, r5, r6, rd;
 
    fail_if(!eina_init());
 
@@ -82,6 +82,8 @@ START_TEST(eina_rectangle_intersect)
    EINA_RECTANGLE_SET(&r2, 20, 20, 20, 20);
    EINA_RECTANGLE_SET(&r3, 0,   0, 10, 10);
    EINA_RECTANGLE_SET(&r4, 30, 30, 50, 50);
+   EINA_RECTANGLE_SET(&r5, 10, 10, 0, 0);
+   EINA_RECTANGLE_SET(&r6, 30, 30, 0, 0);
 
    rd = r1;
 
@@ -102,6 +104,34 @@ START_TEST(eina_rectangle_intersect)
            || rd.w != 30
            || rd.h != 30);
 
+   rd = r1;
+   eina_rectangle_union(&rd, &r2);
+   fail_if(rd.x != r1.x
+           || rd.y != r1.y
+           || rd.w != r1.w
+           || rd.h != r1.h);
+
+   rd = r1;
+   eina_rectangle_union(&rd, &r3);
+   fail_if(rd.x != 0
+           || rd.y != 0
+           || rd.w != 60
+           || rd.h != 60);
+
+   rd = r3;
+   eina_rectangle_union(&rd, &r4);
+   fail_if(rd.x != 0
+           || rd.y != 0
+           || rd.w != 80
+           || rd.h != 80);
+
+   rd = r5;
+   eina_rectangle_union(&rd, &r6);
+   fail_if(rd.x != 10
+           || rd.y != 10
+           || rd.w != 20
+           || rd.h != 20);
+
    eina_shutdown();
 }
 END_TEST
@@ -110,6 +140,6 @@ void
 eina_test_rectangle(TCase *tc)
 {
    tcase_add_test(tc, eina_rectangle_pool);
-   tcase_add_test(tc, eina_rectangle_intersect);
+   tcase_add_test(tc, eina_rectangle_union_intersect);
 }
 
diff --git a/src/tests/eina/eina_test_str.c b/src/tests/eina/eina_test_str.c
index be879db..8233dd8 100644
--- a/src/tests/eina/eina_test_str.c
+++ b/src/tests/eina/eina_test_str.c
@@ -80,6 +80,13 @@
    fail_if(eina_str_has_extension("xab", "xYz"));
    fail_if(eina_str_has_extension("", "x"));
 
+   fail_if(eina_streq("xab", NULL));
+   fail_if(eina_streq(NULL, "xab"));
+   fail_if(eina_streq("x", "xab"));
+   fail_if(eina_streq("xab", "XAB"));
+   fail_if(eina_streq("x", "x "));
+   fail_if(!eina_streq("xab", "xab"));
+
    fail_if(eina_strlen_bounded("abc", 1024) != strlen("abc"));
    fail_if(eina_strlen_bounded("abc", 2) != (size_t)-1);
 

-- 


Reply via email to