Skip to content
Snippets Groups Projects
Verified Commit 7238d70d authored by Tóth Miklós Tibor's avatar Tóth Miklós Tibor :shrug:
Browse files

fix

parent 2e1dceea
Branches
No related tags found
No related merge requests found
Pipeline #7509 passed
......@@ -11,6 +11,19 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
public class Main {
private static String yeetEmpty(String input) {
var sb = new StringBuilder();
for (var line: input.split("\n")) {
var trimmed = line.trim();
if (trimmed.length() > 0) {
sb.append(trimmed);
sb.append("\n");
}
}
return sb.toString();
}
public static void main(String[] args) throws FileNotFoundException {
if (args.length < 2) {
System.out.println("usage: <tested_app.jar> <testcase.json>");
......@@ -21,6 +34,9 @@ public class Main {
TestCase test = gson.fromJson(new FileReader(args[1]), TestCase.class);
test.input = yeetEmpty(test.input);
test.output = yeetEmpty(test.output);
if (System.getProperty("os.name").toLowerCase().contains("win")){
try {
ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/c", "@chcp", "65001>nul").inheritIO();
......@@ -69,6 +85,7 @@ public class Main {
try {
byte[] by = out.readAllBytes();
o = new String(by, StandardCharsets.UTF_8);
o = yeetEmpty(o);
} catch (Exception e){
System.out.print("❌ ");
System.out.println("Nem sikerült kiolvasni a program outputját.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment