[evolution-data-server/sqlite-refactor: 17/18] test-client-custom-summary.c: Added AND and OR and nested query tests.



commit 9e320be2f62250c4a5c9eb26bbc8c0f87dc80e16
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Mon Nov 25 23:40:47 2013 +0900

    test-client-custom-summary.c: Added AND and OR and nested query tests.

 tests/libebook/client/test-client-custom-summary.c |  117 ++++++++++++++++++++
 1 files changed, 117 insertions(+), 0 deletions(-)
---
diff --git a/tests/libebook/client/test-client-custom-summary.c 
b/tests/libebook/client/test-client-custom-summary.c
index f8eeb62..f30e3df 100644
--- a/tests/libebook/client/test-client-custom-summary.c
+++ b/tests/libebook/client/test-client-custom-summary.c
@@ -543,6 +543,123 @@ main (gint argc,
                        suites[i].custom,
                        FALSE);
 
+               add_client_test (
+                       suites[i].prefix,
+                       "/And/EmailFullName",
+                       suites[i].func,
+                       e_book_query_andv (
+                               /* There are 9 contacts with emails ending in ".com"  */
+                               e_book_query_field_test (
+                                       E_CONTACT_EMAIL,
+                                       E_BOOK_QUERY_ENDS_WITH,
+                                       ".com"),
+                               /* Contacts custom-1 and custom-2 have Jackson in the full name */
+                               e_book_query_field_test (
+                                       E_CONTACT_FULL_NAME,
+                                       E_BOOK_QUERY_CONTAINS,
+                                       "Jackson"),
+                               NULL),
+                       2,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/And/EmailEmail",
+                       suites[i].func,
+                       e_book_query_andv (
+                               /* There are 9 contacts with emails ending in ".com"  */
+                               e_book_query_field_test (
+                                       E_CONTACT_EMAIL,
+                                       E_BOOK_QUERY_ENDS_WITH,
+                                       ".com"),
+                               /* Contacts custom-1 and custom-2 have Jackson in the email */
+                               e_book_query_field_test (
+                                       E_CONTACT_EMAIL,
+                                       E_BOOK_QUERY_CONTAINS,
+                                       "jackson"),
+                               NULL),
+                       2,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/And/EmailPhone",
+                       suites[i].func,
+                       e_book_query_andv (
+                               /* custom-13 begins with eddie */
+                               e_book_query_field_test (
+                                       E_CONTACT_EMAIL,
+                                       E_BOOK_QUERY_BEGINS_WITH,
+                                       "eddie"),
+                               /* custom-13, custom-14 & custom-15 end with 5050 */
+                               e_book_query_field_test (
+                                       E_CONTACT_TEL,
+                                       E_BOOK_QUERY_ENDS_WITH,
+                                       "5050"),
+                               NULL),
+                       1,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/And/EmailPhoneFamiliy",
+                       suites[i].func,
+                       e_book_query_andv (
+                               /* custom-13 family name is Murphey */
+                               e_book_query_field_test (
+                                       E_CONTACT_FAMILY_NAME,
+                                       E_BOOK_QUERY_IS,
+                                       "Murphey"),
+                               /* custom-13 begins with eddie */
+                               e_book_query_field_test (
+                                       E_CONTACT_EMAIL,
+                                       E_BOOK_QUERY_BEGINS_WITH,
+                                       "eddie"),
+                               /* custom-13, custom-14 & custom-15 end with 5050 */
+                               e_book_query_field_test (
+                                       E_CONTACT_TEL,
+                                       E_BOOK_QUERY_ENDS_WITH,
+                                       "5050"),
+                               NULL),
+                       1,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/And/Familiy/Or/EmailEmail",
+                       suites[i].func,
+                       e_book_query_andv (
+                               /* Contacts custom-1 and custom-2 have Jackson in the full name */
+                               e_book_query_field_test (
+                                       E_CONTACT_FULL_NAME,
+                                       E_BOOK_QUERY_CONTAINS,
+                                       "Jackson"),
+                               e_book_query_orv (
+                                       /* There are 9 contacts with emails ending in ".com"  */
+                                       e_book_query_field_test (
+                                               E_CONTACT_EMAIL,
+                                               E_BOOK_QUERY_ENDS_WITH,
+                                               ".com"),
+                                       /* Contacts custom-1 and custom-2 have Jackson in the email */
+                                       e_book_query_field_test (
+                                               E_CONTACT_EMAIL,
+                                               E_BOOK_QUERY_CONTAINS,
+                                               "jackson"),
+                                       NULL),
+                               NULL),
+                       2,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
                /*********************************************
                 *                PHONE NUMBERS              *
                 *********************************************/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]