The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/api/service/explorer/storage_test.go

25 lines
604 B

6 years ago
package explorer
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
)
// Test for GetAddressKey
func TestGetAddressKey(t *testing.T) {
assert.Equal(t, GetAddressKey("abcd"), "ad_abcd", "error")
}
// TestInit ..
6 years ago
func TestInit(t *testing.T) {
ins := GetStorageInstance("1.1.1.1", "3333", true)
if err := ins.GetDB().Put([]byte{1}, []byte{2}, nil); err != nil {
t.Fatal("(*LDBDatabase).Put failed:", err)
}
value, err := ins.GetDB().Get([]byte{1}, nil)
6 years ago
assert.Equal(t, bytes.Compare(value, []byte{2}), 0, "value should be []byte{2}")
assert.Nil(t, err, "error should be nil")
}