fix variable name and add reset test.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
b13fd54ba3
commit
87328592dc
|
@ -1,4 +1,4 @@
|
||||||
package boltdb
|
package buntdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package boltdb
|
package buntdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
c "github.com/appleboy/gorush/config"
|
c "github.com/appleboy/gorush/config"
|
||||||
|
@ -11,30 +11,34 @@ func TestBuntDBEngine(t *testing.T) {
|
||||||
|
|
||||||
config := c.BuildDefaultPushConf()
|
config := c.BuildDefaultPushConf()
|
||||||
|
|
||||||
boltDB := New(config)
|
buntDB := New(config)
|
||||||
boltDB.Init()
|
buntDB.Init()
|
||||||
boltDB.Reset()
|
buntDB.Reset()
|
||||||
|
|
||||||
boltDB.AddTotalCount(10)
|
buntDB.AddTotalCount(10)
|
||||||
val = boltDB.GetTotalCount()
|
val = buntDB.GetTotalCount()
|
||||||
assert.Equal(t, int64(10), val)
|
assert.Equal(t, int64(10), val)
|
||||||
boltDB.AddTotalCount(10)
|
buntDB.AddTotalCount(10)
|
||||||
val = boltDB.GetTotalCount()
|
val = buntDB.GetTotalCount()
|
||||||
assert.Equal(t, int64(20), val)
|
assert.Equal(t, int64(20), val)
|
||||||
|
|
||||||
boltDB.AddIosSuccess(20)
|
buntDB.AddIosSuccess(20)
|
||||||
val = boltDB.GetIosSuccess()
|
val = buntDB.GetIosSuccess()
|
||||||
assert.Equal(t, int64(20), val)
|
assert.Equal(t, int64(20), val)
|
||||||
|
|
||||||
boltDB.AddIosError(30)
|
buntDB.AddIosError(30)
|
||||||
val = boltDB.GetIosError()
|
val = buntDB.GetIosError()
|
||||||
assert.Equal(t, int64(30), val)
|
assert.Equal(t, int64(30), val)
|
||||||
|
|
||||||
boltDB.AddAndroidSuccess(40)
|
buntDB.AddAndroidSuccess(40)
|
||||||
val = boltDB.GetAndroidSuccess()
|
val = buntDB.GetAndroidSuccess()
|
||||||
assert.Equal(t, int64(40), val)
|
assert.Equal(t, int64(40), val)
|
||||||
|
|
||||||
boltDB.AddAndroidError(50)
|
buntDB.AddAndroidError(50)
|
||||||
val = boltDB.GetAndroidError()
|
val = buntDB.GetAndroidError()
|
||||||
assert.Equal(t, int64(50), val)
|
assert.Equal(t, int64(50), val)
|
||||||
|
|
||||||
|
buntDB.Reset()
|
||||||
|
val = buntDB.GetAndroidError()
|
||||||
|
assert.Equal(t, int64(0), val)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue