aboutsummaryrefslogtreecommitdiffstats
path: root/tests/block_test_util.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-06-11 05:04:06 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-06-19 04:20:44 +0800
commitac0637c41332de1f49fb0955f4fbe0fb908a77d5 (patch)
tree9e87e69656cc317f300ba59692eeb525a230f0bf /tests/block_test_util.go
parentb6d40a931286b4c998f58ad074db0a692aeace6e (diff)
downloaddexon-ac0637c41332de1f49fb0955f4fbe0fb908a77d5.tar
dexon-ac0637c41332de1f49fb0955f4fbe0fb908a77d5.tar.gz
dexon-ac0637c41332de1f49fb0955f4fbe0fb908a77d5.tar.bz2
dexon-ac0637c41332de1f49fb0955f4fbe0fb908a77d5.tar.lz
dexon-ac0637c41332de1f49fb0955f4fbe0fb908a77d5.tar.xz
dexon-ac0637c41332de1f49fb0955f4fbe0fb908a77d5.tar.zst
dexon-ac0637c41332de1f49fb0955f4fbe0fb908a77d5.zip
More consistent test interfaces + test skipping
Diffstat (limited to 'tests/block_test_util.go')
-rw-r--r--tests/block_test_util.go27
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/block_test_util.go b/tests/block_test_util.go
index ec532d178..a04019111 100644
--- a/tests/block_test_util.go
+++ b/tests/block_test_util.go
@@ -86,28 +86,35 @@ type btTransaction struct {
Value string
}
-func runBlockTestsInFile(filepath string, snafus []string) error {
+func RunBlockTest(filepath string) error {
bt, err := LoadBlockTests(filepath)
if err != nil {
return nil
}
- notWorking := make(map[string]bool, 100)
- for _, name := range snafus {
- notWorking[name] = true
+ // map skipped tests to boolean set
+ skipTest := make(map[string]bool, len(blockSkipTests))
+ for _, name := range blockSkipTests {
+ skipTest[name] = true
}
for name, test := range bt {
- if !notWorking[name] {
- if err := runBlockTest(name, test); err != nil {
- return err
- }
+ // if the test should be skipped, return
+ if skipTest[name] {
+ fmt.Println("Skipping state test", name)
+ return nil
+ }
+ // test the block
+ if err := testBlock(test); err != nil {
+ return err
}
+ fmt.Println("Block test passed: ", name)
+
}
return nil
}
-func runBlockTest(name string, test *BlockTest) error {
+func testBlock(test *BlockTest) error {
cfg := testEthConfig()
ethereum, err := eth.New(cfg)
if err != nil {
@@ -136,8 +143,6 @@ func runBlockTest(name string, test *BlockTest) error {
if err = test.ValidatePostState(statedb); err != nil {
return fmt.Errorf("post state validation failed: %v", err)
}
- fmt.Println("Block test passed: ", name)
- // t.Log("Block test passed: ", name)
return nil
}