github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/uefivars/boot/efiDppHardware_test.go (about)

     1  // Copyright 2020 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  //
     5  // SPDX-License-Identifier: BSD-3-Clause
     6  //
     7  
     8  package boot
     9  
    10  import (
    11  	"testing"
    12  )
    13  
    14  //func ParseDppHwPci(h EfiDevicePathProtocolHdr, b []byte) (*DppHwPci, error)
    15  func TestParseDppHwPci(t *testing.T) {
    16  	in := []byte{3, 4}
    17  	hdr := EfiDevicePathProtocolHdr{
    18  		ProtoType:    1,
    19  		ProtoSubType: 6,
    20  		Length:       uint16(len(in) + 4),
    21  	}
    22  
    23  	pci, err := ParseDppHwPci(hdr, in)
    24  	if err != nil {
    25  		t.Fatal(err)
    26  	}
    27  	want := "PCI(0x3,0x4)"
    28  	got := pci.String()
    29  	if want != got {
    30  		t.Errorf("want %s got %s", want, got)
    31  	}
    32  	wantp := "BMC"
    33  	gotp := pci.ProtoSubTypeStr()
    34  	if wantp != gotp {
    35  		t.Errorf("want %s got %s", wantp, gotp)
    36  	}
    37  }