Add testcommon.CompareHex
This commit is contained in:
parent
dc47a4c8c0
commit
e898379707
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user