[evolution-data-server/sqlite-refactor: 12/13] test-client-custom-summary.c: Fix expectations for phone number matches.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/sqlite-refactor: 12/13] test-client-custom-summary.c: Fix expectations for phone number matches.
- Date: Sat, 23 Nov 2013 15:38:25 +0000 (UTC)
commit 850cfc2803e194860ea6ab973726e5edb39e1383
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Sat Nov 23 22:12:28 2013 +0900
test-client-custom-summary.c: Fix expectations for phone number matches.
tests/libebook/client/test-client-custom-summary.c | 198 +++++++++++++++-----
1 files changed, 155 insertions(+), 43 deletions(-)
---
diff --git a/tests/libebook/client/test-client-custom-summary.c
b/tests/libebook/client/test-client-custom-summary.c
index 7f39e6d..a6ab18a 100644
--- a/tests/libebook/client/test-client-custom-summary.c
+++ b/tests/libebook/client/test-client-custom-summary.c
@@ -479,8 +479,9 @@ main (gint argc,
suites[i].custom,
FALSE);
+
/*********************************************
- * PHONE NUMBER QUERIES FOLLOW *
+ * PHONE NUMBERS *
*********************************************/
/* Expect E_CLIENT_ERROR_INVALID_QUERY, "ask Jenny for
@@ -500,29 +501,13 @@ main (gint argc,
suites[i].custom,
TRUE);
- /* These queries will do an index lookup with a custom summary,
- * and a full table scan matching with EBookBackendSexp when
- * the default summary is used. */
- add_client_test (
- suites[i].prefix,
- "/EqPhone/Exact/Common",
- suites[i].func,
- e_book_query_field_test (
- E_CONTACT_TEL,
- E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
- "+1 221.542.3789"),
- 1,
- suites[i].direct,
- suites[i].custom,
- TRUE);
-
/* This test checks that phone number matching works when
* deeply nested into a query, when ENABLE_PHONENUMBER is
* not defined, then it ensures that the query is refused
* while being deeply nested. */
add_client_test (
suites[i].prefix,
- "/EqPhone/Exact/Nested",
+ "/EqPhone/NestedQuery",
suites[i].func,
e_book_query_orv (
e_book_query_field_test (
@@ -550,9 +535,66 @@ main (gint argc,
TRUE);
/*********************************************
- * E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER *
+ * E_BOOK_QUERY_EQUALS_PHONE_NUMBER *
*********************************************/
+ /* Only exact matches are returned.
+ *
+ * Query: +1 221.542.3789
+ * +------------------------------+--------------------+
+ * | vCard Data: +1-221-5423789 | Matches: Exact |
+ * | vCard Data: +31-221-5423789 | Matches: None |
+ * +------------------------------+--------------------+
+ */
+ add_client_test (
+ suites[i].prefix,
+ "/EqPhone/Exact",
+ suites[i].func,
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
+ "+1 221.542.3789"),
+ 1,
+ suites[i].direct,
+ suites[i].custom,
+ TRUE);
+
+
+ /*
+ * Query: +49 408.765.5050
+ * +------------------------------+--------------------+
+ * | vCard Data: 408 765-5050 | Matches: National |
+ * | vCard Data: +1 408 765-5050 | Matches: None |
+ * | vCard Data: +49 408 765-5050 | Matches: Exact |
+ * +------------------------------+--------------------+
+ */
+ add_client_test (
+ suites[i].prefix,
+ "/EqPhone/Exact/Another",
+ suites[i].func,
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
+ "+49 408.765.5050"),
+ 1,
+ suites[i].direct,
+ suites[i].custom,
+ TRUE);
+ /*********************************************
+ * E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER *
+ *********************************************/
+ /* Test that a query term with no specified country returns
+ * all vCards that have the same national number regardless
+ * of country codes (including contacts which have no
+ * national number specified)
+ *
+ * Query: 408 765-5050
+ * +------------------------------+--------------------+
+ * | vCard Data: 408 765-5050 | Matches: National |
+ * | vCard Data: +1 408 765-5050 | Matches: National |
+ * | vCard Data: +49 408 765-5050 | Matches: National |
+ * +------------------------------+--------------------+
+ */
add_client_test (
suites[i].prefix,
"/EqPhone/National/WithoutCountry",
@@ -561,63 +603,89 @@ main (gint argc,
E_CONTACT_TEL,
E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
"408 765-5050"),
- 2,
+ 3,
suites[i].direct,
suites[i].custom,
TRUE);
+ /* Test that a query term with no specified country returns
+ * all vCards that have the same national number regardless
+ * of country codes.
+ *
+ * Query: 221.542.3789
+ * +------------------------------+--------------------+
+ * | vCard Data: +1-221-5423789 | Matches: National |
+ * | vCard Data: +31-221-5423789 | Matches: National |
+ * +------------------------------+--------------------+
+ */
add_client_test (
suites[i].prefix,
- "/EqPhone/National/en_US",
+ "/EqPhone/National/WithoutCountry2",
suites[i].func,
e_book_query_field_test (
E_CONTACT_TEL,
E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
- "+1 408 765-5050"),
+ "221.542.3789"),
2,
suites[i].direct,
suites[i].custom,
TRUE);
+ /* Test that querying with an explicit country code reports
+ * national number matches for numbers without a country
+ * code, and not for numbers with explicitly different
+ * country codes.
+ *
+ * Query: +1 408 765-5050
+ * +------------------------------+--------------------+
+ * | vCard Data: 408 765-5050 | Matches: National |
+ * | vCard Data: +1 408 765-5050 | Matches: Exact |
+ * | vCard Data: +49 408 765-5050 | Matches: None |
+ * +------------------------------+--------------------+
+ */
add_client_test (
suites[i].prefix,
- "/EqPhone/National/de_DE",
+ "/EqPhone/National/en_US",
suites[i].func,
e_book_query_field_test (
E_CONTACT_TEL,
E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
- "+49 408 765-5050"),
- 1,
+ "+1 408 765-5050"),
+ 2,
suites[i].direct,
suites[i].custom,
TRUE);
- /* Test that a query term with no specified country returns
- * all vCards that have the same national number regardless
- * of country codes.
- *
- * | Active Country Code: +1 | Query: 221.542.3789 | vCard Data: +1-221-5423789 | Matches:
yes |
- * | Active Country Code: +1 | Query: 221.542.3789 | vCard Data: +31-221-5423789 | Matches:
no |
+ /* Query: +49 408 765-5050
+ * +------------------------------+--------------------+
+ * | vCard Data: 408 765-5050 | Matches: National |
+ * | vCard Data: +1 408 765-5050 | Matches: None |
+ * | vCard Data: +49 408 765-5050 | Matches: Exact |
+ * +------------------------------+--------------------+
*/
add_client_test (
suites[i].prefix,
- "/EqPhone/National/Common",
+ "/EqPhone/National/de_DE",
suites[i].func,
e_book_query_field_test (
E_CONTACT_TEL,
E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
- "221.542.3789"),
- 1,
+ "+49 408 765-5050"),
+ 2,
suites[i].direct,
suites[i].custom,
TRUE);
+
/* Test that a query term with a specified country returns
* only vCards that are specifically in the specified country
* code.
*
- * | Active Country Code: +1 | Query: +49 221.542.3789 | vCard Data: +1-221-5423789 |
Matches: no |
- * | Active Country Code: +1 | Query: +49 221.542.3789 | vCard Data: +31-221-5423789 |
Matches: no |
+ * Query: +49 221.542.3789
+ * +------------------------------+--------------------+
+ * | vCard Data: +1-221-5423789 | Matches: None |
+ * | vCard Data: +31-221-5423789 | Matches: None |
+ * +------------------------------+--------------------+
*/
add_client_test (
suites[i].prefix,
@@ -632,10 +700,13 @@ main (gint argc,
suites[i].custom,
TRUE);
- /* Test that a query term with the active country code
+ /* Test that a query term with a country code
* specified returns a vCard with an unspecified country code.
*
- * | Active Country Code: +1 | Query: +1 514-845-8436 | vCard Data: 514-845-8436 | Matches:
yes |
+ * Query: +1 514-845-8436
+ * +------------------------------+--------------------+
+ * | vCard Data: 514-845-8436 | Matches: National |
+ * +------------------------------+--------------------+
*/
add_client_test (
suites[i].prefix,
@@ -650,10 +721,18 @@ main (gint argc,
suites[i].custom,
TRUE);
- /* Test that a query term with an arbitrary country code
- * specified returns a vCard with an unspecified country code.
+ /* Test that a query term with another country code
+ * specified again returns a vCard with an unspecified
+ * country code.
+ *
+ * This test can help make sure that we are properly
+ * ignoring whatever country code is active by default
+ * in our locale.
*
- * | Active Country Code: +1 | Query: +49 514-845-8436 | vCard Data: 514-845-8436 | Matches:
yes |
+ * Query: +49 514-845-8436
+ * +------------------------------+--------------------+
+ * | vCard Data: 514-845-8436 | Matches: National |
+ * +------------------------------+--------------------+
*/
add_client_test (
suites[i].prefix,
@@ -663,11 +742,23 @@ main (gint argc,
E_CONTACT_TEL,
E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
"+49 514-845-8436"),
- 0,
+ 1,
suites[i].direct,
suites[i].custom,
TRUE);
+
+
+ /********************************************
+ * E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER *
+ ********************************************/
+ /*
+ * Query: 5423789
+ * +------------------------------+--------------------+
+ * | vCard Data: +1-221-5423789 | Matches: Short |
+ * | vCard Data: +31-221-5423789 | Matches: Short |
+ * +------------------------------+--------------------+
+ */
add_client_test (
suites[i].prefix,
"/EqPhone/Short",
@@ -676,7 +767,28 @@ main (gint argc,
E_CONTACT_TEL,
E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
"5423789"),
- 1,
+ 2,
+ suites[i].direct,
+ suites[i].custom,
+ TRUE);
+
+ /*
+ * Query: 765-5050
+ * +------------------------------+--------------------+
+ * | vCard Data: 408 765-5050 | Matches: Short |
+ * | vCard Data: +1 408 765-5050 | Matches: Short |
+ * | vCard Data: +49 408 765-5050 | Matches: Short |
+ * +------------------------------+--------------------+
+ */
+ add_client_test (
+ suites[i].prefix,
+ "/EqPhone/Short/Another",
+ suites[i].func,
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
+ "765-5050"),
+ 3,
suites[i].direct,
suites[i].custom,
TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]