[evolution-data-server/openismus-work] test-client-custom-summary.c: Added tests for regex queries



commit f3e7807345d23dc84cba0f3bafac9f3211069e69
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri May 10 17:23:16 2013 +0900

    test-client-custom-summary.c: Added tests for regex queries

 tests/libebook/client/test-client-custom-summary.c |   98 +++++++++++++++++++-
 tests/libebook/data/vcards/custom-10.vcf           |    5 +
 tests/libebook/data/vcards/custom-11.vcf           |    5 +
 tests/libebook/data/vcards/custom-12.vcf           |    5 +
 4 files changed, 111 insertions(+), 2 deletions(-)
---
diff --git a/tests/libebook/client/test-client-custom-summary.c 
b/tests/libebook/client/test-client-custom-summary.c
index 23c8f46..0f2e281 100644
--- a/tests/libebook/client/test-client-custom-summary.c
+++ b/tests/libebook/client/test-client-custom-summary.c
@@ -69,7 +69,7 @@ static ETestServerClosure setup_default_closure = { E_TEST_SERVER_ADDRESS_BOOK,
 #  define CHECK_UNSUPPORTED_ERROR(data) (((ClientTestData *)(data))->phone_number_query != FALSE)
 #endif
 
-#define N_CONTACTS 9
+#define N_CONTACTS 12
 
 typedef struct {
        ETestServerClosure closure;
@@ -344,7 +344,7 @@ main (gint argc,
 
                add_client_test (suites[i].prefix, "/Prefix/FullName", suites[i].func,
                                 e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "B"),
-                                2, suites[i].direct, suites[i].custom, FALSE);
+                                3, suites[i].direct, suites[i].custom, FALSE);
 
                add_client_test (suites[i].prefix, "/Prefix/FullName/Percent", suites[i].func,
                                 e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, "%"),
@@ -460,6 +460,100 @@ main (gint argc,
                                 e_book_query_field_test (E_CONTACT_TEL, 
E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER, "5423789"),
                                 1, suites[i].direct, suites[i].custom, TRUE);
 
+               /*********************************************
+                *             REGEX QUERIES FOLLOW          *
+                *********************************************/
+               add_client_test (
+                       suites[i].prefix,
+                       "/Regex/Normal/.*jack.*",
+                       suites[i].func,
+                       e_book_query_field_test (
+                               E_CONTACT_FULL_NAME,
+                               E_BOOK_QUERY_REGEX_NORMAL,
+                               ".*jack.*"),
+                       2,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/Regex/Normal/Keypad/^[jkl5][ghi4][mno6].*",
+                       suites[i].func,
+                       e_book_query_field_test (
+                               E_CONTACT_FULL_NAME,
+                               E_BOOK_QUERY_REGEX_NORMAL,
+                               "^[jkl5][ghi4][mno6].*"),
+                       3,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/Regex/Normal/Fuzzy/VanityNumber/ELEPHANT",
+                       suites[i].func,
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_REGEX_NORMAL,
+                               ".*[def3]"           /* E */
+                               "[^\\da-z]*[jkl5]"    /* L */
+                               "[^\\da-z]*[def3]"    /* E */
+                               "[^\\da-z]*[pqrs7]"   /* P */
+                               "[^\\da-z]*[ghi4]"    /* H */
+                               "[^\\da-z]*[abc2]"    /* A */
+                               "[^\\da-z]*[mno6]"    /* N */
+                               "[^\\da-z]*[tuv8].*"),/* T */
+                       3,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/Regex/Raw/.*Jack.*",
+                       suites[i].func,
+                       e_book_query_field_test (
+                               E_CONTACT_FULL_NAME,
+                               E_BOOK_QUERY_REGEX_RAW,
+                               ".*Jack.*"),
+                       2,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/Regex/Raw/Keypad/^[jkl5][ghi4][mno6].*",
+                       suites[i].func,
+                       e_book_query_field_test (
+                                E_CONTACT_FULL_NAME,
+                               E_BOOK_QUERY_REGEX_RAW,
+                               "^[jklJKL5][ghiGHI4][mnoMNO6].*"),
+                       3,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
+
+               add_client_test (
+                       suites[i].prefix,
+                       "/Regex/Raw/Fuzzy/VanityNumber/ELEPHANT",
+                       suites[i].func,
+                       e_book_query_field_test (
+                               E_CONTACT_TEL,
+                               E_BOOK_QUERY_REGEX_RAW,
+                               ".*[defDEF3]"            /* E */
+                               "[^\\da-z]*[jklJKL5]"    /* L */
+                               "[^\\da-z]*[defDEF3]"    /* E */
+                               "[^\\da-z]*[pqrsPQRS7]"  /* P */
+                               "[^\\da-z]*[ghiGHI4]"    /* H */
+                               "[^\\da-z]*[abcABC2]"    /* A */
+                               "[^\\da-z]*[mnoMNO6]"    /* N */
+                               "[^\\da-z]*[tuvTUV8].*"),/* T */
+                       3,
+                       suites[i].direct,
+                       suites[i].custom,
+                       FALSE);
        }
 
        ret = e_test_server_utils_run ();
diff --git a/tests/libebook/data/vcards/custom-10.vcf b/tests/libebook/data/vcards/custom-10.vcf
new file mode 100644
index 0000000..48a1c20
--- /dev/null
+++ b/tests/libebook/data/vcards/custom-10.vcf
@@ -0,0 +1,5 @@
+BEGIN:VCARD
+N:Morrison;Jim
+TEL;HOME:1 800 ELEPHANT
+EMAIL;TYPE=home,work:jim morrison com
+END:VCARD
diff --git a/tests/libebook/data/vcards/custom-11.vcf b/tests/libebook/data/vcards/custom-11.vcf
new file mode 100644
index 0000000..a0f0308
--- /dev/null
+++ b/tests/libebook/data/vcards/custom-11.vcf
@@ -0,0 +1,5 @@
+BEGIN:VCARD
+N:Basinger;Kim
+TEL;HOME:1-800-ELEPHANT
+EMAIL;TYPE=home,work:kim basinger com
+END:VCARD
diff --git a/tests/libebook/data/vcards/custom-12.vcf b/tests/libebook/data/vcards/custom-12.vcf
new file mode 100644
index 0000000..5b011a0
--- /dev/null
+++ b/tests/libebook/data/vcards/custom-12.vcf
@@ -0,0 +1,5 @@
+BEGIN:VCARD
+N:Stirling;Lindsey
+TEL;HOME:1.800 E L E P H A N T
+EMAIL;TYPE=home,work:lindsey stirling com
+END:VCARD


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