Century years are treated as leap years
Done- Plan (done)
- Code (done)
- Test (done)
- Review (done)
- Finish (done)
Cost
$0.0030
Tests
Passed
Iterations
1
Re-plans
0
LLM calls
11
Prompt read from cache
78%
Usage by agent
- Cache read
- Cache write
- Input
- Output
View as table
| Agent | Cost | Cache read | Cache write | Input | Output |
|---|---|---|---|---|---|
| planner | $0.0006 | 5,771 | 1,003 | 8 | 748 |
| coder | $0.0008 | 8,553 | 1,926 | 8 | 895 |
| tester | $0.0010 | 9,992 | 2,665 | 8 | 1,106 |
| reviewer | $0.0007 | 5,128 | 2,703 | 6 | 660 |
Timeline
-
planner iteration 1 Finished 3 calls · 7,530 tokens · $0.0006 · 8.1s
Loading…
-
coder iteration 1 Finished 3 calls · 11.4K tokens · $0.0008 · 5.5s
Loading…
-
tester iteration 1 Finished 3 calls · 13.8K tokens · $0.0010 · 9.0s
Loading…
-
verify iteration 1 Passed 0.5s
...... [100%] 6 passed in 0.02s
-
reviewer iteration 1 Finished 2 calls · 8,497 tokens · $0.0007 · 5.4s
Loading…
Final diff
diff --git a/calendar_utils.py b/calendar_utils.py index 5b47463..dce67d9 100644 --- a/calendar_utils.py +++ b/calendar_utils.py @@ -2,7 +2,7 @@ _DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def is_leap(year: int) -> bool: - return year % 4 == 0 + return (year % 4 == 0 and year % 100 != 0) or year % 400 == 0 def days_in_month(year: int, month: int) -> int: diff --git a/test_calendar_utils.py b/test_calendar_utils.py index e4540ed..7538684 100644 --- a/test_calendar_utils.py +++ b/test_calendar_utils.py @@ -6,6 +6,35 @@ def test_ordinary_leap_year(): assert not is_leap(2023) +def test_century_years(): + assert not is_leap(1900) + assert is_leap(2000) + assert not is_leap(2100) + + +def test_more_400_year_cycle_cases(): + assert is_leap(1600) + assert is_leap(2400) + assert not is_leap(1700) + assert not is_leap(1800) + assert is_leap(1996) + assert not is_leap(2001) + + +def test_returns_bool(): + assert is_leap(2000) is True + assert is_leap(1900) is False + + +def test_non_february_months_unaffected_by_century_rule(): + assert days_in_month(1900, 1) == 31 + assert days_in_month(1900, 4) == 30 + assert days_in_month(2000, 3) == 31 + assert days_in_month(2000, 12) == 31 + + def test_february(): assert days_in_month(2024, 2) == 29 assert days_in_month(2023, 2) == 28 + assert days_in_month(1900, 2) == 28 + assert days_in_month(2000, 2) == 29