1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-29 13:49:21 +08:00
shirou_gopsutil/cpu_test.go

32 lines
487 B
Go
Raw Normal View History

2014-04-22 09:44:22 +09:00
package gopsutil
2014-04-18 16:34:47 +09:00
import (
"testing"
)
func TestCpu_times(t *testing.T) {
2014-04-30 15:32:05 +09:00
v, err := CPUTimes(false)
2014-04-18 16:34:47 +09:00
if err != nil {
t.Errorf("error %v", err)
}
if len(v) == 0 {
t.Errorf("could not get CPUs ", err)
}
for _, vv := range v {
if vv.User == 0 {
t.Errorf("could not get CPU User: %v", vv)
}
}
}
func TestCpu_counts(t *testing.T) {
2014-04-30 15:32:05 +09:00
v, err := CpuCounts(true)
2014-04-18 16:34:47 +09:00
if err != nil {
t.Errorf("error %v", err)
}
if v == 0 {
t.Errorf("could not get CPU counts: %v", v)
}
}