Skip to content

Improved tests #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions src/main/java/g1101_1200/s1117_building_h2o/H2O.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ public HydrogenRunnable(H2O h2O) {
this.h2O = h2O;
}

private static void run2() {}

@Override
public void run() {
try {
h2O.hydrogen(() -> System.out.print('H'));
h2O.hydrogen(HydrogenRunnable::run2);
} catch (InterruptedException ignored) {
// ignored
}
Expand All @@ -52,10 +54,12 @@ public OxygenRunnable(H2O h2O) {
this.h2O = h2O;
}

private static void run2() {}

@Override
public void run() {
try {
h2O.oxygen(() -> System.out.print('O'));
h2O.oxygen(OxygenRunnable::run2);
} catch (InterruptedException ignored) {
// ignored
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public List<List<Integer>> findCriticalAndPseudoCriticalEdges(int n, int[][] edg
pce.addAll(cur);
pce.add(ind);
}
if (!p) {
System.out.println("Should not reach here");
}
}
}
// critical edges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

import com_github_leetcode.CommonUtils;
import org.junit.jupiter.api.Test;

class SolutionTest {
@Test
void randPoint() {
Solution solution = new Solution(1.0, 0.0, 0.0);
CommonUtils.printArray(solution.randPoint());
CommonUtils.printArray(solution.randPoint());
CommonUtils.printArray(solution.randPoint());
solution.randPoint();
solution.randPoint();
solution.randPoint();
assertThat(solution, equalTo(solution));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

import com_github_leetcode.CommonUtils;
import org.junit.jupiter.api.Test;

class SolutionTest {
@Test
void solutionTest() {
Solution solution = new Solution(new int[][] {{-2, -2, 1, 1}, {2, 2, 4, 6}});
CommonUtils.printArray(solution.pick());
CommonUtils.printArray(solution.pick());
CommonUtils.printArray(solution.pick());
CommonUtils.printArray(solution.pick());
CommonUtils.printArray(solution.pick());
solution.pick();
solution.pick();
solution.pick();
solution.pick();
solution.pick();
assertThat(true, equalTo(true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

import com_github_leetcode.CommonUtils;
import org.junit.jupiter.api.Test;

class SolutionTest {
@Test
void solutionTest() {
Solution solution = new Solution(3, 1);
CommonUtils.printArray(solution.flip());
CommonUtils.printArray(solution.flip());
CommonUtils.printArray(solution.flip());
solution.flip();
solution.flip();
solution.flip();
solution.reset();
CommonUtils.printArray(solution.flip());
solution.flip();
assertThat(true, equalTo(true));
}
}
Loading