From 8520451a140d3f46ac33042715115e290cf5785f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <5175937+theofidry@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:04:20 +0200 Subject: [PATCH] test: Add cases for accounting for the rounding (#145) --- tests/CpuCoreCounterTest.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/CpuCoreCounterTest.php b/tests/CpuCoreCounterTest.php index fc3873d..f75d02f 100644 --- a/tests/CpuCoreCounterTest.php +++ b/tests/CpuCoreCounterTest.php @@ -388,6 +388,36 @@ public static function availableCpuCoreProvider(): iterable 9.5, 10 ); + + yield 'it rounds the available cores to the lower int (less than half)' => AvailableCpuCoresScenario::create( + 32, + [], + 0, + null, + .1, + 0., + 3 + ); + + yield 'it rounds the available cores to the lower int (perfect half)' => AvailableCpuCoresScenario::create( + 7, + [], + 0, + null, + .5, + 0., + 3 + ); + + yield 'it rounds the available cores to the lower int (more than half)' => AvailableCpuCoresScenario::create( + 36, + [], + 0, + null, + .1, + 0., + 3 + ); } /**