Official Go implementation of the Ethereum protocol
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.
go-ethereum/test_runner_test.go

34 lines
700 B

package main
import (
"encoding/hex"
_ "fmt"
11 years ago
"github.com/ethereum/ethdb-go"
"github.com/ethereum/ethutil-go"
"testing"
)
var testsource = `{"Inputs":{
"doe": "reindeer",
"dog": "puppy",
"dogglesworth": "cat"
},
"Expectation":"e378927bfc1bd4f01a2e8d9f59bd18db8a208bb493ac0b00f93ce51d4d2af76c"
}`
func TestTestRunner(t *testing.T) {
11 years ago
db, _ := ethdb.NewMemDatabase()
trie := ethutil.NewTrie(db, "")
runner := NewTestRunner(t)
runner.RunFromString(testsource, func(source *TestSource) {
for key, value := range source.Inputs {
trie.Update(key, value)
}
11 years ago
if hex.EncodeToString([]byte(trie.Root)) != source.Expectation {
t.Error("trie root did not match")
}
})
}