File tree 1 file changed +22
-0
lines changed
jpx/src/test/java/io/jenetics/jpx/format
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 39
39
import static io .jenetics .jpx .format .LocationFormatter .ofPattern ;
40
40
41
41
import java .util .Random ;
42
+ import java .util .stream .IntStream ;
42
43
43
44
import org .testng .Assert ;
44
45
import org .testng .annotations .DataProvider ;
@@ -156,5 +157,26 @@ public Object[][] formatters() {
156
157
};
157
158
}
158
159
160
+ @ Test
161
+ public void parallelFormatting () {
162
+ final var location = LocationRandom .nextLocation (new Random (123 ));
163
+ final var formatter = ISO_HUMAN_LONG ;
164
+ final var expected = formatter .format (location );
165
+
166
+ IntStream .range (0 , 100_000 ).parallel ()
167
+ .mapToObj (i -> formatter .format (location ))
168
+ .forEach (result -> assertEquals (result , expected ));
169
+ }
170
+
171
+ @ Test
172
+ public void parallelParsing () {
173
+ final var expected = LocationRandom .nextLocation (new Random (123 ));
174
+ final var formatter = ISO_HUMAN_LONG ;
175
+ final var formatted = formatter .format (expected );
176
+
177
+ IntStream .range (0 , 100_000 ).parallel ()
178
+ .mapToObj (i -> formatter .parse (formatted ))
179
+ .forEach (result -> assertEquals (result , expected ));
180
+ }
159
181
160
182
}
You can’t perform that action at this time.
0 commit comments