Skip to content

feat(tests): add continuity and stability tests for Synchronous mode …#335

Open
mariborges22 wants to merge 1 commit intoRawAccelOfficial:masterfrom
mariborges22:test/wrapper-tests
Open

feat(tests): add continuity and stability tests for Synchronous mode …#335
mariborges22 wants to merge 1 commit intoRawAccelOfficial:masterfrom
mariborges22:test/wrapper-tests

Conversation

@mariborges22
Copy link
Copy Markdown

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.

namespace wrapper_tests
{
[TestClass]
public class ThresholdTests
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exponent *= Math.Sign(logDiff) is clearer phrasing

<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SpeedTests.cs" />
<Compile Include="SynchronousAccelTests.cs" />
<Compile Include="ThresholdTests.cs" />
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move tests to SynchronousAccelTests and remove this

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.

2 participants