Skip to content

Remove the now-redundant math_set_epsilon() restore calls left over from #332 #353

Description

@YYDan

Description

Issue #332 added Test.resetGlobalState(), called first in preRunFunc in both Test.gml and TestAsync.gml, which sets the float epsilon back to test_default_epsilon (0.00001) at the start of every test. That removed the need for any test to restore the epsilon itself after relaxing it.

The 260 defensive calls in BasicMathTestSuite were removed as part of that work, but the same pattern exists in four other suites and was not covered:

Suite Redundant restore calls
BasicMatrixTestSuite 14
BasicDateTimeTestSuite 7
BasicBufferTestSuite 6
BasicMathTestSuite 1

These follow the paired shape — math_set_epsilon(0.01) at the top of a fact and math_set_epsilon(0.00001) at the bottom. Only the trailing restore to 0.00001 should be removed. The leading relaxation is doing real work and must stay.

Note that ResourceCameraTestSuite (8 calls) and ResourceSequenceTestSuite (9 calls) also call math_set_epsilon(), but none of theirs restore to the default value, so they are out of scope — they should be spot-checked but are expected to need no change.

Per the convention agreed in #332, no new test should ever add a defensive restore; a math_set_epsilon() call is only appropriate where a fact genuinely needs a relaxed tolerance for its own asserts.

Script Name

BasicMatrixTestSuite, BasicDateTimeTestSuite, BasicBufferTestSuite, BasicMathTestSuite

Steps To The Task

  • Remove the 14 restore calls in BasicMatrixTestSuite, keeping every leading relaxation
  • Remove the 7 restore calls in BasicDateTimeTestSuite, keeping every leading relaxation
  • Remove the 6 restore calls in BasicBufferTestSuite, keeping every leading relaxation
  • Remove the 1 remaining restore call in BasicMathTestSuite
  • Spot-check ResourceCameraTestSuite and ResourceSequenceTestSuite and confirm no change is needed
  • Confirm no assert was removed or altered in any of the files touched
  • Run the affected suites on VM and YYC and confirm the same set of checks pass as before

Metadata

Metadata

Assignees

Labels

refactorAn improvement to existing test/module code

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions