mirror of https://github.com/ethereum/go-ethereum
parent
e82100367f
commit
1b26d4f220
@ -1,11 +0,0 @@ |
||||
package helper |
||||
|
||||
import "github.com/ethereum/go-ethereum/common" |
||||
|
||||
func FromHex(h string) []byte { |
||||
if common.IsHex(h) { |
||||
h = h[2:] |
||||
} |
||||
|
||||
return common.Hex2Bytes(h) |
||||
} |
@ -1,16 +0,0 @@ |
||||
package helper |
||||
|
||||
import ( |
||||
"log" |
||||
"os" |
||||
|
||||
logpkg "github.com/ethereum/go-ethereum/logger" |
||||
) |
||||
|
||||
var Logger *logpkg.StdLogSystem |
||||
var Log = logpkg.NewLogger("TEST") |
||||
|
||||
func init() { |
||||
Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.InfoLevel) |
||||
logpkg.AddLogSystem(Logger) |
||||
} |
@ -1,31 +0,0 @@ |
||||
package helper |
||||
|
||||
import "github.com/ethereum/go-ethereum/trie" |
||||
|
||||
type MemDatabase struct { |
||||
db map[string][]byte |
||||
} |
||||
|
||||
func NewMemDatabase() (*MemDatabase, error) { |
||||
db := &MemDatabase{db: make(map[string][]byte)} |
||||
return db, nil |
||||
} |
||||
func (db *MemDatabase) Put(key []byte, value []byte) { |
||||
db.db[string(key)] = value |
||||
} |
||||
func (db *MemDatabase) Get(key []byte) ([]byte, error) { |
||||
return db.db[string(key)], nil |
||||
} |
||||
func (db *MemDatabase) Delete(key []byte) error { |
||||
delete(db.db, string(key)) |
||||
return nil |
||||
} |
||||
func (db *MemDatabase) Print() {} |
||||
func (db *MemDatabase) Close() {} |
||||
func (db *MemDatabase) LastKnownTD() []byte { return nil } |
||||
|
||||
func NewTrie() *trie.Trie { |
||||
db, _ := NewMemDatabase() |
||||
|
||||
return trie.New(nil, db) |
||||
} |
@ -1,14 +1,25 @@ |
||||
package helper |
||||
package tests |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"io" |
||||
"io/ioutil" |
||||
// "log"
|
||||
"net/http" |
||||
"os" |
||||
"testing" |
||||
|
||||
// logpkg "github.com/ethereum/go-ethereum/logger"
|
||||
) |
||||
|
||||
// var Logger *logpkg.StdLogSystem
|
||||
// var Log = logpkg.NewLogger("TEST")
|
||||
|
||||
// func init() {
|
||||
// Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.InfoLevel)
|
||||
// logpkg.AddLogSystem(Logger)
|
||||
// }
|
||||
|
||||
func readJSON(t *testing.T, reader io.Reader, value interface{}) { |
||||
data, err := ioutil.ReadAll(reader) |
||||
err = json.Unmarshal(data, &value) |
Loading…
Reference in new issue