generate: Fix the testEncode function
This commit is contained in:
parent
b826cbf83e
commit
b50a199842
@ -36,6 +36,7 @@ func testGenerateRun(test *testing.T, protocol *Protocol, imports string, testCa
|
||||
import "bytes"
|
||||
import "slices"
|
||||
import "git.tebibyte.media/sashakoshka/hopp/tape"
|
||||
import tu "git.tebibyte.media/sashakoshka/hopp/internal/testutil"
|
||||
` + imports
|
||||
setup := `log.Println("*** BEGIN TEST CASE OUTPUT ***")`
|
||||
teardown := `log.Println("--- END TEST CASE OUTPUT ---")`
|
||||
@ -46,11 +47,13 @@ func testGenerateRun(test *testing.T, protocol *Protocol, imports string, testCa
|
||||
n, err := message.Encode(encoder)
|
||||
if err != nil { log.Fatalf("at %d: %v\n", n, err) }
|
||||
got := buffer.Bytes()
|
||||
log.Println("got: ", tu.HexBytes(got))
|
||||
log.Println("correct:", tu.HexBytes(correct))
|
||||
if n != len(got) {
|
||||
log.Fatalln("len incorrect: %d != %d", got, correct)
|
||||
log.Fatalf("n incorrect: %d != %d\n", n, len(got))
|
||||
}
|
||||
if !slices.Equal(got, correct) {
|
||||
log.Fatalln("not equal:")
|
||||
log.Fatalln("not equal")
|
||||
}
|
||||
}
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user