2014-01-01 14:49:38 +00:00
|
|
|
package main
|
|
|
|
|
2014-02-06 22:47:04 +00:00
|
|
|
/*
|
2014-01-01 14:49:38 +00:00
|
|
|
import (
|
2014-01-11 14:27:08 +00:00
|
|
|
"encoding/hex"
|
|
|
|
_ "fmt"
|
2014-01-15 22:32:30 +00:00
|
|
|
"github.com/ethereum/ethdb-go"
|
|
|
|
"github.com/ethereum/ethutil-go"
|
2014-01-11 14:27:08 +00:00
|
|
|
"testing"
|
2014-01-01 14:49:38 +00:00
|
|
|
)
|
|
|
|
|
2014-01-16 10:02:19 +00:00
|
|
|
var testsource = `
|
|
|
|
{
|
|
|
|
"inputs":{
|
|
|
|
"doe": "reindeer",
|
|
|
|
"dog": "puppy",
|
|
|
|
"dogglesworth": "cat"
|
|
|
|
},
|
|
|
|
"expectation":"e378927bfc1bd4f01a2e8d9f59bd18db8a208bb493ac0b00f93ce51d4d2af76c"
|
2014-01-01 14:49:38 +00:00
|
|
|
}`
|
|
|
|
|
|
|
|
func TestTestRunner(t *testing.T) {
|
2014-01-15 22:32:30 +00:00
|
|
|
db, _ := ethdb.NewMemDatabase()
|
|
|
|
trie := ethutil.NewTrie(db, "")
|
2014-01-01 14:49:38 +00:00
|
|
|
|
2014-01-11 14:27:08 +00:00
|
|
|
runner := NewTestRunner(t)
|
|
|
|
runner.RunFromString(testsource, func(source *TestSource) {
|
|
|
|
for key, value := range source.Inputs {
|
|
|
|
trie.Update(key, value)
|
|
|
|
}
|
2014-01-31 09:59:30 +00:00
|
|
|
if hex.EncodeToString(trie.Root.([]byte)) != source.Expectation {
|
2014-01-11 14:27:08 +00:00
|
|
|
t.Error("trie root did not match")
|
|
|
|
}
|
|
|
|
})
|
2014-01-01 14:49:38 +00:00
|
|
|
}
|
2014-02-06 22:47:04 +00:00
|
|
|
*/
|