RFR: 8345403: Add more randomized tests to better cover FloatingDecimal parsing

Volkan Yazıcı duke at openjdk.org
Wed Dec 4 08:29:40 UTC 2024


On Tue, 3 Dec 2024 18:49:43 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> `jdk.internal.math.FloatingDecimal` parsing is mostly exercised on inputs produced by `Float.toString` and `Double.toString`, but should be extended on more random inputs.

test/jdk/jdk/internal/math/FloatingDecimal/TestRandomFloatingDecimal.java line 263:

> 261:         return (char) (c >= 'a'
> 262:                         ? RANDOM.nextBoolean() ? c : c - ('a' - 'A')
> 263:                         : c);

I guess we can also simply do


return (char) (RANDOM.nextBoolean() ? Character.toUpperCase(c) : Character.toLowerCase(c));

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22523#discussion_r1868946197


More information about the core-libs-dev mailing list