shirou_gopsutil/mem_test.go

30 lines
432 B
Go
Raw Normal View History

2014-04-18 15:34:47 +08:00
package main
import (
"encoding/json"
"fmt"
"testing"
)
func TestVirtual_memory(t *testing.T) {
mem := NewMem()
v, err := mem.Virtual_memory()
if err != nil {
t.Errorf("error %v", err)
}
d, _ := json.Marshal(v)
fmt.Printf("%s\n", d)
}
func TestSwap_memory(t *testing.T) {
mem := NewMem()
v, err := mem.Swap_memory()
if err != nil {
t.Errorf("error %v", err)
}
d, _ := json.Marshal(v)
fmt.Printf("%s\n", d)
}