Add testcommon.CompareHex
This commit is contained in:
parent
dc47a4c8c0
commit
e898379707
|
@ -4,6 +4,7 @@ package testcommon
|
||||||
import "testing"
|
import "testing"
|
||||||
import "strings"
|
import "strings"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
import "encoding/hex"
|
||||||
|
|
||||||
// LogColumns logs columns of text side by side, each column 80 characters wide.
|
// LogColumns logs columns of text side by side, each column 80 characters wide.
|
||||||
func LogColumns (test *testing.T, width int, columns ...any) {
|
func LogColumns (test *testing.T, width int, columns ...any) {
|
||||||
|
@ -52,6 +53,12 @@ func Compare (test *testing.T, correct, got string) {
|
||||||
} else {
|
} else {
|
||||||
LogColumns(test, width, left, right)
|
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