Skip to content

test: fix 32-bit architecture compatibility - #1039

Open
aloneangel45 wants to merge 1 commit into
expr-lang:masterfrom
aloneangel45:fix/32bit-test-compatibility
Open

aloneangel45 wants to merge 1 commit into
expr-lang:masterfrom
aloneangel45:fix/32bit-test-compatibility

Conversation

@aloneangel45

Copy link
Copy Markdown

Summary

Fixes three test failures when building and running the suite on 32-bit architectures (such as 386 and arm):

  1. expr_test.go: Replaced the hardcoded 64-bit constant 576460752303423484 for bitushr(-100, 5) with int((math.MaxUint - 99) >> 5) (matching builtin/builtin_test.go), which compiles and computes the right int/uint width value on both 32-bit and 64-bit platforms.
  2. builtin/builtin_test.go: Updated TestBuiltin_memory_limits to use math.MaxInt in the repeat expression instead of the hardcoded 10009999990, which exceeds math.MaxInt32 and fails during literal parsing rather than testing the memory budget check.
  3. internal/testify/assert/helpers_test.go: Changed {10, 10.5, true} in TestObjectsAreEqualValues to {int64(10), 10.5, true} so the equal-size truncation test actually compares two 64-bit numeric types on 32-bit architectures as well as 64-bit ones.

Fixes #1037

Verification

  • go vet ./...
  • GOARCH=386 go test ./...
  • GOARCH=amd64 go test ./...
  • go test -tags=expr_debug -run=TestDebugger ./vm
  • go test -race .

This branch has not been deployed

No deployments
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.

122s src/github.com/expr-lang/expr/expr_test.go:1380:4: cannot use 576460752303423484 (untyped int constant) as int value in struct literal (overflows)

1 participant