Skip to content

Commit

Permalink
New type for mqtt payload in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte Muench committed Apr 28, 2024
1 parent 3f0b7e2 commit 3464189
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/internal/convertfunctions/none_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func TestNoneToCan(t *testing.T) {
input := "Gladys"
input := []byte("Gladys")
output, err := NoneToCan(input)

// Check whether err is nil
Expand All @@ -32,7 +32,7 @@ func TestNoneToCan(t *testing.T) {
t.Fatalf(`NoneToMqtt failed, err not nil: %s`, err.Error())
}

if input != back {
if string(input) != string(back) {
t.Fatalf(`NoneToCan failed, back and forth conversion did not lead to original input`)
}
}
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestNoneToMqtt(t *testing.T) {
}

func FuzzNoneToCan(f *testing.F) {
f.Fuzz(func(t *testing.T, input string) {
f.Fuzz(func(t *testing.T, input []byte) {
output, err := NoneToCan(input)
if err != nil {
t.Fatalf("%v: decode: %v", input, err)
Expand All @@ -102,7 +102,7 @@ func FuzzNoneToCan(f *testing.F) {
}

// only first 8 bytes are important
if input[:8] != back {
if string(input[:8]) != string(back) {
t.Fatalf(`NoneToCan failed, back and forth conversion did not lead to original input`)
}
} else {
Expand All @@ -123,7 +123,7 @@ func FuzzNoneToCan(f *testing.F) {
t.Fatalf(`NoneToMqtt failed, err not nil: %s`, err.Error())
}

if input != back {
if string(input) != string(back) {
t.Fatalf(`NoneToCan failed, back and forth conversion did not lead to original input`)
}
}
Expand Down

0 comments on commit 3464189

Please sign in to comment.