Files
wazero/internal/u64/u64_test.go
Crypt Keeper ce1052a097 Isolates testify to one file, so that it is easier to remove (#460)
This starts the process of removing all dependencies from wazero, by
isolating all assertions we use into a single file. This allows us to
port those assertions as we have time, and when twitchy is gone, the
project literally has no dependencies except go!

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2022-04-14 10:05:38 +08:00

40 lines
578 B
Go

package u64
import (
"encoding/binary"
"math"
"testing"
"github.com/tetratelabs/wazero/internal/testing/require"
)
func TestBytes(t *testing.T) {
tests := []struct {
name string
input uint64
}{
{
name: "zero",
input: 0,
},
{
name: "half",
input: math.MaxUint32,
},
{
name: "max",
input: math.MaxUint64,
},
}
for _, tt := range tests {
tc := tt
t.Run(tc.name, func(t *testing.T) {
expected := make([]byte, 8)
binary.LittleEndian.PutUint64(expected, tc.input)
require.Equal(t, expected, LeBytes(tc.input))
})
}
}