25 lines
905 B
Go
25 lines
905 B
Go
package host
|
|
|
|
import "testing"
|
|
|
|
func TestGPUClassificationAndRecommendation(t *testing.T) {
|
|
gpus := []GPUInfo{
|
|
{Name: "Todesk Virtual Display Adapter", VulkanICD: "", Kind: ClassifyGPU("Todesk Virtual Display Adapter")},
|
|
{Name: "Intel(R) UHD Graphics 770", VulkanICD: `C:\igvk64.json`, Kind: ClassifyGPU("Intel(R) UHD Graphics 770")},
|
|
{Name: "NVIDIA GeForce RTX 4070 Ti", VulkanICD: `C:\nv-vk64.json`, Kind: ClassifyGPU("NVIDIA GeForce RTX 4070 Ti")},
|
|
}
|
|
if gpus[0].Kind != GPUVirtual {
|
|
t.Fatalf("expected virtual, got %s", gpus[0].Kind)
|
|
}
|
|
if gpus[1].Kind != GPUIntegrated {
|
|
t.Fatalf("expected integrated, got %s", gpus[1].Kind)
|
|
}
|
|
if gpus[2].Kind != GPUDiscrete {
|
|
t.Fatalf("expected discrete, got %s", gpus[2].Kind)
|
|
}
|
|
rec := PickRecommendedGPU(gpus)
|
|
if rec == nil || rec.VulkanICD != `C:\nv-vk64.json` {
|
|
t.Fatalf("expected NVIDIA discrete GPU to be recommended, got %#v", rec)
|
|
}
|
|
}
|