RFR: 8346107: Generators: testing utility for random value generation [v10]

Emanuel Peter epeter at openjdk.org
Thu Jan 9 13:42:39 UTC 2025


On Thu, 9 Jan 2025 12:43:33 GMT, Theo Weidmann <tweidmann at openjdk.org> wrote:

>> test/hotspot/jtreg/testlibrary_tests/generators/tests/TestGenerators.java line 480:
>> 
>>> 478:         mockSource.checkEmpty().enqueueFloat(2, 5, 4);
>>> 479:         var f4 = mockGS.safeRestrictFloat(mockGS.uniformFloats(0, 1),2, 5);
>>> 480:         Asserts.assertEQ(f4.next(), 4f);
>> 
>> You could test `safeRestrict...` on all generators from `G`, and also the random ones like `G.ints()`
>> 
>> Pick random restriction bounds, and just check that the results are in bounds
>
> I don't think it's necessary to test safeRestrict more extensively. These test cases already exercise all branches and paths through safeRestrict.

Ok, fine with me

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22941#discussion_r1908819863


More information about the hotspot-compiler-dev mailing list