|
|
|
@ -126,14 +126,93 @@ func TestStorePointerToStruct(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint(t *testing.T) {
|
|
|
|
|
func TestIncrementWithInt(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint", 1, 0)
|
|
|
|
|
err := tc.Increment("tint", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int) != 3 {
|
|
|
|
|
t.Error("tint is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementWithInt8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint8", int8(1), 0)
|
|
|
|
|
err := tc.Increment("tint8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint8 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int8) != 3 {
|
|
|
|
|
t.Error("tint8 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementWithInt16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint16", int16(1), 0)
|
|
|
|
|
err := tc.Increment("tint16", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint16")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint16 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int16) != 3 {
|
|
|
|
|
t.Error("tint16 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementWithInt32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint32", int32(1), 0)
|
|
|
|
|
err := tc.Increment("tint32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int32) != 3 {
|
|
|
|
|
t.Error("tint32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementWithInt64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint64", int64(1), 0)
|
|
|
|
|
err := tc.Increment("tint64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int64) != 3 {
|
|
|
|
|
t.Error("tint64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementWithUint(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint", uint(1), 0)
|
|
|
|
|
err := tc.Increment("tuint", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x, found := tc.Get("tuint")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint was not found")
|
|
|
|
@ -143,7 +222,7 @@ func TestIncrementUint(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUintptr(t *testing.T) {
|
|
|
|
|
func TestIncrementWithUintptr(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuintptr", uintptr(1), 0)
|
|
|
|
|
err := tc.Increment("tuintptr", 2)
|
|
|
|
@ -160,14 +239,13 @@ func TestIncrementUintptr(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint8(t *testing.T) {
|
|
|
|
|
func TestIncrementWithUint8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint8", uint8(1), 0)
|
|
|
|
|
err := tc.Increment("tuint8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x, found := tc.Get("tuint8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint8 was not found")
|
|
|
|
@ -177,7 +255,7 @@ func TestIncrementUint8(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint16(t *testing.T) {
|
|
|
|
|
func TestIncrementWithUint16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint16", uint16(1), 0)
|
|
|
|
|
err := tc.Increment("tuint16", 2)
|
|
|
|
@ -194,14 +272,13 @@ func TestIncrementUint16(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint32(t *testing.T) {
|
|
|
|
|
func TestIncrementWithUint32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint32", uint32(1), 0)
|
|
|
|
|
err := tc.Increment("tuint32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x, found := tc.Get("tuint32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint32 was not found")
|
|
|
|
@ -211,7 +288,7 @@ func TestIncrementUint32(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint64(t *testing.T) {
|
|
|
|
|
func TestIncrementWithUint64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint64", uint64(1), 0)
|
|
|
|
|
err := tc.Increment("tuint64", 2)
|
|
|
|
@ -228,119 +305,135 @@ func TestIncrementUint64(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt(t *testing.T) {
|
|
|
|
|
func TestIncrementWithFloat32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint", 1, 0)
|
|
|
|
|
err := tc.Increment("tint", 2)
|
|
|
|
|
tc.Set("float32", float32(1.5), 0)
|
|
|
|
|
err := tc.Increment("float32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint")
|
|
|
|
|
x, found := tc.Get("float32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint was not found")
|
|
|
|
|
t.Error("float32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int) != 3 {
|
|
|
|
|
t.Error("tint is not 3:", x)
|
|
|
|
|
if x.(float32) != 3.5 {
|
|
|
|
|
t.Error("float32 is not 3.5:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt8(t *testing.T) {
|
|
|
|
|
func TestIncrementWithFloat64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint8", int8(1), 0)
|
|
|
|
|
err := tc.Increment("tint8", 2)
|
|
|
|
|
tc.Set("float64", float64(1.5), 0)
|
|
|
|
|
err := tc.Increment("float64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint8")
|
|
|
|
|
x, found := tc.Get("float64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint8 was not found")
|
|
|
|
|
t.Error("float64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int8) != 3 {
|
|
|
|
|
t.Error("tint8 is not 3:", x)
|
|
|
|
|
if x.(float64) != 3.5 {
|
|
|
|
|
t.Error("float64 is not 3.5:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt16(t *testing.T) {
|
|
|
|
|
func TestIncrementFloatWithFloat32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint16", int16(1), 0)
|
|
|
|
|
err := tc.Increment("tint16", 2)
|
|
|
|
|
tc.Set("float32", float32(1.5), 0)
|
|
|
|
|
err := tc.IncrementFloat("float32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
t.Error("Error incrementfloating:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint16")
|
|
|
|
|
x, found := tc.Get("float32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint16 was not found")
|
|
|
|
|
t.Error("float32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int16) != 3 {
|
|
|
|
|
t.Error("tint16 is not 3:", x)
|
|
|
|
|
if x.(float32) != 3.5 {
|
|
|
|
|
t.Error("float32 is not 3.5:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt32(t *testing.T) {
|
|
|
|
|
func TestIncrementFloatWithFloat64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint32", int32(1), 0)
|
|
|
|
|
err := tc.Increment("tint32", 2)
|
|
|
|
|
tc.Set("float64", float64(1.5), 0)
|
|
|
|
|
err := tc.IncrementFloat("float64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
t.Error("Error incrementfloating:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint32")
|
|
|
|
|
x, found := tc.Get("float64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint32 was not found")
|
|
|
|
|
t.Error("float64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int32) != 3 {
|
|
|
|
|
t.Error("tint32 is not 3:", x)
|
|
|
|
|
if x.(float64) != 3.5 {
|
|
|
|
|
t.Error("float64 is not 3.5:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt64(t *testing.T) {
|
|
|
|
|
func TestDecrementWithInt(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint64", int64(1), 0)
|
|
|
|
|
err := tc.Increment("tint64", 2)
|
|
|
|
|
tc.Set("int", int(5), 0)
|
|
|
|
|
err := tc.Decrement("int", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint64")
|
|
|
|
|
x, found := tc.Get("int")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint64 was not found")
|
|
|
|
|
t.Error("int was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int64) != 3 {
|
|
|
|
|
t.Error("tint64 is not 3:", x)
|
|
|
|
|
if x.(int) != 3 {
|
|
|
|
|
t.Error("int is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementFloat32(t *testing.T) {
|
|
|
|
|
func TestDecrementWithInt8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float32", float32(1.5), 0)
|
|
|
|
|
err := tc.Increment("float32", 2)
|
|
|
|
|
tc.Set("int8", int8(5), 0)
|
|
|
|
|
err := tc.Decrement("int8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float32")
|
|
|
|
|
x, found := tc.Get("int8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float32 was not found")
|
|
|
|
|
t.Error("int8 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float32) != 3.5 {
|
|
|
|
|
t.Error("float32 is not 3.5:", x)
|
|
|
|
|
if x.(int8) != 3 {
|
|
|
|
|
t.Error("int8 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementFloat64(t *testing.T) {
|
|
|
|
|
func TestDecrementWithInt16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float64", float64(1.5), 0)
|
|
|
|
|
err := tc.Increment("float64", 2)
|
|
|
|
|
tc.Set("int16", int16(5), 0)
|
|
|
|
|
err := tc.Decrement("int16", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float64")
|
|
|
|
|
x, found := tc.Get("int16")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float64 was not found")
|
|
|
|
|
t.Error("int16 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float64) != 3.5 {
|
|
|
|
|
t.Error("float64 is not 3.5:", x)
|
|
|
|
|
if x.(int16) != 3 {
|
|
|
|
|
t.Error("int16 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementInt64(t *testing.T) {
|
|
|
|
|
func TestDecrementWithInt32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("int32", int32(5), 0)
|
|
|
|
|
err := tc.Decrement("int32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("int32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("int32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int32) != 3 {
|
|
|
|
|
t.Error("int32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithInt64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("int64", int64(5), 0)
|
|
|
|
|
err := tc.Decrement("int64", 2)
|
|
|
|
@ -356,6 +449,641 @@ func TestDecrementInt64(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithUint(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint", uint(5), 0)
|
|
|
|
|
err := tc.Decrement("uint", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint) != 3 {
|
|
|
|
|
t.Error("uint is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithUintptr(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uintptr", uintptr(5), 0)
|
|
|
|
|
err := tc.Decrement("uintptr", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uintptr")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uintptr was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uintptr) != 3 {
|
|
|
|
|
t.Error("uintptr is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithUint8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint8", uint8(5), 0)
|
|
|
|
|
err := tc.Decrement("uint8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint8 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint8) != 3 {
|
|
|
|
|
t.Error("uint8 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithUint16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint16", uint16(5), 0)
|
|
|
|
|
err := tc.Decrement("uint16", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint16")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint16 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint16) != 3 {
|
|
|
|
|
t.Error("uint16 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithUint32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint32", uint32(5), 0)
|
|
|
|
|
err := tc.Decrement("uint32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint32) != 3 {
|
|
|
|
|
t.Error("uint32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithUint64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint64", uint64(5), 0)
|
|
|
|
|
err := tc.Decrement("uint64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint64) != 3 {
|
|
|
|
|
t.Error("uint64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithFloat32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float32", float32(5.5), 0)
|
|
|
|
|
err := tc.Decrement("float32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float32) != 3.5 {
|
|
|
|
|
t.Error("float32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementWithFloat64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float64", float64(5.5), 0)
|
|
|
|
|
err := tc.Decrement("float64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float64) != 3.5 {
|
|
|
|
|
t.Error("float64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementFloatWithFloat32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float32", float32(5.5), 0)
|
|
|
|
|
err := tc.DecrementFloat("float32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float32) != 3.5 {
|
|
|
|
|
t.Error("float32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementFloatWithFloat64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float64", float64(5.5), 0)
|
|
|
|
|
err := tc.DecrementFloat("float64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float64) != 3.5 {
|
|
|
|
|
t.Error("float64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint", 1, 0)
|
|
|
|
|
n, err := tc.IncrementInt("tint", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int) != 3 {
|
|
|
|
|
t.Error("tint is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint8", int8(1), 0)
|
|
|
|
|
n, err := tc.IncrementInt8("tint8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint8 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int8) != 3 {
|
|
|
|
|
t.Error("tint8 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint16", int16(1), 0)
|
|
|
|
|
n, err := tc.IncrementInt16("tint16", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint16")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint16 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int16) != 3 {
|
|
|
|
|
t.Error("tint16 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint32", int32(1), 0)
|
|
|
|
|
n, err := tc.IncrementInt32("tint32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int32) != 3 {
|
|
|
|
|
t.Error("tint32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementInt64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tint64", int64(1), 0)
|
|
|
|
|
n, err := tc.IncrementInt64("tint64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tint64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tint64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int64) != 3 {
|
|
|
|
|
t.Error("tint64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint", uint(1), 0)
|
|
|
|
|
n, err := tc.IncrementUint("tuint", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tuint")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint) != 3 {
|
|
|
|
|
t.Error("tuint is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUintptr(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuintptr", uintptr(1), 0)
|
|
|
|
|
n, err := tc.IncrementUintptr("tuintptr", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tuintptr")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuintptr was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uintptr) != 3 {
|
|
|
|
|
t.Error("tuintptr is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint8", uint8(1), 0)
|
|
|
|
|
n, err := tc.IncrementUint8("tuint8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tuint8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint8 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint8) != 3 {
|
|
|
|
|
t.Error("tuint8 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint16", uint16(1), 0)
|
|
|
|
|
n, err := tc.IncrementUint16("tuint16", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tuint16")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint16 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint16) != 3 {
|
|
|
|
|
t.Error("tuint16 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint32", uint32(1), 0)
|
|
|
|
|
n, err := tc.IncrementUint32("tuint32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tuint32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint32) != 3 {
|
|
|
|
|
t.Error("tuint32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementUint64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("tuint64", uint64(1), 0)
|
|
|
|
|
n, err := tc.IncrementUint64("tuint64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("tuint64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("tuint64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint64) != 3 {
|
|
|
|
|
t.Error("tuint64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementFloat32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float32", float32(1.5), 0)
|
|
|
|
|
n, err := tc.IncrementFloat32("float32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3.5 {
|
|
|
|
|
t.Error("Returned number is not 3.5:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float32) != 3.5 {
|
|
|
|
|
t.Error("float32 is not 3.5:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIncrementFloat64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float64", float64(1.5), 0)
|
|
|
|
|
n, err := tc.IncrementFloat64("float64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error incrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3.5 {
|
|
|
|
|
t.Error("Returned number is not 3.5:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float64) != 3.5 {
|
|
|
|
|
t.Error("float64 is not 3.5:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementInt8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("int8", int8(5), 0)
|
|
|
|
|
n, err := tc.DecrementInt8("int8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("int8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("int8 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int8) != 3 {
|
|
|
|
|
t.Error("int8 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementInt16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("int16", int16(5), 0)
|
|
|
|
|
n, err := tc.DecrementInt16("int16", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("int16")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("int16 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int16) != 3 {
|
|
|
|
|
t.Error("int16 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementInt32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("int32", int32(5), 0)
|
|
|
|
|
n, err := tc.DecrementInt32("int32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("int32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("int32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int32) != 3 {
|
|
|
|
|
t.Error("int32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementInt64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("int64", int64(5), 0)
|
|
|
|
|
n, err := tc.DecrementInt64("int64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("int64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("int64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(int64) != 3 {
|
|
|
|
|
t.Error("int64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementUint(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint", uint(5), 0)
|
|
|
|
|
n, err := tc.DecrementUint("uint", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint) != 3 {
|
|
|
|
|
t.Error("uint is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementUintptr(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uintptr", uintptr(5), 0)
|
|
|
|
|
n, err := tc.DecrementUintptr("uintptr", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uintptr")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uintptr was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uintptr) != 3 {
|
|
|
|
|
t.Error("uintptr is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementUint8(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint8", uint8(5), 0)
|
|
|
|
|
n, err := tc.DecrementUint8("uint8", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint8")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint8 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint8) != 3 {
|
|
|
|
|
t.Error("uint8 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementUint16(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint16", uint16(5), 0)
|
|
|
|
|
n, err := tc.DecrementUint16("uint16", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint16")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint16 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint16) != 3 {
|
|
|
|
|
t.Error("uint16 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementUint32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint32", uint32(5), 0)
|
|
|
|
|
n, err := tc.DecrementUint32("uint32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint32) != 3 {
|
|
|
|
|
t.Error("uint32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementUint64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("uint64", uint64(5), 0)
|
|
|
|
|
n, err := tc.DecrementUint64("uint64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("uint64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("uint64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(uint64) != 3 {
|
|
|
|
|
t.Error("uint64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementFloat32(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float32", float32(5), 0)
|
|
|
|
|
n, err := tc.DecrementFloat32("float32", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float32")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float32 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float32) != 3 {
|
|
|
|
|
t.Error("float32 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestDecrementFloat64(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
tc.Set("float64", float64(5), 0)
|
|
|
|
|
n, err := tc.DecrementFloat64("float64", 2)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error("Error decrementing:", err)
|
|
|
|
|
}
|
|
|
|
|
if n != 3 {
|
|
|
|
|
t.Error("Returned number is not 3:", n)
|
|
|
|
|
}
|
|
|
|
|
x, found := tc.Get("float64")
|
|
|
|
|
if !found {
|
|
|
|
|
t.Error("float64 was not found")
|
|
|
|
|
}
|
|
|
|
|
if x.(float64) != 3 {
|
|
|
|
|
t.Error("float64 is not 3:", x)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAdd(t *testing.T) {
|
|
|
|
|
tc := New(0, 0)
|
|
|
|
|
err := tc.Add("foo", "bar", 0)
|
|
|
|
|