1010#include " td/utils/tests.h"
1111
1212static void check_phone_number_info (td::string phone_number_prefix, const td::string &country_code,
13- const td::string &calling_code, const td::string &formatted_phone_number) {
13+ const td::string &calling_code, const td::string &formatted_phone_number,
14+ bool is_anonymous = false ) {
1415 auto result = td::CountryInfoManager::get_phone_number_info_sync (td::string (), phone_number_prefix);
1516 CHECK (result != nullptr );
1617 if (result->country_ == nullptr ) {
@@ -21,6 +22,7 @@ static void check_phone_number_info(td::string phone_number_prefix, const td::st
2122 CHECK (result->country_calling_code_ == calling_code);
2223 // LOG(ERROR) << phone_number_prefix << ' ' << result->formatted_phone_number_ << ' ' << formatted_phone_number;
2324 CHECK (result->formatted_phone_number_ == formatted_phone_number);
25+ CHECK (result->is_anonymous_ == is_anonymous);
2426}
2527
2628TEST (CountryInfo, phone_number_info) {
@@ -85,4 +87,13 @@ TEST(CountryInfo, phone_number_info) {
8587 check_phone_number_info (" 3196" , " NL" , " 31" , " 9 6- -- -- --" );
8688 check_phone_number_info (" 3197" , " NL" , " 31" , " 9 7- -- -- --" );
8789 check_phone_number_info (" 3198" , " NL" , " 31" , " 9 8- -- -- --" );
90+ check_phone_number_info (" 88" , " " , " 88" , " " );
91+ check_phone_number_info (" 888" , " FT" , " 888" , " ---- ----" , true );
92+ check_phone_number_info (" 8888" , " FT" , " 888" , " 8 ---" , true );
93+ check_phone_number_info (" 88888" , " FT" , " 888" , " 8 8--" , true );
94+ check_phone_number_info (" 888888" , " FT" , " 888" , " 8 88-" , true );
95+ check_phone_number_info (" 8888888" , " FT" , " 888" , " 8 888" , true );
96+ check_phone_number_info (" 88888888" , " FT" , " 888" , " 8 8888" , true );
97+ check_phone_number_info (" 888888888" , " FT" , " 888" , " 8 88888" , true );
98+ check_phone_number_info (" 8888888888" , " FT" , " 888" , " 8 888888" , true );
8899}
0 commit comments