169 |
172 |
170 LOCAL_C void DontUnderestimateTheMeaningOfZeroL() |
173 LOCAL_C void DontUnderestimateTheMeaningOfZeroL() |
171 { |
174 { |
172 ResetDatabaseL(); |
175 ResetDatabaseL(); |
173 |
176 |
174 //Database contains only this number 207 946 0321; |
177 //Database contains only this number 228 876 5324; |
175 CreateContactL(KCntName,KCntSurname,_L("207 946 0321"),KNullDesC); |
178 CreateContactL(KCntName,KCntSurname,_L("228 876 5324"),KNullDesC); |
176 //Trying to search on that exact number by 6 digits... |
179 //Trying to search on that exact number by 6 digits... |
177 TESTVALUE(CheckPhoneMatchL( _L("207 946 0321"), 6),0); |
180 TESTVALUE(CheckPhoneMatchL( _L("228 876 5324"), 6),0); |
178 //No matches, well I kind of expected it... :-( |
181 //No matches, well I kind of expected it... :-( |
179 |
182 |
180 //Now we add a number that differs from the first one by one digit.. |
183 //Now we add a number that differs from the first one by one digit.. |
181 CreateContactL(KCntName,KCntSurname,_L("207 046 0321"),KNullDesC); |
184 CreateContactL(KCntName,KCntSurname,_L("228 076 5324"),KNullDesC); |
182 |
185 |
183 //Repeat our search |
186 //Repeat our search |
184 TESTVALUE(CheckPhoneMatchL( _L("207 946 0321"), 6),1); |
187 TESTVALUE(CheckPhoneMatchL( _L("228 876 5324"), 6),1); |
185 //It matches!!... Please don't laugh! There is logic in it! |
188 //It matches!!... Please don't laugh! There is logic in it! |
186 //If the number doesn't match to itself - then it should match on different one! ;-) |
189 //If the number doesn't match to itself - then it should match on different one! ;-) |
187 } |
190 } |
188 |
191 |
189 |
192 |
190 LOCAL_C void Test2L() |
193 LOCAL_C void Test2L() |
191 { |
194 { |
192 ResetDatabaseL(); |
195 ResetDatabaseL(); |
193 |
196 |
194 //if 5324 doesn't match to 228 100 5324... |
197 //if 5324 doesn't match to 228 100 5324... |
195 CreateContactL(KCntName,KCntSurname,_L("207 100 0324"),KNullDesC); |
198 CreateContactL(KCntName,KCntSurname,_L("228 100 5324"),KNullDesC); |
196 TESTVALUE(CheckPhoneMatchL( _L("0324"),11),0); |
199 TESTVALUE(CheckPhoneMatchL( _L("5324"),11),0); |
197 TESTVALUE(CheckPhoneMatchL( _L("0324"), 4),0); |
200 TESTVALUE(CheckPhoneMatchL( _L("5324"), 4),0); |
198 |
201 |
199 //it shouldn't match to 228 000 5324 as well, but... it does |
202 //it shouldn't match to 228 000 5324 as well, but... it does |
200 CreateContactL(KCntName,KCntSurname,_L("207 000 0324"),KNullDesC); |
203 CreateContactL(KCntName,KCntSurname,_L("228 000 5324"),KNullDesC); |
201 TESTVALUE(CheckPhoneMatchL( _L("0324"),11),1); // AB |
204 TESTVALUE(CheckPhoneMatchL( _L("5324"),11),1); // AB |
202 TESTVALUE(CheckPhoneMatchL( _L("0324"), 4),1); |
205 TESTVALUE(CheckPhoneMatchL( _L("5324"), 4),1); |
203 } |
206 } |
204 |
207 |
205 |
208 |
206 LOCAL_C void TestCallingAmericaL() |
209 LOCAL_C void TestCallingAmericaL() |
207 { |
210 { |
208 ResetDatabaseL(); |
211 ResetDatabaseL(); |
209 |
212 |
210 //here are some additional test numbers for testing the acceptance of the '(+' combination |
213 //here are some additional test numbers for testing the acceptance of the '(+' combination |
211 CreateContactL(KCntName,KCntSurname,_L("(+020) 79460123"),KNullDesC); |
214 CreateContactL(KCntName,KCntSurname,_L("(+358) 1234567"),KNullDesC); |
212 CreateContactL(KCntName,KCntSurname,_L("(020) 79460123"),KNullDesC); |
215 CreateContactL(KCntName,KCntSurname,_L("(358) 1234567"),KNullDesC); |
213 CreateContactL(KCntName,KCntSurname,_L("+020 79460123"),KNullDesC); |
216 CreateContactL(KCntName,KCntSurname,_L("+358 1234567"),KNullDesC); |
214 |
217 |
215 //when searching for any of the above numbers 3 instances should be found |
218 //when searching for any of the above numbers 3 instances should be found |
216 TESTVALUE(CheckPhoneMatchL(_L("(+020) 79460123"),10),3); |
219 TESTVALUE(CheckPhoneMatchL(_L("(+358) 1234567"),10),3); |
217 TESTVALUE(CheckPhoneMatchL(_L("(020) 79460123"),10),3); |
220 TESTVALUE(CheckPhoneMatchL(_L("(358) 1234567"),10),3); |
218 TESTVALUE(CheckPhoneMatchL(_L("+020 79460123"),10),3); |
221 TESTVALUE(CheckPhoneMatchL(_L("+358 1234567"),10),3); |
219 |
222 |
220 // Note that the phone number parser does generate a hash of 0 for all |
223 // Note that the phone number parser does generate a hash of 0 for all |
221 //these now that the '(+'combination is recognised |
224 //these now that the '(+'combination is recognised |
222 CreateContactL(KCntName,KCntSurname,_L("(+1) 0755 345 3644 644"),KNullDesC); |
225 CreateContactL(KCntName,KCntSurname,_L("(+1) 0755 345 3644 644"),KNullDesC); |
223 CreateContactL(KCntName,KCntSurname,_L("(+1) 0789 37737 39173-1"),KNullDesC); |
226 CreateContactL(KCntName,KCntSurname,_L("(+1) 0789 37737 39173-1"),KNullDesC); |