File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/test/java/com/fasterxml/jackson/core/io/doubleparser Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .core .io .doubleparser ;
2
+
3
+ import org .junit .jupiter .api .Test ;
4
+
5
+ import java .util .Random ;
6
+
7
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
8
+
9
+ class ReaderTest {
10
+ private static final int LEN = 1000 ;
11
+ private static final String [] DOUBLE_STRINGS = new String [LEN ];
12
+ private static final String [] FLOAT_STRINGS = new String [LEN ];
13
+
14
+ static {
15
+ Random rnd = new Random ();
16
+ for (int i = 0 ; i < LEN ; i ++) {
17
+ DOUBLE_STRINGS [i ] = Double .toString (rnd .nextDouble ());
18
+ FLOAT_STRINGS [i ] = Float .toString (rnd .nextFloat ());
19
+ }
20
+ }
21
+
22
+ @ Test
23
+ void verifyDoubles () {
24
+ for (int i = 0 ; i < LEN ; i ++) {
25
+ double fd = FastDoubleParser .parseDouble (DOUBLE_STRINGS [i ]);
26
+ double jd = Double .parseDouble (DOUBLE_STRINGS [i ]);
27
+ assertEquals (jd , fd );
28
+ }
29
+ }
30
+
31
+ @ Test
32
+ void verifyFloats () {
33
+ for (int i = 0 ; i < LEN ; i ++) {
34
+ float ff = FastFloatParser .parseFloat (FLOAT_STRINGS [i ]);
35
+ float jf = Float .parseFloat (FLOAT_STRINGS [i ]);
36
+ assertEquals (jf , ff );
37
+ }
38
+ }
39
+
40
+ }
You can’t perform that action at this time.
0 commit comments