diff options
author | Wei Huang <weih@google.com> | 2009-08-31 19:18:23 -0700 |
---|---|---|
committer | Wei Huang <weih@google.com> | 2009-08-31 20:08:39 -0700 |
commit | 0d04c4caa9c0464f555eed458abf2ac7d997ad7d (patch) | |
tree | cffa20a5af1f3ce5036a62354d9658b8d3b1a153 /android/PhoneNumberUtilsTest.cpp | |
parent | b020ccd8772182ddfccba30b5adbc500982b59c1 (diff) |
fix bug 2015059: where the native sqlite comparison method phone_number_compare() treated all alpha addresses as the same phone number.
- changed phone_number_compare() to handle alpha chars. Before this change the algorithm skipped over all non-dialable chars for
comparison, and thus treating "foo" and "bar" as the same addresses. now we don't skip any char that's alpha. This would treat
"foo" and "bar" as separate addresses, as well as treating "1-800-flowers" and "800-flowers" as the same number.
Diffstat (limited to 'android/PhoneNumberUtilsTest.cpp')
-rw-r--r-- | android/PhoneNumberUtilsTest.cpp | 17 |
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"); |