feat: Add a clamp function to the calculator #8

Closed
typosaurus wants to merge 0 commits from typosaurus/7-add-a-clamp-function-to-the-calculator into main
Owner

What was built

Add a clamp(value, low, high) function to src/calculator.py that returns value bounded by low and high, and raises ValueError when low > high. Follow the conventions in CLAUDE.md.

Acceptance criteria

  • The ticket objective is satisfied: Add a clamp function to the calculator

Commits

Commit Summary Node
8605a8c5969e test(sveta): Write clamp tests -
c7f0712d1246 feat(nadia): Implement clamp function -

Run

Cost: 0.0017 USD · Nodes: 6 · Verification: make verify

Closes #7

## What was built Add a `clamp(value, low, high)` function to src/calculator.py that returns value bounded by low and high, and raises ValueError when low > high. Follow the conventions in CLAUDE.md. ## Acceptance criteria - The ticket objective is satisfied: Add a clamp function to the calculator ## Commits | Commit | Summary | Node | |---|---|---| | `8605a8c5969e` | test(sveta): Write clamp tests | `-` | | `c7f0712d1246` | feat(nadia): Implement clamp function | `-` | ## Run Cost: 0.0017 USD · Nodes: 6 · Verification: make verify Closes #7
typosaurus added 2 commits 2026-07-25 19:04:45 +02:00
**Outcome:** done
**Changed:** src/calculator.py:11-18
**Verified by:** python3 -m compileall -q src — passed; python3 -c with five acceptance assertions — passed. make verify fails because tests/ directory does not exist.
**Findings:** clamp(value: int, low: int, high: int) -> int added at src/calculator.py:11 with no docstrings or comments. File header at src/calculator.py:1 is present. All functions use full int type annotations.
**Open:** Test writer (sveta) should create tests/ directory and add unit tests for clamp.
**Confidence:** high

Typosaurus-Run: 5b5c36bf38254bf4bfcdbde317991a5a
Typosaurus-Node: bf41377d70c446b1b80b9e058fe81fb8
Typosaurus-Agent: @nadia
Refs: #7
Outcome: done
Changed: tests/__init__.py:1, tests/test_calculator.py:1-86
Verified by: `make verify` — exit 0, "verification passed", Ran 16 tests in 0.001s, OK
Findings: tests/ directory created at ./tests/ with __init__.py (header only) and test_calculator.py (16 tests for clamp).
Findings: All 16 clamp tests pass under `make verify`: value below low, above high, in range, equals low, equals high, low>high ValueError, negative values, float below/above/in-range/equals-boundary, float low>high ValueError, large values, -inf/inf boundaries, and NaN.
Findings: clamp is typed as (value: int, low: int, high: int) -> int; float and inf/NaN tests pass because Python does not enforce type hints at runtime.
Open: none
Confidence: high - all 16 tests pass, all acceptance criteria covered, make verify passes

Typosaurus-Run: 5b5c36bf38254bf4bfcdbde317991a5a
Typosaurus-Node: 56f03705c3d64023ba102d3aa3169ef2
Typosaurus-Agent: @sveta
Refs: #7
Author
Owner

Please rebbbase this ticket again!!

Please rebbbase this ticket again!!
Author
Owner

Please add a lot of tests.

Please add a lot of tests.
typosaurus closed this pull request 2026-07-26 21:55:30 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: typosaurus/typosaurus-sandbox#8
No description provided.