Exemplo n.º 1
0
        public void TestNumGen()
        {
            var result = new AllCombinations().GenerateIndexes(9, 3).ToList();

            foreach (var r in result)
            {
                output.WriteLine(string.Join(",", r));
            }

            Assert.Equal(120, result.Count);
        }
Exemplo n.º 2
0
        public void SolveWithGenerator(List <int> nums, int size, List <List <int> > expected)
        {
            var result = new AllCombinations().SolveWithGenerator(nums, size);

            foreach (var r in result)
            {
                output.WriteLine("new List<int> {" + string.Join(",", r) + "},");
            }

            Assert.Equal(expected.OrderBy(e => string.Concat(e)), result.OrderBy(e => string.Concat(e)));
        }