summaryrefslogtreecommitdiff
path: root/android/PhoneNumberUtilsTest.cpp
diff options
context:
space:
mode:
authorWei Huang <weih@google.com>2009-08-31 20:30:48 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-08-31 20:30:48 -0700
commit50db2efc4d4e41ddf4788a1d8e3eea352364639d (patch)
treea4ce54cef69e95e8748e6cc7a6af11d9ecd4ef4d /android/PhoneNumberUtilsTest.cpp
parente9f4268266b65edb3e11641dc551269c6fcf5630 (diff)
parent0d04c4caa9c0464f555eed458abf2ac7d997ad7d (diff)
am 0d04c4ca: fix bug 2015059: where the native sqlite comparison method phone_number_compare() treated all alpha addresses as the same phone number.
Merge commit '0d04c4caa9c0464f555eed458abf2ac7d997ad7d' into eclair * commit '0d04c4caa9c0464f555eed458abf2ac7d997ad7d': fix bug 2015059: where the native sqlite comparison method phone_number_compare() treated all alpha addresses as the same phone number.
Diffstat (limited to 'android/PhoneNumberUtilsTest.cpp')
-rw-r--r--android/PhoneNumberUtilsTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/android/PhoneNumberUtilsTest.cpp b/android/PhoneNumberUtilsTest.cpp
index b033f9d..a33f10a 100644
--- a/android/PhoneNumberUtilsTest.cpp
+++ b/android/PhoneNumberUtilsTest.cpp
@@ -126,6 +126,23 @@ int main() {
EXPECT_EQ("650-000-3456", "16500003456");
EXPECT_EQ("16610001234", "6610001234");
+ // We also need to compare two alpha addresses to make sure two different strings
+ // aren't treated as the same addresses. This is relevant to SMS as SMS sender may
+ // contain all alpha chars.
+ EXPECT_NE("abcd", "bcde");
+
+ // in the U.S. people often use alpha in the phone number to easily remember it
+ // (e.g. 800-flowers would be dialed as 800-356-9377). Since we accept this form of
+ // phone number in Contacts and others, we should make sure the comparison method
+ // handle them.
+ EXPECT_EQ("1-800-flowers", "800-flowers");
+
+ // TODO: we currently do not support this comparison. It maybe nice to support this
+ // TODO: in the future.
+ // EXPECT_EQ("1-800-flowers", "1-800-356-9377")
+
+ EXPECT_NE("1-800-flowers", "1-800-abcdefg");
+
// Currently we cannot get this test through (Japanese trunk prefix is 0,
// but there is no sensible way to know it now (as of 2009-6-12)...
// EXPECT_NE("290-1234-5678", "+819012345678");