Skip to content

Commit 12af208

Browse files
committed
fix(test): reduce test timeout and add problem skip list
1 parent abbb783 commit 12af208

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/test/java/MavenTest.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import java.util.Arrays;
1212
import java.util.Collection;
1313
import java.util.Collections;
14+
import java.util.HashSet;
1415
import java.util.List;
16+
import java.util.Set;
1517
import java.util.concurrent.TimeUnit;
1618
import java.util.regex.Pattern;
1719
import java.util.stream.Collectors;
@@ -22,11 +24,16 @@
2224
public class MavenTest {
2325

2426
// Define the timeout for each test
25-
private static final Duration TEST_TIMEOUT = Duration.ofSeconds(10);
27+
private static final Duration TEST_TIMEOUT = Duration.ofSeconds(5);
2628

2729
// Regex pattern to match "p" followed by only digits
2830
private static final Pattern PROBLEM_DIR_PATTERN = Pattern.compile("p\\d+");
2931

32+
// Define a skip list for problems to exclude
33+
private static final Set<String> SKIP_PROBLEMS = new HashSet<>(Arrays.asList(
34+
"p10009" // Add problems to skip here
35+
));
36+
3037
// Method to dynamically discover problem names
3138
private static List<String> discoverProblemNames() {
3239
String basePackagePath = "com/lzw/solutions/uva/";
@@ -71,8 +78,11 @@ public boolean accept(File current, String name) {
7178
return Collections.emptyList();
7279
}
7380

74-
List<String> problems =
75-
Arrays.stream(problemDirs).map(File::getName).sorted().collect(Collectors.toList());
81+
List<String> problems = Arrays.stream(problemDirs)
82+
.map(File::getName)
83+
.filter(name -> !SKIP_PROBLEMS.contains(name)) // Filter out skipped problems
84+
.sorted()
85+
.collect(Collectors.toList());
7686

7787
// Read maxproblems system property
7888
String maxProblemsStr = System.getProperty("maxproblems");
@@ -91,7 +101,7 @@ public boolean accept(File current, String name) {
91101
}
92102
}
93103

94-
System.out.println("Discovered problems: " + problems);
104+
System.out.println("Discovered problems (after skipping): " + problems);
95105
return problems;
96106
}
97107

@@ -175,5 +185,4 @@ Collection<DynamicTest> runMavenExecTests() {
175185
}))
176186
.collect(Collectors.toList());
177187
}
178-
179188
}

0 commit comments

Comments
 (0)