Skip to content

End-to-end round-trip test ignores every numeric value #98

Description

@argonui

Summary

tests/e2e_test.go is the test asserting that a mod survives reverse → generate unchanged. Its
comparison excludes every float64, so no numeric field is actually checked.

Detail

tests/e2e_test.go:96-99:

ignoreUnpredictable := func(k string, v interface{}) bool {
	if _, ok := v.(float64); ok {
		return true
	}
	...
}

cmpopts.IgnoreMapEntries applies this at every nesting level, so positions, rotations, scales, and
colors are all excluded throughout the object tree.

Demonstration

Introducing a deliberate corruption that doubles every object position:

r := roundFloat(f, 3) * 2   // in objects/numbersmoother.go smoothPos
$ go test ./tests/...
ok  	ModCreator/tests	0.592s

The round trip passes with every object in the mod moved. objects/numbersmoother_test.go does
catch the mutation, so the gap is specifically at integration level — where the lossy rounding
composes with reverse/generate.

Why the exclusion is there

Presumably to tolerate float formatting noise. That's what objects/numbersmoother.go already
exists to eliminate, so the two mechanisms overlap.

Suggested fix

Compare floats with a tolerance rather than skipping them, so rounding noise is tolerated but
actual movement isn't.


Filed from an automated code audit. Each item below was reproduced by running the binary or the test suite unless marked as observation-only.

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