From 9b85002b700500d421ba7e13ac2062a6b8090a83 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 25 Nov 2014 16:01:39 +0100 Subject: p2p: remove Msg.Value and MsgLoop --- p2p/message_test.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'p2p/message_test.go') diff --git a/p2p/message_test.go b/p2p/message_test.go index 0f51f759e..7b39b061d 100644 --- a/p2p/message_test.go +++ b/p2p/message_test.go @@ -29,8 +29,7 @@ func TestEncodeDecodeMsg(t *testing.T) { if err := writeMsg(buf, msg); err != nil { t.Fatalf("encodeMsg error: %v", err) } - - t.Logf("encoded: %x", buf.Bytes()) + // t.Logf("encoded: %x", buf.Bytes()) decmsg, err := readMsg(buf) if err != nil { @@ -42,18 +41,19 @@ func TestEncodeDecodeMsg(t *testing.T) { if decmsg.Size != 5 { t.Errorf("incorrect size %d, want %d", decmsg.Size, 5) } - data, err := decmsg.Value() - if err != nil { - t.Fatalf("first payload item decode error: %v", err) + + var data struct { + I int + S string } - if v := data.Len(); v != 2 { - t.Errorf("incorrect data.Len(): got %v, expected %d", v, 1) + if err := decmsg.Decode(&data); err != nil { + t.Fatalf("Decode error: %v", err) } - if v := data.Get(0).Uint(); v != 1 { - t.Errorf("incorrect data[0]: got %v, expected %d", v, 1) + if data.I != 1 { + t.Errorf("incorrect data.I: got %v, expected %d", data.I, 1) } - if v := data.Get(1).Str(); v != "000" { - t.Errorf("incorrect data[1]: got %q, expected %q", v, "000") + if data.S != "000" { + t.Errorf("incorrect data.S: got %q, expected %q", data.S, "000") } } -- cgit v1.2.3