github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/pci/lookup_test.go (about) 1 // Copyright 2012-2017 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 package pci 6 7 import ( 8 "testing" 9 ) 10 11 func TestLookup(t *testing.T) { 12 13 var idLookupTests = []*PCI{ 14 {Vendor: "1055", Device: "e420", VendorName: "Efar Microsystems", DeviceName: "LAN9420/LAN9420i"}, 15 {Vendor: "8086", Device: "1237", VendorName: "Intel Corporation", DeviceName: "440FX - 82441FX PMC [Natoma]"}, 16 {Vendor: "8086", Device: "7000", VendorName: "Intel Corporation", DeviceName: "82371SB PIIX3 ISA [Natoma/Triton II]"}, 17 {Vendor: "8086", Device: "7111", VendorName: "Intel Corporation", DeviceName: "82371AB/EB/MB PIIX4 IDE"}, 18 {Vendor: "80ee", Device: "beef", VendorName: "InnoTek Systemberatung GmbH", DeviceName: "VirtualBox Graphics Adapter"}, 19 {Vendor: "8086", Device: "100e", VendorName: "Intel Corporation", DeviceName: "82540EM Gigabit Ethernet Controller"}, 20 {Vendor: "80ee", Device: "cafe", VendorName: "InnoTek Systemberatung GmbH", DeviceName: "VirtualBox Guest Service"}, 21 {Vendor: "8086", Device: "2415", VendorName: "Intel Corporation", DeviceName: "82801AA AC'97 Audio Controller"}, 22 {Vendor: "8086", Device: "7113", VendorName: "Intel Corporation", DeviceName: "82371AB/EB/MB PIIX4 ACPI"}, 23 {Vendor: "8086", Device: "100f", VendorName: "Intel Corporation", DeviceName: "82545EM Gigabit Ethernet Controller (Copper)"}, 24 } 25 26 t.Run("Lookup Using IDs", func(t *testing.T) { 27 for _, tt := range idLookupTests { 28 tp := tt 29 tp.SetVendorDeviceName() 30 v, d := tp.VendorName, tp.DeviceName 31 if v != tt.VendorName { 32 t.Errorf("Vendor mismatch, found %s, expected %s\n", v, tt.VendorName) 33 } 34 if d != tt.DeviceName { 35 t.Errorf("Device mismatch, found %s, expected %s\n", d, tt.DeviceName) 36 } 37 } 38 }) 39 40 }