Skip to content

Commit

Permalink
Made language argument case insensitive and changed initial code to a…
Browse files Browse the repository at this point in the history
… map
  • Loading branch information
Tolini committed Apr 23, 2017
1 parent a05f0bb commit 6763d6d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Compiler/src/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static void main(String... args) {
System.exit(0);
}

availableCompilers.put("Java", new JavaRunner());
availableCompilers.put("Javascript", new JavascriptRunner());
availableCompilers.put("java", new JavaRunner());
availableCompilers.put("javascript", new JavascriptRunner());

File root = new File(FileSystems.getDefault().getPath("../").toAbsolutePath().toString());

Expand All @@ -45,8 +45,8 @@ public static void main(String... args) {
}

if(challenge != null) {
String wantedCompiler = args.length < 3 ? "Java" : args[2];
Runner runner = availableCompilers.getOrDefault(wantedCompiler, availableCompilers.get("Java"));
String wantedCompiler = args.length < 3 ? "java" : args[2];
Runner runner = availableCompilers.getOrDefault(wantedCompiler.toLowerCase(), availableCompilers.get("java"));

CodeChecker codeChecker = runner.getCodeChecker(root, args[1]);

Expand Down
5 changes: 4 additions & 1 deletion Testing/Tests/Challenge_Four.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"expectedReturn": "grebmoolB"
}
],
"initialCode": "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn \"reversed string\";\n\t}\n}"
"initialCode" : {
"java" : "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn \"reversedstring\";\n\t}\n}",
"javascript" : "function program(args) {\n\treturn \"reversedstring\";\n}"
}
}
5 changes: 4 additions & 1 deletion Testing/Tests/Challenge_One.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
"expectedReturn": 16
}
],
"initialCode": "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn -1;\n\t}\n}"
"initialCode" : {
"java" : "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn -1;\n\t}\n}",
"javascript" : "function program(args) {\n\treturn -1;\n}"
}
}
5 changes: 4 additions & 1 deletion Testing/Tests/Challenge_Three.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"expectedReturn": 0
}
],
"initialCode": "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn -1;\n\t}\n}"
"initialCode" : {
"java" : "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn -1;\n\t}\n}",
"javascript" : "function program(args) {\n\treturn -1;\n}"
}
}
5 changes: 4 additions & 1 deletion Testing/Tests/Challenge_Two.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
"expectedReturn": 2
}
],
"initialCode": "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn -1;\n\t}\n}"
"initialCode" : {
"java" : "public class Program {\n\tpublic Object run(String[] args) {\n\t\treturn -1;\n\t}\n}",
"javascript" : "function program(args) {\n\treturn -1;\n}"
}
}

0 comments on commit 6763d6d

Please sign in to comment.