Exemplo n.º 1
0
        public void RunProblem()
        {
            var dic = new MagicDictionary();

            dic.BuildDict(new string[] { "hello", "leetcode" });

            var temp = dic.Search("hello");

            if (temp != false)
            {
                throw new Exception();
            }

            temp = dic.Search("hhllo");
            if (temp != true)
            {
                throw new Exception();
            }

            temp = dic.Search("hell");
            if (temp != false)
            {
                throw new Exception();
            }

            temp = dic.Search("leetcoded");
            if (temp != false)
            {
                throw new Exception();
            }
        }
Exemplo n.º 2
0
        public void SearchTest1()
        {
            var test = new MagicDictionary();

            test.BuildDict(new string[] { "hello", "hallo", "leetcode" });
            Assert.IsTrue(test.Search("hello"));
            Assert.IsTrue(test.Search("hhllo"));
            Assert.IsFalse(test.Search("hell"));
            Assert.IsFalse(test.Search("leetcoded"));
        }