~rbn/neinp

ref: 062a107b140085acd6c48867e4328fb3f3466a87 neinp/message/remove_test.go -rw-r--r-- 630 bytes
062a107bRuben Schuller use custom go.rbn.im import path 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package message // import "go.rbn.im/neinp/message"

import (
	"bytes"
	"testing"
)

func TestTRemoveEncodeDecode(t *testing.T) {
	var buf bytes.Buffer
	a := &TRemove{Fid: 1}
	_, err := a.encode(&buf)
	if err != nil {
		t.Error(err)
	}

	b := &TRemove{}
	_, err = b.decode(&buf)
	if err != nil {
		t.Error(err)
	}

	if *a != *b {
		t.Log(a, b)
		t.Fail()
	}
}

func TestRRemoveEncodeDecode(t *testing.T) {
	var buf bytes.Buffer
	a := &RRemove{}
	_, err := a.encode(&buf)
	if err != nil {
		t.Error(err)
	}

	b := &RRemove{}
	_, err = b.decode(&buf)
	if err != nil {
		t.Error(err)
	}

	if *a != *b {
		t.Log(a, b)
		t.Fail()
	}
}