Skip to content

test: pin _adaptive_sim_duration_ms boundary and constants#66

Draft
madara88645 wants to merge 1 commit into
masterfrom
tests/add-sim-duration-20260629
Draft

test: pin _adaptive_sim_duration_ms boundary and constants#66
madara88645 wants to merge 1 commit into
masterfrom
tests/add-sim-duration-20260629

Conversation

@madara88645

Copy link
Copy Markdown
Owner

Summary

Adds 9 unit tests for _adaptive_sim_duration_ms in backend/main.py — the only pure helper in that module not yet covered by the test suite.

What the function does: decides the Brian2 simulation window length (500 ms vs 1 000 ms) based on prompt character count against a 60-char threshold.

Why it matters: the three constants (SIM_SHORT_PROMPT_CHAR_THRESHOLD, SIM_DURATION_MS_SHORT, SIM_DURATION_MS_DEFAULT) and the <= boundary condition are silently load-bearing — changing any of them shifts the visual output for every user without a type error or test failure. These tests pin that contract.

What's covered

Test Assertion
empty prompt returns SIM_DURATION_MS_SHORT (500)
prompt exactly at threshold (60 chars) returns SIM_DURATION_MS_SHORT
prompt one char over threshold (61 chars) returns SIM_DURATION_MS_DEFAULT (1 000)
very long prompt (500 chars) returns SIM_DURATION_MS_DEFAULT
constant values pinned 500, 1 000, 60
real-world short prompt "I feel calm." → short window
real-world long prompt exam-stress scenario → default window

Files changed

  • tests/test_adaptive_sim_duration.py (new — 57 lines, no source changes)

Test run

9 passed in 0.28s

Generated by Claude Code

Pins the boundary condition (60-char threshold → 500 ms vs 1 000 ms
simulation window) and the three constants that govern the behaviour.
A silent change to any constant would alter visual output for all users
without a type error; these 9 tests make that change visible immediately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cognigraph Ready Ready Preview, Comment Jun 29, 2026 4:16am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant