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