Skip to content

Commit

Permalink
Updated conv_test.go test suite for uint8 conversions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Apr 17, 2024
1 parent 3b0fbb5 commit 708f8b8
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions conv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,6 @@ func TestUint16ToBytesAndBack(t *testing.T) {
}
}

func TestUint8ToBytesAndBack(t *testing.T) {
tests := []struct {
input uint8
}{
{input: 255},
{input: 0},
}

for _, test := range tests {
bytes := util.Uint8ToBytes(test.input)
result := util.BytesToUint8(bytes)

if result != test.input {
t.Errorf("Expected %d, but got %d", test.input, result)
} else {
fmt.Printf("%v = %d\r\n", bytes, result)
}
}
}

func BenchmarkFloat32ToBytes(b *testing.B) {
input := float32(3.14)
for i := 0; i < b.N; i++ {
Expand Down Expand Up @@ -96,17 +76,3 @@ func BenchmarkBytesToUint16(b *testing.B) {
_ = util.BytesToUint16(input)
}
}

func BenchmarkUint8ToBytes(b *testing.B) {
input := uint8(100)
for i := 0; i < b.N; i++ {
_ = util.Uint8ToBytes(input)
}
}

func BenchmarkBytesToUint8(b *testing.B) {
input := [1]byte{1}
for i := 0; i < b.N; i++ {
_ = util.BytesToUint8(input)
}
}

0 comments on commit 708f8b8

Please sign in to comment.