示例#1
0
    void FiveKWords()
    {
        Dictionary dict = Dictionaries.Load("5kwords");

        Assert.Equal(5000, dict.Words.Count);
        DictionaryLookupInfo result = DictionaryLookupInfo.BuildLookupInfo(dict);
    }
示例#2
0
    void TestDictLookup()
    {
        // bread and bred
        Dictionary dict = new Dictionary(new List <string> ()
        {
            "bre", "bread", "bred"
        });
        DictionaryLookupInfo result = DictionaryLookupInfo.BuildLookupInfo(dict);

        Assert.Equal(6, result.LookupInfo.Count);
        Assert.Equal(result.LookupInfo["b"], new WordLookupInfoData()
        {
            HasChildren = true, IsWord = false
        });
        Assert.Equal(result.LookupInfo["br"], new WordLookupInfoData()
        {
            HasChildren = true, IsWord = false
        });
        Assert.Equal(result.LookupInfo["bre"], new WordLookupInfoData()
        {
            HasChildren = true, IsWord = true
        });
        Assert.Equal(result.LookupInfo["brea"], new WordLookupInfoData()
        {
            HasChildren = true, IsWord = false
        });
        Assert.Equal(result.LookupInfo["bred"], new WordLookupInfoData()
        {
            HasChildren = false, IsWord = true
        });
        Assert.Equal(result.LookupInfo["bread"], new WordLookupInfoData()
        {
            HasChildren = false, IsWord = true
        });
    }