Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
package g4001_4100.s4033_valid_k_unique_subarrays_i;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

import org.junit.jupiter.api.Test;

class SolutionTest {
@Test
void validSubarrays() {
assertArrayEquals(
new boolean[] {true, false},
new Solution().validSubarrays(new int[] {1, 1}, 1, new int[][] {{0, 1}, {0, 0}}));
assertThat(
new Solution().validSubarrays(new int[] {1, 1}, 1, new int[][] {{0, 1}, {0, 0}}),
equalTo(new boolean[] {true, false}));
}

@Test
void validSubarrays2() {
assertArrayEquals(
new boolean[] {true, false, false},
assertThat(
new Solution()
.validSubarrays(
new int[] {1, 2, 1, 2}, 2, new int[][] {{0, 3}, {0, 1}, {1, 2}}));
new int[] {1, 2, 1, 2}, 2, new int[][] {{0, 3}, {0, 1}, {1, 2}}),
equalTo(new boolean[] {true, false, false}));
}

@Test
void validSubarrays3() {
assertArrayEquals(
new boolean[] {},
new Solution().validSubarrays(new int[] {1, 2}, 2, new int[][] {}));
assertThat(
new Solution().validSubarrays(new int[] {1, 2}, 2, new int[][] {}),
equalTo(new boolean[] {}));
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package g4001_4100.s4036_lexicographically_largest_string_after_pair_transformations;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

import org.junit.jupiter.api.Test;

class SolutionTest {
@Test
void largestString() {
assertArrayEquals(
new String[] {"a", "ba", ""}, new Solution().largestString(new int[] {1, 3, 0}));
assertThat(
new Solution().largestString(new int[] {1, 3, 0}),
equalTo(new String[] {"a", "ba", ""}));
}

@Test
void largestString2() {
assertArrayEquals(
new String[] {"za"}, new Solution().largestString(new int[] {(1 << 25) | 1}));
assertThat(
new Solution().largestString(new int[] {(1 << 25) | 1}),
equalTo(new String[] {"za"}));
}
}
Loading