MCPcopy Create free account
hub / github.com/koding/kite / TestInfo

Function TestInfo

systeminfo/systeminfo_test.go:5–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestInfo(t *testing.T) {
6 i, err := New()
7 if err != nil {
8 t.Fatalf("want err == nil; got %v", err)
9 }
10
11 t.Logf("info: %+v\n", i)
12
13 t.Logf("MemoryTotal: %dM\n", i.MemoryTotal/1024/1024)
14 t.Logf("MemoryUsage: %dM\n", i.MemoryUsage/1024/1024)
15 t.Logf("DiskTotal: %dG\n", i.DiskTotal/1024/1024)
16 t.Logf("DiskUsage: %dG\n", i.DiskUsage/1024/1024)
17
18 if i.MemoryTotal == 0 {
19 t.Errorf("unexpected memory total %d", i.MemoryTotal)
20 }
21
22 if i.MemoryUsage == 0 || i.MemoryUsage > i.MemoryTotal {
23 t.Errorf("unexpected memory usage %d", i.MemoryUsage)
24 }
25}

Callers

nothing calls this directly

Calls 1

NewFunction · 0.70

Tested by

no test coverage detected