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();
            }
        }
        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"));
        }
Beispiel #3
0
 //setup player
 public Player(CombatManager manager, ItemDictionary inventory) : base(manager, inventory)
 {
     attributes = new Attributes(1, 5, 5, 5, 5);
     attributes.SetResource();
     combatManager = manager;
     spellBook     = new MagicDictionary(this, combatManager);
     //spell tests
     spellBook.Fireball();
     spellBook.ConeOfCold();
     spellBook.Heal();
 }
Beispiel #4
0
        public static void Main()
        {
            MagicDictionary solution = new MagicDictionary();

            solution.BuildDict(new[] { "h", "hh", "hal", "hello", "welly", "leetcode" });

            Test.Check(solution.Search, "hell", false);
            Test.Check(solution.Search, "hello", false);
            Test.Check(solution.Search, "hellow", false);

            Test.Check(solution.Search, "gello", true);
            Test.Check(solution.Search, "hhllo", true);
            Test.Check(solution.Search, "heplo", true);
            Test.Check(solution.Search, "helpo", true);
            Test.Check(solution.Search, "hellz", true);

            Test.Check(solution.Search, "hhllz", false);

            Test.Check(solution.Search, "leetcode", false);
            Test.Check(solution.Search, "leetcodz", true);
            Test.Check(solution.Search, "leetcade", true);
            Test.Check(solution.Search, "le3tcode", true);
            Test.Check(solution.Search, "lootcode", false);
        }