Browse Source

Really basic proof-of-concept test

Evan Huus 12 years ago
parent
commit
a383246e86
1 changed files with 23 additions and 0 deletions
  1. 23 0
      protocol/fetch_request_test.go

+ 23 - 0
protocol/fetch_request_test.go

@@ -0,0 +1,23 @@
+package protocol
+
+import (
+	"bytes"
+	"testing"
+)
+
+var (
+	fetchRequestNoBlocks = []byte{
+		0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+)
+
+func TestFetchRequestEncoding(t *testing.T) {
+	request := new(FetchRequest)
+	packet, err := encode(request)
+	if err != nil {
+		t.Error(err)
+	}
+	if !bytes.Equal(packet, fetchRequestNoBlocks) {
+		t.Error("Encoding no blocks failed, got ", packet)
+	}
+}