use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_false method test_scan_false_5.
public void test_scan_false_5() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("falsz");
lexer.scanFalse();
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_scanFieldFloat method test_isBlank.
@SuppressWarnings("resource")
public void test_isBlank() throws Exception {
String text = " {\"value\":1.0}";
Assert.assertTrue(!new JSONScanner(text).isBlankInput());
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_scanSymbol method test_2.
public void test_2() throws Exception {
JSONScanner lexer = new JSONScanner("\"value\":\"aa\"}]");
long hashCode = lexer.scanFieldSymbol("\"value\":".toCharArray());
Assert.assertEquals(fnv_hash("aa"), hashCode);
Assert.assertEquals(JSONScanner.END, lexer.matchStat());
Assert.assertEquals(JSONToken.RBRACKET, lexer.token());
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_scanSymbol method test_3.
public void test_3() throws Exception {
JSONScanner lexer = new JSONScanner("\"value\":\"aa\"}}");
long hashCode = lexer.scanFieldSymbol("\"value\":".toCharArray());
Assert.assertEquals(fnv_hash("aa"), hashCode);
Assert.assertEquals(JSONScanner.END, lexer.matchStat());
Assert.assertEquals(JSONToken.RBRACE, lexer.token());
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_scanSymbol method test_7.
public void test_7() throws Exception {
JSONScanner lexer = new JSONScanner("\"value\":\"aa\"");
long hashCode = lexer.scanFieldSymbol("\"value\":".toCharArray());
Assert.assertEquals(0, hashCode);
Assert.assertEquals(JSONScanner.NOT_MATCH, lexer.matchStat());
}
Aggregations