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