1 // Copyright 2012, Google, Inc. All rights reserved.
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
7 // This file contains some test helper functions.
12 "github.com/google/gopacket"
16 func min(a, b int) int {
23 func checkLayers(p gopacket.Packet, want []gopacket.LayerType, t *testing.T) {
25 t.Log("Checking packet layers, want", want)
26 for _, l := range layers {
27 t.Logf(" Got layer %v, %d bytes, payload of %d bytes", l.LayerType(),
28 len(l.LayerContents()), len(l.LayerPayload()))
31 if len(layers) != len(want) {
32 t.Errorf(" Number of layers mismatch: got %d want %d", len(layers),
36 for i, l := range layers {
37 if l.LayerType() != want[i] {
38 t.Errorf(" Layer %d mismatch: got %v want %v", i, l.LayerType(),