diff --git a/testcommon/common.go b/testcommon/common.go index 591d853..0b05ee5 100644 --- a/testcommon/common.go +++ b/testcommon/common.go @@ -4,6 +4,7 @@ package testcommon import "testing" import "strings" import "strconv" +import "encoding/hex" // LogColumns logs columns of text side by side, each column 80 characters wide. func LogColumns (test *testing.T, width int, columns ...any) { @@ -52,6 +53,12 @@ func Compare (test *testing.T, correct, got string) { } else { LogColumns(test, width, left, right) } - } } + +// CompareHex is like compare, but it prits out the differences in +func CompareHex (test *testing.T, correct, got string) { + correct = hex.Dump([]byte(correct)) + got = hex.Dump([]byte(got)) + Compare(test, correct, got) +}