aboutsummaryrefslogtreecommitdiff
path: root/goldap/write_test.go
blob: 7c82bd7d9e7e8fd065d59422520d80c2765928bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package message

import (
	"reflect"
	"testing"
)

func TestWriteLDAPMessage(t *testing.T) {

	var testData = getLDAPMessageTestData()
	for i, test := range testData {
		bytes, err := test.out.Write()
		if err != nil {
			t.Errorf("#%d error at offset %d (%s): %s\nEXPECTED BYTES: %#v\nWRITTEN BYTES: %#v\n", i, test.bytes.offset, test.bytes.DumpCurrentBytes(), err, test.bytes.getBytes(), bytes.getBytes())
		} else if !reflect.DeepEqual(bytes.getBytes(), test.bytes.getBytes()) {
			t.Errorf("#%d:\nGOT:\n%#+v\nEXPECTED:\n%#+v", i, bytes.getBytes(), test.bytes.getBytes())
		}
	}
}