feat(tests): add continuity and stability tests for Synchronous mode …#335
Open
mariborges22 wants to merge 1 commit intoRawAccelOfficial:masterfrom
Open
feat(tests): add continuity and stability tests for Synchronous mode …#335mariborges22 wants to merge 1 commit intoRawAccelOfficial:masterfrom
mariborges22 wants to merge 1 commit intoRawAccelOfficial:masterfrom
Conversation
JacobPalecki
requested changes
Mar 25, 2026
| namespace wrapper_tests | ||
| { | ||
| [TestClass] | ||
| public class ThresholdTests |
Collaborator
There was a problem hiding this comment.
This should go in SynchronousAccelTests.
| double logSpace = Math.Abs(gammaConst * logDiff); | ||
| double exponent = Math.Pow(Math.Tanh(Math.Pow(logSpace, Sharpness)), 1 / Sharpness); | ||
|
|
||
| if (logDiff < 0) exponent = -exponent; |
Collaborator
There was a problem hiding this comment.
exponent *= Math.Sign(logDiff) is clearer phrasing
| <Compile Include="Properties\AssemblyInfo.cs" /> | ||
| <Compile Include="SpeedTests.cs" /> | ||
| <Compile Include="SynchronousAccelTests.cs" /> | ||
| <Compile Include="ThresholdTests.cs" /> |
Collaborator
There was a problem hiding this comment.
Move tests to SynchronousAccelTests and remove this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: feat(tests): add continuity and stability tests for Synchronous mode threshold
Summary: As a new contributor starting to explore the RawAccel codebase, I decided to begin by validating the mathematical integrity and continuity of the core acceleration logic.
This PR introduces a new unit test suite focused on the Synchronous mode. Specifically, it investigates the technical threshold (at sharpness = 16 or smooth = 0.03125) where the implementation transitions from the complex tanh formula to the optimized linear clamp.
Key Changes:
Mathematical Verification: Created
ThresholdTests.cs
to compare the driver's optimized output with a pure mathematical simulator (
UnclampedSynchronousSimulator
) across multiple input speeds.
Stability Check: Confirmed that the transition between formulas does not introduce any perceptible "jumps" or discontinuities in sensitivity.
Test Sensitivity: The test was calibrated via "Chaos Testing" (intentionally breaking the simulator) to ensure it correctly identifies discrepancies greater than 0.1%.
This addition serves as a regression safety net for future mathematical refactorings of the Synchronous mode.