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

Theo Weidmann tweidmann at openjdk.org
Thu Jan 9 12:49:47 UTC 2025


On Thu, 9 Jan 2025 12:05:21 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Theo Weidmann has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update ExampleTest.java
>
> 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.

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

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


More information about the hotspot-compiler-dev mailing list