(t *testing.T)
| 181 | } |
| 182 | |
| 183 | func TestDecodeSampleHeader(t *testing.T) { |
| 184 | filter := []uint32{DataCounterSample} |
| 185 | reader := bytes.NewReader(TestsFlowRawPacket) |
| 186 | |
| 187 | d := NewSFDecoder(reader, filter) |
| 188 | |
| 189 | datagram, err := d.SFDecode() |
| 190 | if err != nil { |
| 191 | t.Error("unexpected error", err) |
| 192 | } |
| 193 | |
| 194 | if len(datagram.Samples) != 5 { |
| 195 | t.Error("expected samples## 5, got", len(datagram.Samples)) |
| 196 | } |
| 197 | |
| 198 | sample := datagram.Samples[0].(*FlowSample) |
| 199 | |
| 200 | if sample.SequenceNo != 0xa65cc8eb { |
| 201 | t.Error("expected SequenceNo 0xa65cc8eb, got", sample.SequenceNo) |
| 202 | } |
| 203 | |
| 204 | if sample.SourceID != 0 { |
| 205 | t.Error("expected SourceID 0, got", sample.SourceID) |
| 206 | } |
| 207 | |
| 208 | if sample.SamplingRate != 0x1000 { |
| 209 | t.Error("expected SamplingRate 0x1000, got", sample.SamplingRate) |
| 210 | } |
| 211 | |
| 212 | if sample.SamplePool != 0xcc8ec000 { |
| 213 | t.Error("expected SamplePool 0xcc8ec000, got", sample.SamplePool) |
| 214 | } |
| 215 | |
| 216 | if sample.Drops != 0 { |
| 217 | t.Error("expected Drops 0, got", sample.Drops) |
| 218 | } |
| 219 | |
| 220 | if sample.Input != 0x231 { |
| 221 | t.Error("expected Input 0x231, got", sample.Input) |
| 222 | } |
| 223 | |
| 224 | if sample.Output != 0x2c3 { |
| 225 | t.Error("expected Output 0x2c3, got", sample.Output) |
| 226 | } |
| 227 | |
| 228 | if sample.RecordsNo != 0x3 { |
| 229 | t.Error("expected RecordsNo 0x3, got", sample.RecordsNo) |
| 230 | } |
| 231 | |
| 232 | } |
| 233 | |
| 234 | func BenchmarkSFDecode(b *testing.B) { |
| 235 | filter := []uint32{DataCounterSample} |
nothing calls this directly
no test coverage detected