diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2019-01-10 10:57:50 +0100 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2019-01-10 11:05:35 +0100 |
commit | 08266e35878f198e2fa59fcfc9f0fc3a4b1dfbf5 (patch) | |
tree | 1269acfc3bf6fdd47414eb64da3ecad4865e37d6 /vendor/github.com/google/gopacket/packet_test.go | |
parent | 3ef6f210edcf7dd753733d46ec3f2dd5dc795b61 (diff) |
Add support for string types
- strings are now generated as two fields for length and string itself
- aliases are now sorted by name to prevent generating different code
- dependencies are now managed by dep
- binapi files are regenerated using VPP 19.01-rc0~622-g7b01e9e8
- old stats binary api has been deprecated and removed from VPP
Change-Id: Ieb8515c73021339a45f407386f8e3d87dcf4469e
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'vendor/github.com/google/gopacket/packet_test.go')
-rw-r--r-- | vendor/github.com/google/gopacket/packet_test.go | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/vendor/github.com/google/gopacket/packet_test.go b/vendor/github.com/google/gopacket/packet_test.go deleted file mode 100644 index bd05448..0000000 --- a/vendor/github.com/google/gopacket/packet_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2012 Google, Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style license -// that can be found in the LICENSE file in the root of the source -// tree. - -package gopacket - -import ( - "io" - "reflect" - "testing" -) - -type embedded struct { - A, B int -} - -type embedding struct { - embedded - C, D int -} - -func TestDumpEmbedded(t *testing.T) { - e := embedding{embedded: embedded{A: 1, B: 2}, C: 3, D: 4} - if got, want := layerString(reflect.ValueOf(e), false, false), "{A=1 B=2 C=3 D=4}"; got != want { - t.Errorf("embedded dump mismatch:\n got: %v\n want: %v", got, want) - } -} - -type singlePacketSource [1][]byte - -func (s *singlePacketSource) ReadPacketData() ([]byte, CaptureInfo, error) { - if (*s)[0] == nil { - return nil, CaptureInfo{}, io.EOF - } - out := (*s)[0] - (*s)[0] = nil - return out, CaptureInfo{}, nil -} - -func TestConcatPacketSources(t *testing.T) { - sourceA := &singlePacketSource{[]byte{1}} - sourceB := &singlePacketSource{[]byte{2}} - sourceC := &singlePacketSource{[]byte{3}} - concat := ConcatFinitePacketDataSources(sourceA, sourceB, sourceC) - a, _, err := concat.ReadPacketData() - if err != nil || len(a) != 1 || a[0] != 1 { - t.Errorf("expected [1], got %v/%v", a, err) - } - b, _, err := concat.ReadPacketData() - if err != nil || len(b) != 1 || b[0] != 2 { - t.Errorf("expected [2], got %v/%v", b, err) - } - c, _, err := concat.ReadPacketData() - if err != nil || len(c) != 1 || c[0] != 3 { - t.Errorf("expected [3], got %v/%v", c, err) - } - if _, _, err := concat.ReadPacketData(); err != io.EOF { - t.Errorf("expected io.EOF, got %v", err) - } -} |