This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 313b92a8a7 test(plc4go/spi): use hex diff for test runners
313b92a8a7 is described below
commit 313b92a8a7591a697b931c39632e13f2bf458f95
Author: Sebastian Rühl <[email protected]>
AuthorDate: Thu Feb 23 10:34:10 2023 +0100
test(plc4go/spi): use hex diff for test runners
---
plc4go/spi/testutils/DriverTestRunner.go | 2 +-
plc4go/spi/testutils/ParserSerializerTestRunner.go | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/plc4go/spi/testutils/DriverTestRunner.go
b/plc4go/spi/testutils/DriverTestRunner.go
index 284d939d90..75e72aa7cd 100644
--- a/plc4go/spi/testutils/DriverTestRunner.go
+++ b/plc4go/spi/testutils/DriverTestRunner.go
@@ -350,7 +350,7 @@ func (m DriverTestsuite) ExecuteStep(connection
plc4go.PlcConnection, testcase *
log.Trace().Msg("Comparing bytes")
for i := range expectedRawInput {
if expectedRawInput[i] != rawInput[i] {
- return errors.Errorf("actual output doesn't
match expected output:\nactual: 0x%X\nexpected: 0x%X", rawInput,
expectedRawInput)
+ return errors.Errorf("actual output doesn't
match expected output:\nactual: 0x%X\nexpected: 0x%X\nHexdumps:\n%s",
rawInput, expectedRawInput, utils.DiffHex(rawInput, expectedRawInput))
}
}
// If there's a difference, parse the input and display it to
simplify debugging
diff --git a/plc4go/spi/testutils/ParserSerializerTestRunner.go
b/plc4go/spi/testutils/ParserSerializerTestRunner.go
index ab38d87ff5..e6d905ecba 100644
--- a/plc4go/spi/testutils/ParserSerializerTestRunner.go
+++ b/plc4go/spi/testutils/ParserSerializerTestRunner.go
@@ -230,13 +230,13 @@ func RunParserSerializerTestsuite(t *testing.T, testPath
string, skippedTestCase
rawOutput := writeBuffer.GetBytes()
if len(rawInput) != len(rawOutput) {
t.Errorf("Missmatched number of bytes
expected ->%d != %d<-actual\nexpected:\t%x\nactual:\t\t%x", len(rawInput),
len(rawOutput), rawInput, rawOutput)
-
t.Errorf("Hexdumps\nexpected:\n%s\nactual:\n%s\n", utils.Dump(rawInput),
utils.Dump(rawOutput))
+ t.Errorf("Hexdumps:\n%s",
utils.DiffHex(rawInput, rawOutput))
return
}
for i, val := range rawInput {
if rawOutput[i] != val {
t.Error("Raw output doesn't
match input at position: " + strconv.Itoa(i))
-
t.Errorf("Hexdumps\nexpected:\n%s\nactual:\n%s\n", utils.Dump(rawInput),
utils.Dump(rawOutput))
+ t.Errorf("Hexdumps:\n%s",
utils.DiffHex(rawInput, rawOutput))
return
}
}