package macvendor

import "testing"

func TestLookupVendor(t *testing.T) {
	tests := []struct {
		mac  string
		want string
	}{
		// Known OUIs from the built-in table.
		{"00:0c:29:1a:2b:3c", "VMware"},
		{"00:50:56:ab:cd:ef", "VMware"},
		{"bc:24:11:00:00:01", "Proxmox/Ceph"},
		{"90:1b:0e:ff:ee:dd", "Supermicro"},
		{"90:09:d0:11:22:33", "Synology"},
		{"00:17:c8:44:55:66", "Hewlett-Packard"},
		{"00:be:43:77:88:99", "Ubiquiti"},
		{"e4:43:4b:aa:bb:cc", "Ubiquiti"},
		{"24:6a:0e:dd:ee:ff", "Ubiquiti"},
		{"40:86:cb:00:11:22", "Intel"},
		{"68:c6:ac:33:44:55", "Intel"},
		{"1c:af:4a:66:77:88", "Dell"},
		{"50:81:40:99:aa:bb", "Dell"},
		{"4c:5f:70:cc:dd:ee", "Lenovo"},
		{"dc:58:bc:ff:00:11", "Apple"},
		{"c8:4b:d6:22:33:44", "Kyocera"},
		{"38:d5:7a:55:66:77", "Samsung"},
		{"00:04:a5:88:99:aa", "Barco"},
		{"7c:5a:1c:bb:cc:dd", "LANCOM"},
		{"00:0a:b3:ee:ff:00", "Cisco"},
		{"00:e0:67:11:22:33", "Aten"},

		// Broadcast — vendor must be empty.
		{"ff:ff:ff:ff:ff:ff", ""},

		// Unknown OUI — no vendor.
		{"de:ad:be:ef:00:01", ""},

		// MAC shorter than 8 characters — must not panic.
		{"aa:bb", ""},
		{"", ""},

		// Upper-case input — must be normalised.
		{"00:0C:29:1A:2B:3C", "VMware"},
		{"BC:24:11:FF:EE:DD", "Proxmox/Ceph"},
	}

	for _, tc := range tests {
		got := LookupVendor(tc.mac)
		if got != tc.want {
			t.Errorf("LookupVendor(%q) = %q, want %q", tc.mac, got, tc.want)
		}
	}
}
