예제 #1
0
        public void PowerSet1RecursiveCompleteTests1TwoItems()
        {
            var expected = new List <List <int> >
            {
                new List <int>(),
                new List <int>()
                {
                    1
                },
                new List <int>()
                {
                    2
                },
                new List <int>()
                {
                    1, 2
                }
            };
            var actual = PowerSet1RecursiveComplete.GetPowerSet(new[] { 1, 2 });

            Assert.AreEqual(actual.Count, expected.Count);
            for (var i = 0; i < expected.Count; i++)
            {
                CollectionAssert.AreEqual(expected[i], actual[i]);
            }
        }
예제 #2
0
        public void PowerSet1RecursiveCompleteTests1EmptySet()
        {
            var expected = new List <List <int> >
            {
                new List <int>()
            };
            var actual = PowerSet1RecursiveComplete.GetPowerSet(new int[0]);

            Assert.AreEqual(actual.Count, expected.Count);
            for (var i = 0; i < expected.Count; i++)
            {
                CollectionAssert.AreEqual(expected[i], actual[i]);
            }
        }