summaryrefslogtreecommitdiffstats
path: root/devices/temp_darwin_test.go
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-06-09 09:03:58 -0500
committerSean E. Russell <ser@ser1.net>2020-06-09 09:54:10 -0500
commit1181b94bd228f5f081d49f6c7c9a9ee9c26557ed (patch)
tree6c56836eefc5e5ec256ff8a3adfb674562a28f29 /devices/temp_darwin_test.go
parent5590679cb4cc4dcd6ccb4694780eda38326bc4c5 (diff)
Closes #131, SMC GPL issue on OSX; consequently removes need to CGO in darwin.v4.0.1
Diffstat (limited to 'devices/temp_darwin_test.go')
-rw-r--r--devices/temp_darwin_test.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/devices/temp_darwin_test.go b/devices/temp_darwin_test.go
new file mode 100644
index 0000000..6222b57
--- /dev/null
+++ b/devices/temp_darwin_test.go
@@ -0,0 +1,45 @@
+// +build darwin
+
+package devices
+
+import (
+ "testing"
+)
+
+func Test_loadIDs(t *testing.T) {
+ tests := []struct {
+ key string
+ want string
+ }{
+ {"TCAD", "CPU 1 Package Alt."},
+ {"TC1P", "CPU 2 Proximity"},
+ {"TC1H", "CPU 2 Heatsink"},
+ {"TC1D", "CPU 2 Package"},
+ {"TC1E", "CPU 2"},
+ {"TC1F", "CPU 2"},
+ {"TCBH", "CPU 2 Heatsink Alt."},
+ {"TCBD", "CPU 2 Package Alt."},
+ {"TG0P", "GPU Proximity"},
+ {"TG1D", "GPU Die"},
+ {"TG0H", "GPU Heatsink"},
+ {"TG1H", "GPU Heatsink"},
+ {"Ts0S", "Memory Proximity"},
+ {"TM0P", "Mem Bank A1"},
+ {"TM9P", "Mem Bank B2"},
+ {"TCXC", "PECI CPU"},
+ {"PSTR", "System Total"},
+ }
+ ids := loadIDs()
+ L := 161
+ if len(ids) != L {
+ t.Errorf("len(loadIDs) = %d, want %d", len(ids), L)
+ }
+ for _, tt := range tests {
+ t.Run("contents", func(t *testing.T) {
+ got := ids[tt.key]
+ if got != tt.want {
+ t.Errorf("ids[%s] = %v, want %v", tt.key, got, tt.want)
+ }
+ })
+ }
+}