Skip to content

refactor(tests): extract fixed_point_constexpr.cpp (re-opening as #3136 closed when #3135 merged) - #3159

Merged
zackees merged 1 commit into
masterfrom
feat/3130-fixed-point-constexpr-extract
Jun 16, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/3130-fixed-point-constexpr-extract

Conversation

@zackees

@zackees zackees commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

Reopens the work from #3136 (closed when its base branch #3135 was merged and deleted). Now targets master directly.

Original #3136 description preserved — moves constexpr validation section (343 LOC) from fixed_point.cpp into fixed_point_constexpr.cpp.

Part of #3130. Meta: #3127.

Summary by CodeRabbit

  • Tests
    • Reorganized compile-time validation tests for fixed-point types into a dedicated test module for improved test clarity and maintainability.

…pp (part of #3130)

Second extraction in #3130. Moves the constexpr validation section
(original lines 811-1129 + the constexpr_raw_check helper at 120-124)
into its own file:
  - constexpr raw() compile-time check (all 13 types)
  - constexpr from_raw compile-time check
  - constexpr arithmetic operators
  - constexpr comparisons
  - constexpr conversions
  - constexpr math functions (mod, floor, ceil, fract, abs, sign, lerp,
    clamp, step, sqrt, rsqrt)
  - constexpr value verification (concrete value computations)

Plus the 23 constexpr_*_check<T>(...) helper templates that the tests
use; they were only referenced by the moved test cases.

The original section header "Concrete Bit-Exact Tests (All Types)" now
correctly introduces the bit-exact tests that remain in fixed_point.cpp.

Tests pass: bash test fl_math_fixed_point --cpp (1/1, 0.27s test time).

fixed_point.cpp: 4,816 -> 4,488 LOC
fixed_point_constexpr.cpp (new): 343 LOC

Stacked on top of feat/3130-fixed-point-misc-extract (PR #3135) because
both PRs depend on the same ci/hooks/check_test_file_pairing.py sibling-
split allowance that #3135 introduces.

Part of #3130. Meta tracking issue: #3127.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit e2ea6ef into master Jun 16, 2026
4 checks passed
@zackees
zackees deleted the feat/3130-fixed-point-constexpr-extract branch June 16, 2026 04:39
@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c11d0a92-4d5b-43de-8d99-f2a38d36b72e

📥 Commits

Reviewing files that changed from the base of the PR and between dab9b4b and 0b220b5.

📒 Files selected for processing (2)
  • tests/fl/math/fixed_point.cpp
  • tests/fl/math/fixed_point_constexpr.cpp

📝 Walkthrough

Walkthrough

Constexpr fixed-point test cases are extracted from tests/fl/math/fixed_point.cpp into a new dedicated translation unit tests/fl/math/fixed_point_constexpr.cpp. The original file loses 328 lines (the seven constexpr FL_TEST_CASE blocks and their helper), gaining only a raw_t<T> alias. The new file adds 343 lines reproducing the same constexpr coverage.

Changes

Constexpr fixed-point test extraction

Layer / File(s) Summary
Remove constexpr tests and adapt raw_t alias
tests/fl/math/fixed_point.cpp
Removes constexpr_raw_check and all seven constexpr FL_TEST_CASE blocks (~328 lines). Introduces raw_t<T> alias (deduced from T().raw()) to keep existing bit-exact runtime test helpers working.
New fixed_point_constexpr.cpp: helpers and test cases
tests/fl/math/fixed_point_constexpr.cpp
Adds a new translation unit with constexpr helper templates for raw, from_raw, arithmetic, comparisons, conversions, and math functions (mod, floor, ceil, fract, abs, sign, lerp, clamp, step, sqrt, rsqrt). Registers seven FL_TEST_CASEs using FL_STATIC_ASSERT across signed/unsigned fixed-point types, plus a concrete value-verification test including a rsqrt(0.0) zero-guard.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

A rabbit reshuffled the test file with care,
Constexpr assertions now breathe fresher air.
raw_t stands guard where the old helper ran,
New file, same checks — all part of the plan.
🐇✨ Compile-time truths, neatly arranged!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/3130-fixed-point-constexpr-extract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant