@Test public void parse_handlesStringsThatExceedBufferSize() throws IOException { String input = "[ \"lorem ipsum dolor sit amet\" ]"; JsonValue value = new JsonParser(new StringReader(input), 3).parse(); assertEquals("[\"lorem ipsum dolor sit amet\"]", value.toString()); }
@Test public void parse_handlesNumbersThatExceedBufferSize() throws IOException { String input = "[ 3.141592653589 ]"; JsonValue value = new JsonParser(new StringReader(input), 3).parse(); assertEquals("[3.141592653589]", value.toString()); }
@Test public void parse_handlesInputsThatExceedBufferSize() throws IOException { String input = "[ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 ]"; JsonValue value = new JsonParser(new StringReader(input), 3).parse(); assertEquals("[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]", value.toString()); }
@Test public void numbers_minusZero() { // allowed by JSON, allowed by Java JsonValue value = parse("-0"); assertEquals(0, value.asInt()); assertEquals(0l, value.asLong()); assertEquals(0f, value.asFloat(), 0); assertEquals(0d, value.asDouble(), 0); }