MCPcopy Create free account
hub / github.com/apache/solr / testNumbers

Method testNumbers

solr/solrj/src/test/org/noggit/TestJSONParser.java:570–688  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

568 }
569
570 @Test
571 public void testNumbers() throws IOException {
572 flags = JSONParser.FLAGS_STRICT;
573
574 err("[00]");
575 err("[003]");
576 err("[00.3]");
577 err("[1e1.1]");
578 err("[+1]");
579 err("[NaN]");
580 err("[Infinity]");
581 err("[--1]");
582
583 flags = JSONParser.FLAGS_DEFAULT;
584
585 String lmin = "-9223372036854775808";
586 String lminNot = "-9223372036854775809";
587 String lmax = "9223372036854775807";
588 String lmaxNot = "9223372036854775808";
589
590 String bignum = "12345678987654321357975312468642099775533112244668800152637485960987654321";
591
592 parse("[0,1,-1,543,-876]", new Object[] {a, o(0), o(1), o(-1), o(543), o(-876), A, e});
593 parse("[-0]", new Object[] {a, o(0), A, e});
594
595 parse(
596 "[" + lmin + "," + lmax + "]",
597 new Object[] {a, o(Long.MIN_VALUE), o(Long.MAX_VALUE), A, e});
598
599 parse("[" + bignum + "]", new Object[] {a, bn(bignum), A, e});
600 parse("[" + "-" + bignum + "]", new Object[] {a, bn("-" + bignum), A, e});
601
602 parse("[" + lminNot + "]", new Object[] {a, bn(lminNot), A, e});
603 parse("[" + lmaxNot + "]", new Object[] {a, bn(lmaxNot), A, e});
604
605 parse("[" + lminNot + "," + lmaxNot + "]", new Object[] {a, bn(lminNot), bn(lmaxNot), A, e});
606
607 // bignum many digits on either side of decimal
608 String t = bignum + "." + bignum;
609 parse("[" + t + "," + "-" + t + "]", new Object[] {a, bn(t), bn("-" + t), A, e});
610 err("[" + t + ".1" + "]"); // extra decimal
611 err("[" + "-" + t + ".1" + "]");
612
613 // bignum exponent w/o fraction
614 t = "1" + "e+" + bignum;
615 parse("[" + t + "," + "-" + t + "]", new Object[] {a, bn(t), bn("-" + t), A, e});
616 t = "1" + "E+" + bignum;
617 parse("[" + t + "," + "-" + t + "]", new Object[] {a, bn(t), bn("-" + t), A, e});
618 t = "1" + "e" + bignum;
619 parse("[" + t + "," + "-" + t + "]", new Object[] {a, bn(t), bn("-" + t), A, e});
620 t = "1" + "E" + bignum;
621 parse("[" + t + "," + "-" + t + "]", new Object[] {a, bn(t), bn("-" + t), A, e});
622 t = "1" + "e-" + bignum;
623 parse("[" + t + "," + "-" + t + "]", new Object[] {a, bn(t), bn("-" + t), A, e});
624 t = "1" + "E-" + bignum;
625 parse("[" + t + "," + "-" + t + "]", new Object[] {a, bn(t), bn("-" + t), A, e});
626
627 t = bignum + "e+" + bignum;

Callers

nothing calls this directly

Calls 14

errMethod · 0.95
parseMethod · 0.95
oMethod · 0.95
bnMethod · 0.95
getParserMethod · 0.95
nextEventMethod · 0.95
getLongMethod · 0.95
getNumberCharsMethod · 0.95
toStringMethod · 0.95
nextLongMethod · 0.80
randomMethod · 0.80
assertEqualsMethod · 0.80

Tested by

no test coverage detected