From f19507de15f8ad07a569feacfb352338f075311a Mon Sep 17 00:00:00 2001 From: Aurelien Derouineau Date: Thu, 15 Apr 2021 17:33:49 +0000 Subject: [PATCH] Adapt tests for arm64 --- bytes/bytes_amd64_test.go | 30 ++++++++++++++++++++++++++++++ bytes/bytes_arm64_test.go | 30 ++++++++++++++++++++++++++++++ bytes/bytes_test.go | 20 -------------------- 3 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 bytes/bytes_amd64_test.go create mode 100644 bytes/bytes_arm64_test.go diff --git a/bytes/bytes_amd64_test.go b/bytes/bytes_amd64_test.go new file mode 100644 index 0000000..857b40e --- /dev/null +++ b/bytes/bytes_amd64_test.go @@ -0,0 +1,30 @@ +package bytes + +import ( + "math" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBytesParseEB(t *testing.T) { + // EB + b, err := Parse("8EB") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b-1) + } + b, err = Parse("8E") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b-1) + } + + // EB with spaces + b, err = Parse("8 EB") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b-1) + } + b, err = Parse("8 E") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b-1) + } +} diff --git a/bytes/bytes_arm64_test.go b/bytes/bytes_arm64_test.go new file mode 100644 index 0000000..e5e7268 --- /dev/null +++ b/bytes/bytes_arm64_test.go @@ -0,0 +1,30 @@ +package bytes + +import ( + "math" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBytesParseEB(t *testing.T) { + // EB + b, err := Parse("8EB") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b) + } + b, err = Parse("8E") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b) + } + + // EB with spaces + b, err = Parse("8 EB") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b) + } + b, err = Parse("8 E") + if assert.NoError(t, err) { + assert.True(t, math.MaxInt64 == b) + } +} diff --git a/bytes/bytes_test.go b/bytes/bytes_test.go index 279275c..b1d79fa 100644 --- a/bytes/bytes_test.go +++ b/bytes/bytes_test.go @@ -204,24 +204,4 @@ func TestBytesParse(t *testing.T) { if assert.NoError(t, err) { assert.Equal(t, int64(10133099161583616), b) } - - // EB - b, err = Parse("8EB") - if assert.NoError(t, err) { - assert.True(t, math.MaxInt64 == b-1) - } - b, err = Parse("8E") - if assert.NoError(t, err) { - assert.True(t, math.MaxInt64 == b-1) - } - - // EB with spaces - b, err = Parse("8 EB") - if assert.NoError(t, err) { - assert.True(t, math.MaxInt64 == b-1) - } - b, err = Parse("8 E") - if assert.NoError(t, err) { - assert.True(t, math.MaxInt64 == b-1) - } }