|
@@ -11,31 +11,19 @@ func TestFreeMem(t *testing.T) {
|
|
|
m := Memory{}
|
|
|
m.Free = uint64(1200)
|
|
|
got := m.Free
|
|
|
- want := uint64(1200)
|
|
|
- name := "free"
|
|
|
- if got != want {
|
|
|
- t.Errorf("got %s %d want %d", name, got, want)
|
|
|
- }
|
|
|
+ assertInt64(t, "free", got, uint64(1200))
|
|
|
}
|
|
|
|
|
|
func TestTotalMem(t *testing.T) {
|
|
|
m := Memory{Total: uint64(2400)}
|
|
|
got := m.Total
|
|
|
- want := uint64(2400)
|
|
|
- name := "total"
|
|
|
- if got != want {
|
|
|
- t.Errorf("got %s %d want %d", name, got, want)
|
|
|
- }
|
|
|
+ assertInt64(t, "total", got, uint64(2400))
|
|
|
}
|
|
|
|
|
|
func TestUsedMem(t *testing.T) {
|
|
|
m := Memory{Total: uint64(2400), Free: uint64(1200)}
|
|
|
got := m.Used()
|
|
|
- want := uint64(1200)
|
|
|
- name := "used"
|
|
|
- if got != want {
|
|
|
- t.Errorf("got %s %d want %d", name, got, want)
|
|
|
- }
|
|
|
+ assertInt64(t, "used", got, uint64(1200))
|
|
|
}
|
|
|
|
|
|
func TestNewMemory(t *testing.T) {
|
|
@@ -44,11 +32,7 @@ func TestNewMemory(t *testing.T) {
|
|
|
mem := NewMemory(r)
|
|
|
t.Run("Test that we can get total memory", func(t *testing.T) {
|
|
|
got := mem.Total
|
|
|
- want := uint64(16080192)
|
|
|
- name := "memory total"
|
|
|
- if got != want {
|
|
|
- t.Errorf("got %s %d want %d", name, got, want)
|
|
|
- }
|
|
|
+ assertInt64(t, "memory total", got, uint64(16080192))
|
|
|
})
|
|
|
|
|
|
t.Run("Test that we can properly report Memory usage", func(t *testing.T) {
|