Esempio n. 1
0
func TestBackendKeyReading(t *testing.T) {
	buf := bytes.Buffer{}
	const PID = 1234
	const KEY = 5768
	femebe.WriteInt32(&buf, PID)
	femebe.WriteInt32(&buf, KEY)

	var m femebe.Message
	m.InitFromBytes(MSG_BACKEND_KEY_DATA_K, buf.Bytes())

	kd, err := ReadBackendKeyData(&m)
	if err != nil {
		t.Fatal()
	}

	if kd.pid != PID {
		t.Fatal()
	}

	if kd.key != KEY {
		t.Fatal()
	}
}
Esempio n. 2
0
func encodeValText(buf *bytes.Buffer,
	val interface{}, format string) {
	result := fmt.Sprintf(format, val)
	femebe.WriteInt32(buf, int32(len([]byte(result))))
	buf.WriteString(result)
}
Esempio n. 3
0
func BinEncodeInt16(buff *bytes.Buffer, val int16) {
	femebe.WriteInt32(buff, 2)
	femebe.WriteInt16(buff, val)
}