Skip to content

Epsilon value is left relaxed by a number of tests in various suites #332

Description

@YYDan

Description

Some test suites reset the float epsilon and others leave it relaxed, which could mean subsequent tests pass when they should not.

Suites that leave epsilon modified (the bug)

Suite	Leaking facts	Left at
BasicMathTestSuite	11	0.001 / 0.0001 / 0 / -0.001 / int64
ResourceCameraTestSuite	8 (camera_matrix_test #1–#8)	0.01
ResourceSequenceTestSuite	9 (sequence.*, sequenceInstance.*)	0.001 / 0.01
BasicMathTestSuite leaking facts: lengthdir_x_test, lengthdir_y_test, point_direction_test, point_distance_test, point_distance_3d_test, math_get_epsilon_test #1/#2, math_set_epsilon_test #1–#4.

The math_get/set_epsilon facts are arguably fine — mutating epsilon is their subject — but they should still restore on exit.

The other five (lengthdir_, point_) raise epsilon for legitimate float tolerance and simply never put it back.

Suites that handle it correctly

Suite	Facts	Pattern
BasicBufferTestSuite	6	0.01 at start  0.00001 at end — true set/restore
BasicMatrixTestSuite	14	0.01 at start  0.00001 at end — true set/restore

The middle category — defensive, not restoring

BasicDateTimeTestSuite (7 facts) and 19 facts in BasicMathTestSuite (tan_test, arccos_test, ln_test, power_test, etc.) call math_set_epsilon(0.00001) at the start and never raise it. Comment on those lines: "Set an explicit epsilon to account for different default epsilons in YYC and VM."

So they don't leak, but they aren't restoring either — they're defending themselves against inherited state. That's the load-bearing accident here: enough facts self-baseline that the leak mostly gets papered over.

Blast radius

No setUp/tearDown hooks in any of the six suites — nothing resets epsilon between facts or between suites.

Registration order is in projects/xUnit/objects/objRunner/Create_0.gml:

  • BasicMathTestSuite gets away with it — its last fact is tan_test, which self-baselines to 0.00001. Pure luck of file ordering. Facts within the suite that follow a leaker still inherit it.
  • ResourceCameraTestSuite followed by ResourceEventsTestSuite, inherits 0.01.
  • ResourceSequenceTestSuite followed by ResourceSpriteTestSuite, inherits 0.001/0.01.

0.01 is a very generous tolerance for anything comparing floats downstream — tests could be passing that shouldn't be.

epsilon_audit.py

Expected Change

A framework-level epsilon reset in the suite/fact teardown rather than 44 hand-written restore calls, since the manual pattern is exactly what's been drifting.

Script Name

See above

Fact/Assert Name

See above

How reliably does this issue happen?

Always

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions