fetch_request_test.go 441 B

1234567891011121314151617181920212223
  1. package protocol
  2. import (
  3. "bytes"
  4. "testing"
  5. )
  6. var (
  7. fetchRequestNoBlocks = []byte{
  8. 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
  9. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
  10. )
  11. func TestFetchRequestEncoding(t *testing.T) {
  12. request := new(FetchRequest)
  13. packet, err := encode(request)
  14. if err != nil {
  15. t.Error(err)
  16. }
  17. if !bytes.Equal(packet, fetchRequestNoBlocks) {
  18. t.Error("Encoding no blocks failed, got ", packet)
  19. }
  20. }