diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-10 07:09:32 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-10 07:09:32 +0800 |
commit | 3308491c92ea819826f7606e7a38224e3d2f214a (patch) | |
tree | 75a88111dfe6cb281d22eae280973643881c8332 /core | |
parent | 9ff7be68fba4a8aa07c3d1209c06b842adcfd772 (diff) | |
download | go-tangerine-3308491c92ea819826f7606e7a38224e3d2f214a.tar go-tangerine-3308491c92ea819826f7606e7a38224e3d2f214a.tar.gz go-tangerine-3308491c92ea819826f7606e7a38224e3d2f214a.tar.bz2 go-tangerine-3308491c92ea819826f7606e7a38224e3d2f214a.tar.lz go-tangerine-3308491c92ea819826f7606e7a38224e3d2f214a.tar.xz go-tangerine-3308491c92ea819826f7606e7a38224e3d2f214a.tar.zst go-tangerine-3308491c92ea819826f7606e7a38224e3d2f214a.zip |
Removed tests because they've become obsolete
Diffstat (limited to 'core')
-rw-r--r-- | core/chain_manager_test.go | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index ab43c511d..9a8bc9592 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -1,116 +1 @@ package core - -import ( - "fmt" - "math/big" - "testing" - "time" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/state" -) - -var TD *big.Int - -func init() { - ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "") - ethutil.Config.Db, _ = ethdb.NewMemDatabase() -} - -type fakeproc struct { -} - -func (self fakeproc) ProcessWithParent(a, b *types.Block) (*big.Int, state.Messages, error) { - TD = new(big.Int).Add(TD, big.NewInt(1)) - return TD, nil, nil -} - -func makechain(cman *ChainManager, max int) *BlockChain { - blocks := make(types.Blocks, max) - for i := 0; i < max; i++ { - addr := ethutil.LeftPadBytes([]byte{byte(i)}, 20) - block := cman.NewBlock(addr) - if i != 0 { - cman.CurrentBlock = blocks[i-1] - } - blocks[i] = block - } - return NewChain(blocks) -} - -func TestLongerFork(t *testing.T) { - cman := NewChainManager() - cman.SetProcessor(fakeproc{}) - - TD = big.NewInt(1) - chainA := makechain(cman, 5) - - TD = big.NewInt(1) - chainB := makechain(cman, 10) - - td, err := cman.TestChain(chainA) - if err != nil { - t.Error("unable to create new TD from chainA:", err) - } - cman.TD = td - - _, err = cman.TestChain(chainB) - if err != nil { - t.Error("expected chainB not to give errors:", err) - } -} - -func TestEqualFork(t *testing.T) { - cman := NewChainManager() - cman.SetProcessor(fakeproc{}) - - TD = big.NewInt(1) - chainA := makechain(cman, 5) - - TD = big.NewInt(2) - chainB := makechain(cman, 5) - - td, err := cman.TestChain(chainA) - if err != nil { - t.Error("unable to create new TD from chainA:", err) - } - cman.TD = td - - _, err = cman.TestChain(chainB) - if err != nil { - t.Error("expected chainB not to give errors:", err) - } -} - -func TestBrokenChain(t *testing.T) { - cman := NewChainManager() - cman.SetProcessor(fakeproc{}) - - TD = big.NewInt(1) - chain := makechain(cman, 5) - chain.Remove(chain.Front()) - - _, err := cman.TestChain(chain) - if err == nil { - t.Error("expected broken chain to return error") - } -} - -func BenchmarkChainTesting(b *testing.B) { - const chainlen = 1000 - - ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "") - ethutil.Config.Db, _ = ethdb.NewMemDatabase() - - cman := NewChainManager() - cman.SetProcessor(fakeproc{}) - - TD = big.NewInt(1) - chain := makechain(cman, chainlen) - - stime := time.Now() - cman.TestChain(chain) - fmt.Println(chainlen, "took", time.Since(stime)) -} |