Beispiel #1
0
 public void SumOfPositive_NegativeOneThroughNegativeFive()
 {
     Assert.AreEqual(0, SumOfPositive.PositiveSum(new int[] { -1, -2, -3, -4, -5 }));
 }
Beispiel #2
0
 public static void RandomTest([Random(5, 120, 40)] int length)
 {
     int[] arr = RandomArray(length);
     Assert.AreEqual(Solution(arr), SumOfPositive.PositiveSum(arr), string.Format("Failed when arr = {0}", arr));
 }
Beispiel #3
0
 public void SumOfPositive_EmptyArray()
 {
     Assert.AreEqual(0, SumOfPositive.PositiveSum(new int[] {}));
 }
Beispiel #4
0
 public void SumOfPositive_SumNegative1ThenNegative5()
 {
     Assert.AreEqual(9, SumOfPositive.PositiveSum(new int[] { -1, 2, 3, 4, -5 }));
 }
Beispiel #5
0
 public void SumOfPositive_Sum1Negative2Through5()
 {
     Assert.AreEqual(13, SumOfPositive.PositiveSum(new int[] { 1, -2, 3, 4, 5 }));
 }
Beispiel #6
0
 public void SumOfPositive_Sum1Through5()
 {
     Assert.AreEqual(15, SumOfPositive.PositiveSum(new int[] { 1, 2, 3, 4, 5 }));
 }
Beispiel #7
0
 public static int SumOfPositive_Test(int[] arr)
 {
     return(SumOfPositive.PositiveSum(arr));
 }