コード例 #1
0
 @Test
 public void testParseDec_MaxSigned() throws Exception {
   long i = Long.MAX_VALUE;
   String s = Long.toString(i);
   assertEquals(i, ParseLong.parseDec(s));
 }
コード例 #2
0
 //  Test positive sign inside
 @Test(expected = NumberFormatException.class)
 public void testParseDec_PositiveBad() throws Exception {
   ParseLong.parseDec("+12+34");
 }
コード例 #3
0
 //  Test negative sign prefix
 @Test
 public void testParseDec_Negative() throws Exception {
   long i = -123456;
   String s = Long.toString(i);
   assertEquals(i, ParseLong.parseDec(s));
 }
コード例 #4
0
 //  Test empty
 @Test(expected = NumberFormatException.class)
 public void testParseDec_Empty() throws Exception {
   ParseLong.parseDec("");
 }
コード例 #5
0
 //  Test negative sign inside
 @Test(expected = NumberFormatException.class)
 public void testParseDec_NegativeBad() throws Exception {
   ParseLong.parseDec("-12-34");
 }
コード例 #6
0
 //  Test null
 @Test(expected = NumberFormatException.class)
 public void testParseDec_Null() throws Exception {
   ParseLong.parseDec(null);
 }
コード例 #7
0
 //  Test bad
 @Test(expected = NumberFormatException.class)
 public void testParseDec_Bad() throws Exception {
   ParseLong.parseDec("12AB-**&1'");
 }
コード例 #8
0
 //  For values lower than the signed min, the method shouldn't thrown an exception but it will
 // return a
 //  garbage result
 @Test
 public void testParseDec_MinSignedUnderflow() throws Exception {
   String s = "-9223372036854775809";
   ParseLong.parseDec(s);
 }
コード例 #9
0
 //  For values larger than the unsigned max, the method shouldn't thrown an exception but it will
 // return a
 //  garbage result
 @Test
 public void testParseDec_UnsignedOverflow() throws Exception {
   String s = "18446744073709551616";
   ParseLong.parseDec(s);
 }
コード例 #10
0
 @Test
 public void testParseDec_MaxUnsigned() throws Exception {
   long i = 0xFFFFFFFF;
   String s = "18446744073709551615";
   assertEquals(i, ParseLong.parseDec(s));
 }