func TestStreamText(t *testing.T) { source := []byte("test.data\n") reader := bytes.NewReader(source) restored, err := zabbix.Stream2Data(reader) if err != nil { t.Errorf("must be no error: %v", err) } if !bytes.Equal(restored, source) { t.Errorf("invalid data %v <=> %v", restored, source) } }
func TestStreamBinary(t *testing.T) { source := []byte("test.data") packet := zabbix.Data2Packet(source) buf := bytes.NewReader(packet) restored, err := zabbix.Stream2Data(buf) if err != nil { t.Errorf("must be no error: %v", err) } if !bytes.Equal(restored, source) { t.Errorf("invalid data %v <=> %v", restored, source) } }