| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 L"I", | 143 L"I", |
| 144 L"he", | 144 L"he", |
| 145 L"she", | 145 L"she", |
| 146 L"it", | 146 L"it", |
| 147 L"we", | 147 L"we", |
| 148 L"you", | 148 L"you", |
| 149 L"they", | 149 L"they", |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 std::map<base::string16, bool> word_list; | 152 std::map<base::string16, bool> word_list; |
| 153 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) | 153 for (size_t i = 0; i < arraysize(kWords); ++i) |
| 154 word_list.insert( | 154 word_list.insert( |
| 155 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), | 155 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), |
| 156 true)); | 156 true)); |
| 157 | 157 |
| 158 RunDictionaryTest(kCodepage, word_list); | 158 RunDictionaryTest(kCodepage, word_list); |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Tests whether or not our DicReader can read all the input Russian words. | 161 // Tests whether or not our DicReader can read all the input Russian words. |
| 162 TEST(ConvertDictTest, Russian) { | 162 TEST(ConvertDictTest, Russian) { |
| 163 const char kCodepage[] = "KOI8-R"; | 163 const char kCodepage[] = "KOI8-R"; |
| 164 const wchar_t* kWords[] = { | 164 const wchar_t* kWords[] = { |
| 165 L"\x044f", | 165 L"\x044f", |
| 166 L"\x0442\x044b", | 166 L"\x0442\x044b", |
| 167 L"\x043e\x043d", | 167 L"\x043e\x043d", |
| 168 L"\x043e\x043d\x0430", | 168 L"\x043e\x043d\x0430", |
| 169 L"\x043e\x043d\x043e", | 169 L"\x043e\x043d\x043e", |
| 170 L"\x043c\x044b", | 170 L"\x043c\x044b", |
| 171 L"\x0432\x044b", | 171 L"\x0432\x044b", |
| 172 L"\x043e\x043d\x0438", | 172 L"\x043e\x043d\x0438", |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 std::map<base::string16, bool> word_list; | 175 std::map<base::string16, bool> word_list; |
| 176 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) | 176 for (size_t i = 0; i < arraysize(kWords); ++i) |
| 177 word_list.insert( | 177 word_list.insert( |
| 178 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), | 178 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), |
| 179 true)); | 179 true)); |
| 180 | 180 |
| 181 RunDictionaryTest(kCodepage, word_list); | 181 RunDictionaryTest(kCodepage, word_list); |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Tests whether or not our DicReader can read all the input Hungarian words. | 184 // Tests whether or not our DicReader can read all the input Hungarian words. |
| 185 TEST(ConvertDictTest, Hungarian) { | 185 TEST(ConvertDictTest, Hungarian) { |
| 186 const char kCodepage[] = "ISO8859-2"; | 186 const char kCodepage[] = "ISO8859-2"; |
| 187 const wchar_t* kWords[] = { | 187 const wchar_t* kWords[] = { |
| 188 L"\x00e9\x006e", | 188 L"\x00e9\x006e", |
| 189 L"\x0074\x0065", | 189 L"\x0074\x0065", |
| 190 L"\x0151", | 190 L"\x0151", |
| 191 L"\x00f6\x006e", | 191 L"\x00f6\x006e", |
| 192 L"\x006d\x0061\x0067\x0061", | 192 L"\x006d\x0061\x0067\x0061", |
| 193 L"\x006d\x0069", | 193 L"\x006d\x0069", |
| 194 L"\x0074\x0069", | 194 L"\x0074\x0069", |
| 195 L"\x0151\x006b", | 195 L"\x0151\x006b", |
| 196 L"\x00f6\x006e\x00f6\x006b", | 196 L"\x00f6\x006e\x00f6\x006b", |
| 197 L"\x006d\x0061\x0067\x0075\x006b", | 197 L"\x006d\x0061\x0067\x0075\x006b", |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 std::map<base::string16, bool> word_list; | 200 std::map<base::string16, bool> word_list; |
| 201 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) | 201 for (size_t i = 0; i < arraysize(kWords); ++i) |
| 202 word_list.insert( | 202 word_list.insert( |
| 203 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), | 203 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), |
| 204 true)); | 204 true)); |
| 205 | 205 |
| 206 RunDictionaryTest(kCodepage, word_list); | 206 RunDictionaryTest(kCodepage, word_list); |
| 207 } | 207 } |
| OLD | NEW |