// Copyright 2011 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/40285824): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include <stddef.h> #include <map> #include <string> #include "base/containers/span.h" #include "base/files/file_util.h" #include "base/format_macros.h" #include "base/i18n/icu_string_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/tools/convert_dict/aff_reader.h" #include "chrome/tools/convert_dict/dic_reader.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/hunspell/google/bdict_reader.h" #include "third_party/hunspell/google/bdict_writer.h" namespace { // Compares the given word list with the serialized trie to make sure they // are the same. // (This function is copied from "chrome/tools/convert_dict/convert_dict.cc"). bool VerifyWords(const convert_dict::DicReader::WordList& org_words, const std::string& serialized) { … } // Implements the test process used by ConvertDictTest. // This function encapsulates all complicated operations used by // ConvertDictTest so we can conceal them from the tests themselves. // This function consists of the following parts: // * Creates a dummy affix file and a dictionary file. // * Reads the dummy files. // * Creates bdict data. // * Verify the bdict data. void RunDictionaryTest(const char* codepage, const std::map<std::u16string, bool>& word_list) { … } } // namespace // Tests whether or not our DicReader can read all the input English words TEST(ConvertDictTest, English) { … } // Tests whether or not our DicReader can read all the input Russian words. TEST(ConvertDictTest, Russian) { … } // Tests whether or not our DicReader can read all the input Hungarian words. TEST(ConvertDictTest, Hungarian) { … }