| OLD | NEW |
| 1 // Copyright (C) 2014 Google Inc. | 1 // Copyright (C) 2014 Google Inc. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 using i18n::addressinput::AddressData; | 24 using i18n::addressinput::AddressData; |
| 25 | 25 |
| 26 TEST(AddressDataTest, FormatForDisplayEmpty) { | 26 TEST(AddressDataTest, FormatForDisplayEmpty) { |
| 27 AddressData address; | 27 AddressData address; |
| 28 std::vector<std::string> actual; | 28 std::vector<std::string> actual; |
| 29 address.FormatForDisplay(&actual); | 29 address.FormatForDisplay(&actual); |
| 30 EXPECT_EQ(std::vector<std::string>(), actual); | 30 EXPECT_EQ(std::vector<std::string>(), actual); |
| 31 } | 31 } |
| 32 | 32 |
| 33 TEST(AddressDataTest, FormatForDisplayUs) { |
| 34 AddressData address; |
| 35 address.country_code = "US"; |
| 36 address.administrative_area = "Texas"; |
| 37 address.locality = "Houston"; |
| 38 address.postal_code = "77005"; |
| 39 address.address_lines.push_back("123 Main St"); |
| 40 address.address_lines.push_back("Apt 2"); |
| 41 address.organization = "ACME Corp."; |
| 42 address.recipient = "John Doe"; |
| 43 |
| 44 std::vector<std::string> actual; |
| 45 address.FormatForDisplay(&actual); |
| 46 |
| 47 std::vector<std::string> expected; |
| 48 expected.push_back(address.recipient); |
| 49 expected.push_back(address.organization); |
| 50 expected.insert(expected.end(), |
| 51 address.address_lines.begin(), |
| 52 address.address_lines.end()); |
| 53 expected.push_back(address.locality + ", " + address.administrative_area + |
| 54 " " + address.postal_code); |
| 55 |
| 56 EXPECT_EQ(expected, actual); |
| 57 } |
| 58 |
| 33 TEST(AddressDataTest, FormatForDisplayAr) { | 59 TEST(AddressDataTest, FormatForDisplayAr) { |
| 34 AddressData address; | 60 AddressData address; |
| 35 address.country_code = "AR"; | 61 address.country_code = "AR"; |
| 36 address.administrative_area = "Capital Federal"; | 62 address.administrative_area = "Capital Federal"; |
| 37 address.locality = "Buenos Aires"; | 63 address.locality = "Buenos Aires"; |
| 38 address.postal_code = "C1001AFB"; | 64 address.postal_code = "C1001AFB"; |
| 39 address.address_lines.push_back("Su Calle 123"); | 65 address.address_lines.push_back("Su Calle 123"); |
| 40 address.address_lines.push_back("5° Piso"); | 66 address.address_lines.push_back("5° Piso"); |
| 41 address.organization = "Empresa Ejemplo"; | 67 address.organization = "Empresa Ejemplo"; |
| 42 address.recipient = "Juan Perez"; | 68 address.recipient = "Juan Perez"; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 std::vector<std::string> expected( | 140 std::vector<std::string> expected( |
| 115 1, | 141 1, |
| 116 address.sorting_code + " " + | 142 address.sorting_code + " " + |
| 117 address.locality + " " + | 143 address.locality + " " + |
| 118 address.sorting_code); | 144 address.sorting_code); |
| 119 | 145 |
| 120 EXPECT_EQ(expected, actual); | 146 EXPECT_EQ(expected, actual); |
| 121 } | 147 } |
| 122 | 148 |
| 123 } // namespace | 149 } // namespace |
| OLD | NEW |