Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not rely on undefined behaviour in bytes_test.go #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ondrejbudai
Copy link

8 exbi equals 2^64, therefore it cannot be stored in int64. The tests use
the fact that on x86_64 the following expressions holds true:
int64(0) - 1 == math.MaxInt64.

However, this is not true for other platforms, specifically aarch64, s390x
and ppc64le.

This commit fixes it by testing the library with 7 exbi.

Fixes #37

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2020

Codecov Report

Merging #38 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #38   +/-   ##
=======================================
  Coverage   59.26%   59.26%           
=======================================
  Files           6        6           
  Lines         518      518           
=======================================
  Hits          307      307           
  Misses        208      208           
  Partials        3        3           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4919956...5c8aceb. Read the comment docs.

8 exbi equals 2^64, therefore it cannot be stored in int64. The tests use
the fact that on x86_64 the following expressions holds true:
int64(0) - 1 == math.MaxInt64.

However, this is not true for other platforms, specifically aarch64, s390x
and ppc64le.

This commit fixes it by testing the library with 7 exbi.

Fixes labstack#37
@ondrejbudai ondrejbudai force-pushed the fix-undefined-behaviour-in-tests branch from 2337700 to 5c8aceb Compare August 26, 2020 13:57
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.

bytes package tests test implementation defined behaviour
2 participants