public void Test_GenericStr(string[] operations, string characters, int combinationLength, object[] expected)
        {
            var sol = new CombinationIterator(characters, combinationLength);

            object[] res = new object[operations.Length];

            int idx = 0;

            foreach (var op in operations)
            {
                switch (op)
                {
                case "next":
                    res[idx++] = sol.Next();
                    break;

                case "hasNext":
                    res[idx++] = sol.HasNext();
                    break;
                }
            }

            CollectionAssert.AreEqual(res, expected);
        }
示例#2
0
 static void Main(string[] args)
 {
     string characters        = "abc";
     int    combinationLength = 3;
     var    iterator          = new CombinationIterator(characters, combinationLength);
 }