on master help sign in
Java com.leastfixedpoint.json 1.0
commitdaadc2ec4637ad6b02acba3cf928a3ccd911c347 authorTony Garnock-Jones <tonygarnockjones@gmail.com> dateWed 26 Oct 2016, 14:59 (10 years ago) parentc258e9a
7 files changed+53
parsers/test_java_com_leastfixedpoint_json_1_0/META-INF/MANIFEST.MF+3 parsers/test_java_com_leastfixedpoint_json_1_0/README.txt+5 parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.class parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.jar parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.java+40 parsers/test_java_com_leastfixedpoint_json_1_0/com.leastfixedpoint.json-1.0.jar run_tests.py+5
parsers/test_java_com_leastfixedpoint_json_1_0/META-INF/MANIFEST.MFnew file+3
@@ -0,0 +1,3 @@
1+Manifest-Version: 1.0
2+Main-Class: TestJSONParsing
3+Class-Path: com.leastfixedpoint.json-1.0.jar
parsers/test_java_com_leastfixedpoint_json_1_0/README.txtnew file+5
@@ -0,0 +1,5 @@
1+javac -cp ".:com.leastfixedpoint.json-1.0.jar" TestJSONParsing.java
2+
3+jar cvfm TestJSONParsing.jar META-INF/MANIFEST.MF com.leastfixedpoint.json-1.0.jar TestJSONParsing.class
4+
5+java -jar TestJSONParsing.jar
parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.classnew file

Binary file not shown.

parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.jarnew file

Binary file not shown.

parsers/test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.javanew file+40
@@ -0,0 +1,40 @@
1+import java.nio.charset.StandardCharsets;
2+import java.io.IOException;
3+import java.nio.file.Files;
4+import java.nio.file.Paths;
5+
6+import com.leastfixedpoint.json.*;
7+
8+public class TestJSONParsing {
9+ public static boolean isValidJSON(String s) {
10+ try {
11+ Object obj = JSONReader.readFrom(s);
12+ System.out.println(obj);
13+ System.out.println(obj.getClass().getSimpleName());
14+ return true;
15+ } catch (IOException e) {
16+ System.out.println(e);
17+ return false;
18+ }
19+ }
20+
21+ public static void main(String[] args) {
22+ if(args.length == 0) {
23+ System.out.println("Usage: java TestJSONParsing file.json");
24+ System.exit(2);
25+ }
26+
27+ try {
28+ String s = new String(Files.readAllBytes(Paths.get(args[0])));
29+ if(isValidJSON(s)) {
30+ System.out.println("valid");
31+ System.exit(0);
32+ }
33+ System.out.println("invalid");
34+ System.exit(1);
35+ } catch (IOException e) {
36+ System.out.println("not found");
37+ System.exit(2);
38+ }
39+ }
40+}
parsers/test_java_com_leastfixedpoint_json_1_0/com.leastfixedpoint.json-1.0.jarnew file

Binary file not shown.

run_tests.py+5
@@ -182,6 +182,11 @@ programs = {
182182 "url":"",
183183 "commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_gson_2_7/TestJSONParsing.jar")]
184184 },
185+ "Java com.leastfixedpoint.json 1.0":
186+ {
187+ "url":"",
188+ "commands":["/usr/bin/java", "-jar", os.path.join(PARSERS_DIR, "test_java_com_leastfixedpoint_json_1_0/TestJSONParsing.jar")]
189+ },
185190 "Java Jackson 2.8.4":
186191 {
187192 "url":"",