2016-05-02 03:04:19 +00:00
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMemoryEngine(t *testing.T) {
|
|
|
|
var val int64
|
|
|
|
|
2016-05-02 09:03:08 +00:00
|
|
|
memory := New()
|
2016-05-02 03:04:19 +00:00
|
|
|
|
2016-05-02 09:03:08 +00:00
|
|
|
memory.AddTotalCount(1)
|
|
|
|
val = memory.GetTotalCount()
|
2016-05-02 03:04:19 +00:00
|
|
|
assert.Equal(t, int64(1), val)
|
|
|
|
|
2016-05-02 09:03:08 +00:00
|
|
|
memory.AddIosSuccess(2)
|
|
|
|
val = memory.GetIosSuccess()
|
2016-05-02 03:04:19 +00:00
|
|
|
assert.Equal(t, int64(2), val)
|
|
|
|
|
2016-05-02 09:03:08 +00:00
|
|
|
memory.AddIosError(3)
|
|
|
|
val = memory.GetIosError()
|
2016-05-02 03:04:19 +00:00
|
|
|
assert.Equal(t, int64(3), val)
|
|
|
|
|
2016-05-02 09:03:08 +00:00
|
|
|
memory.AddAndroidSuccess(4)
|
|
|
|
val = memory.GetAndroidSuccess()
|
2016-05-02 03:04:19 +00:00
|
|
|
assert.Equal(t, int64(4), val)
|
|
|
|
|
2016-05-02 09:03:08 +00:00
|
|
|
memory.AddAndroidError(5)
|
|
|
|
val = memory.GetAndroidError()
|
2016-05-02 03:04:19 +00:00
|
|
|
assert.Equal(t, int64(5), val)
|
|
|
|
}
|