aboutsummaryrefslogtreecommitdiffstats
path: root/test_runner_test.go
diff options
context:
space:
mode:
authorobscuren <obscuren@obscura.com>2014-01-01 22:49:38 +0800
committerobscuren <obscuren@obscura.com>2014-01-01 22:49:38 +0800
commit5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa (patch)
treeafddcdcfbc1eac391b2619af9fcb1663032edaaf /test_runner_test.go
parent61d67f2ae965a9a1113084f2352e2c2dd97ab9a7 (diff)
downloadgo-tangerine-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar
go-tangerine-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar.gz
go-tangerine-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar.bz2
go-tangerine-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar.lz
go-tangerine-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar.xz
go-tangerine-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.tar.zst
go-tangerine-5b3d4fae6e03e5471a10c653fc0b016cc5e5dcfa.zip
Work in progress external test runner
Diffstat (limited to 'test_runner_test.go')
-rw-r--r--test_runner_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/test_runner_test.go b/test_runner_test.go
new file mode 100644
index 000000000..190bf3caf
--- /dev/null
+++ b/test_runner_test.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ _"fmt"
+ "testing"
+ "encoding/hex"
+)
+
+var testsource = `{"Inputs":{
+ "doe": "reindeer",
+ "dog": "puppy",
+ "dogglesworth": "cat"
+ },
+ "Expectation":"e378927bfc1bd4f01a2e8d9f59bd18db8a208bb493ac0b00f93ce51d4d2af76c"
+}`
+
+func TestTestRunner(t *testing.T) {
+ db, _ := NewMemDatabase()
+ trie := NewTrie(db, "")
+
+ runner := NewTestRunner(t)
+ runner.RunFromString(testsource, func(source *TestSource) {
+ for key, value := range source.Inputs {
+ trie.Update(key, value)
+ }
+
+ if hex.EncodeToString([]byte(trie.root)) != source.Expectation {
+ t.Error("trie root did not match")
+ }
+ })
+}