package platform import "testing" func TestFirstTempInputValue(t *testing.T) { feature := map[string]any{ "temp1_input": 61.5, "temp1_max": 80.0, } got, ok := firstTempInputValue(feature) if !ok { t.Fatal("expected value") } if got != 61.5 { t.Fatalf("got %v want 61.5", got) } } func TestClassifyLiveTempGroup(t *testing.T) { tests := []struct { chip string name string want string }{ {chip: "coretemp-isa-0000", name: "Package id 0", want: "cpu"}, {chip: "amdgpu-pci-4300", name: "edge", want: "gpu"}, {chip: "nvme-pci-0100", name: "Composite", want: "ambient"}, {chip: "acpitz-acpi-0", name: "temp1", want: "ambient"}, } for _, tc := range tests { if got := classifyLiveTempGroup(tc.chip, tc.name); got != tc.want { t.Fatalf("classifyLiveTempGroup(%q,%q)=%q want %q", tc.chip, tc.name, got, tc.want) } } } func TestCompactAmbientTempName(t *testing.T) { if got := compactAmbientTempName("nvme-pci-0100", "Composite"); got != "nvme-pci-0100 / Composite" { t.Fatalf("got %q", got) } if got := compactAmbientTempName("", "Inlet Temp"); got != "Inlet Temp" { t.Fatalf("got %q", got) } }