From 71d41875a6611039466207a79332b97fd3dc2441 Mon Sep 17 00:00:00 2001 From: edithatogo <15080672+edithatogo@users.noreply.github.com> Date: Tue, 28 Jul 2026 15:04:22 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Add=20tests=20for=20clamp=20func?= =?UTF-8?q?tion=20in=20runtime=5Flab.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/tests/test_runtime_lab.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/models/tests/test_runtime_lab.py b/models/tests/test_runtime_lab.py index 7ae5ddd..5b469c4 100644 --- a/models/tests/test_runtime_lab.py +++ b/models/tests/test_runtime_lab.py @@ -8,6 +8,7 @@ SCENARIO_BY_ID, calculate_indices, calculation_trace, + clamp, model_gap_map, run_agent_lens, run_reference_calculation, @@ -86,3 +87,19 @@ def test_model_gap_map_covers_current_comprehensive_sota_and_bleeding_edge(): assert {"Current", "Comprehensive", "SOTA", "Bleeding edge"}.issubset(set(gap_map["tier"])) assert "calculation audit overlay" in " ".join(gap_map["asset_or_gap"].str.lower()) + + +def test_clamp_bounds_and_values(): + # Default bounds (0.0 to 100.0) + assert clamp(50.0) == 50.0 + assert clamp(-10.0) == 0.0 + assert clamp(110.0) == 100.0 + assert clamp(0.0) == 0.0 + assert clamp(100.0) == 100.0 + + # Custom bounds + assert clamp(15.0, lower=10.0, upper=20.0) == 15.0 + assert clamp(5.0, lower=10.0, upper=20.0) == 10.0 + assert clamp(25.0, lower=10.0, upper=20.0) == 20.0 + assert clamp(10.0, lower=10.0, upper=20.0) == 10.0 + assert clamp(20.0, lower=10.0, upper=20.0) == 20.0