[evolution-data-server/openismus-work-3-8: 15/118] test-client-custom-summary.c: Added tests for regex queries
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work-3-8: 15/118] test-client-custom-summary.c: Added tests for regex queries
- Date: Wed, 2 Oct 2013 21:16:59 +0000 (UTC)
commit d4ae7022c7d24b281e2eb5cf963dea18e057a93c
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/Makefile.am | 3 +
tests/libebook/client/test-client-custom-summary.c | 101 +++++++++++++++++++-
tests/libebook/data/vcards/custom-10.vcf | 5 +
tests/libebook/data/vcards/custom-11.vcf | 5 +
tests/libebook/data/vcards/custom-12.vcf | 5 +
5 files changed, 117 insertions(+), 2 deletions(-)
---
diff --git a/tests/libebook/Makefile.am b/tests/libebook/Makefile.am
index fdf7a48..3240b27 100644
--- a/tests/libebook/Makefile.am
+++ b/tests/libebook/Makefile.am
@@ -82,6 +82,9 @@ EXTRA_DIST = \
$(srcdir)/data/vcards/custom-7.vcf \
$(srcdir)/data/vcards/custom-8.vcf \
$(srcdir)/data/vcards/custom-9.vcf \
+ $(srcdir)/data/vcards/custom-10.vcf \
+ $(srcdir)/data/vcards/custom-11.vcf \
+ $(srcdir)/data/vcards/custom-12.vcf \
$(NULL)
test_ebook_commit_contact_LDADD=$(TEST_LIBS)
diff --git a/tests/libebook/client/test-client-custom-summary.c
b/tests/libebook/client/test-client-custom-summary.c
index 989f333..82ac7ed 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 parent;
@@ -383,7 +383,7 @@ main (gint argc,
E_CONTACT_FULL_NAME,
E_BOOK_QUERY_BEGINS_WITH,
"B"),
- 2,
+ 3,
suites[i].direct,
suites[i].custom,
FALSE);
@@ -622,6 +622,103 @@ main (gint argc,
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]