github.com/turingchain2020/turingchain@v1.1.21/types/fork_test.go (about) 1 // Copyright Turing Corp. 2018 All Rights Reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package types 6 7 import ( 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 ) 12 13 func TestForks(t *testing.T) { 14 cfg := NewTuringchainConfig(GetDefaultCfgstring()) 15 cfg.forks.setLocalFork() 16 assert.Equal(t, cfg.forks.IsFork(1, "ForkV1"), false) 17 assert.Equal(t, cfg.forks.IsFork(1, "ForkV12"), false) 18 assert.Equal(t, cfg.forks.IsFork(0, "ForkBlockHash"), false) 19 assert.Equal(t, cfg.forks.IsFork(1, "ForkBlockHash"), true) 20 assert.Equal(t, cfg.forks.IsFork(1, "ForkTransferExec"), true) 21 assert.Equal(t, cfg.forks.IsFork(0, "ForkBlockHash"), false) 22 assert.Equal(t, cfg.forks.IsFork(1, "ForkBlockHash"), true) 23 } 24 25 func TestParaFork(t *testing.T) { 26 NewTuringchainConfig(ReadFile("testdata/guodun.toml")) 27 NewTuringchainConfig(ReadFile("testdata/guodun2.toml")) 28 }