Skip to content

Commit

Permalink
test: write test MaximumSubarray
Browse files Browse the repository at this point in the history
  • Loading branch information
rldnrl committed Nov 26, 2022
1 parent c0d8b1a commit bd05663
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/leetcode/MaximumSubarrayTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package leetcode;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

class MaximumSubarrayTest {
@Test
void maximumSubarrayTest() {
int[] nums1 = new int[]{-2,1,-3,4,-1,2,1,-5,4};
int result1 = 6;
Assertions.assertEquals(MaximumSubarray.maxSubarrayWithBruteforce(nums1), result1);

int[] nums2 = new int[]{1};
int result2 = 1;
Assertions.assertEquals(MaximumSubarray.maxSubarrayWithBruteforce(nums2), result2);

int[] nums3 = new int[]{5,4,-1,7,8};
int result3 = 23;
Assertions.assertEquals(MaximumSubarray.maxSubarrayWithBruteforce(nums3), result3);
}
}

0 comments on commit bd05663

Please sign in to comment.