Example #1
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsNothing_ForEmptySequence()
        {
            var array = new int[] { };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 1)
                );
        }
Example #2
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsNothing_IfThreePartitionsNotPossible()
        {
            var array = new[] { 2, 1, 3, 2, 5 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 3)
                );
        }
Example #3
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsEverything_IfOnlyOnePartition()
        {
            var array = new[] { 1, 2, 3, 4, 5 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 1),
                new[] { 1, 2, 3, 4, 5 });
        }
Example #4
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsTwoPartitions_IfPossible()
        {
            var array = new[] { 2, 1, 3, 2 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 2),
                new[] { 2, 2 },
                new[] { 1, 3 }
                );
        }
Example #5
0
        public void SplitIntoSubsetsOfEqualValue_ReturnsEmptyArrayAndAll_ForNegativeZeroing()
        {
            var array = new[] { -1, 1 };

            TestHelper.AssertSequence(
                Set.SplitIntoSubsetsOfEqualValue(array, IntegerAggregator, Comparer <int> .Default, 2),
                new[] { -1, 1 },
                new int[] { }
                );
        }
Example #6
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IfAggregatorIsNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.SplitIntoSubsetsOfEqualValue(new[] { 1 }, null, Comparer <int> .Default, 1));
 }
Example #7
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IsCountOfPartitionsLessThanOne()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                 Set.SplitIntoSubsetsOfEqualValue(new[] { 1 }, IntegerAggregator, Comparer <int> .Default, 0));
 }
Example #8
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IfSequenceIsNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.SplitIntoSubsetsOfEqualValue(null, IntegerAggregator, Comparer <int> .Default, 1));
 }
Example #9
0
 public void SplitIntoSubsetsOfEqualValue_ThrowsException_IfComparerIsNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           Set.SplitIntoSubsetsOfEqualValue(new[] { 1 }, IntegerAggregator, null, 1));
 }