mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 05:15:47 +00:00
wrap payload for all processors
This commit is contained in:
@@ -3,6 +3,7 @@ package processor_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jwetzell/showbridge-go/internal/common"
|
||||
"github.com/jwetzell/showbridge-go/internal/config"
|
||||
"github.com/jwetzell/showbridge-go/internal/processor"
|
||||
)
|
||||
@@ -70,7 +71,7 @@ func TestGoodFloatRandom(t *testing.T) {
|
||||
t.Fatalf("float.random failed to create processor: %s", err)
|
||||
}
|
||||
|
||||
got, err := processorInstance.Process(t.Context(), test.payload)
|
||||
got, err := processorInstance.Process(t.Context(), common.GetWrappedPayload(t.Context(), test.payload))
|
||||
if err != nil {
|
||||
t.Fatalf("float.random processing failed: %s", err)
|
||||
}
|
||||
@@ -82,16 +83,16 @@ func TestGoodFloatRandom(t *testing.T) {
|
||||
|
||||
var gotFloat float64
|
||||
if bitSize == 32 {
|
||||
gotFloat32, ok := got.(float32)
|
||||
gotFloat32, ok := got.Payload.(float32)
|
||||
if !ok {
|
||||
t.Fatalf("float.random returned a %T payload: %s", got, got)
|
||||
t.Fatalf("float.random returned a %T payload: %+v", got, got)
|
||||
}
|
||||
gotFloat = float64(gotFloat32)
|
||||
}
|
||||
if bitSize == 64 {
|
||||
gotFloat64, ok := got.(float64)
|
||||
gotFloat64, ok := got.Payload.(float64)
|
||||
if !ok {
|
||||
t.Fatalf("float.random returned a %T payload: %s", got, got)
|
||||
t.Fatalf("float.random returned a %T payload: %+v", got, got)
|
||||
}
|
||||
gotFloat = gotFloat64
|
||||
}
|
||||
@@ -171,10 +172,10 @@ func TestBadFloatRandom(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
got, err := processorInstance.Process(t.Context(), test.payload)
|
||||
got, err := processorInstance.Process(t.Context(), common.GetWrappedPayload(t.Context(), test.payload))
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("float.random expected to fail but got payload: %s", got)
|
||||
t.Fatalf("float.random expected to fail but got payload: %+v", got)
|
||||
}
|
||||
|
||||
if err.Error() != test.errorString {
|
||||
|
||||
Reference in New Issue
Block a user