github.com/iotexproject/iotex-core@v1.14.1-rc1/blockchain/genesis/heightupgrade_test.go (about) 1 // Copyright (c) 2024 IoTeX 2 // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 6 package genesis 7 8 import ( 9 "testing" 10 11 "github.com/stretchr/testify/require" 12 ) 13 14 func TestNewHeightChange(t *testing.T) { 15 require := require.New(t) 16 17 cfg := Default 18 cfg.PacificBlockHeight = uint64(432001) 19 20 require.False(cfg.IsPacific(uint64(432000))) 21 require.True(cfg.IsPacific(uint64(432001))) 22 require.False(cfg.IsAleutian(uint64(864000))) 23 require.True(cfg.IsAleutian(uint64(864001))) 24 require.False(cfg.IsBering(uint64(1512000))) 25 require.True(cfg.IsBering(uint64(1512001))) 26 require.False(cfg.IsCook(uint64(1641600))) 27 require.True(cfg.IsCook(uint64(1641601))) 28 require.False(cfg.IsDardanelles(uint64(1816200))) 29 require.True(cfg.IsDardanelles(uint64(1816201))) 30 require.False(cfg.IsDaytona(uint64(3238920))) 31 require.True(cfg.IsDaytona(uint64(3238921))) 32 require.False(cfg.IsEaster(uint64(4478760))) 33 require.True(cfg.IsEaster(uint64(4478761))) 34 require.False(cfg.IsFairbank(uint64(5165640))) 35 require.True(cfg.IsFairbank(uint64(5165641))) 36 require.False(cfg.IsFbkMigration(uint64(5157000))) 37 require.True(cfg.IsFbkMigration(uint64(5157001))) 38 require.False(cfg.IsGreenland(uint64(6544440))) 39 require.True(cfg.IsGreenland(uint64(6544441))) 40 require.False(cfg.IsHawaii(uint64(11267640))) 41 require.True(cfg.IsHawaii(uint64(11267641))) 42 require.False(cfg.IsIceland(uint64(12289320))) 43 require.True(cfg.IsIceland(uint64(12289321))) 44 require.False(cfg.IsJutland(uint64(13685400))) 45 require.True(cfg.IsJutland(uint64(13685401))) 46 require.False(cfg.IsKamchatka(uint64(13816440))) 47 require.True(cfg.IsKamchatka(uint64(13816441))) 48 require.False(cfg.IsLordHowe(uint64(13979160))) 49 require.True(cfg.IsLordHowe(uint64(13979161))) 50 require.False(cfg.IsMidway(uint64(16509240))) 51 require.True(cfg.IsMidway(uint64(16509241))) 52 require.False(cfg.IsNewfoundland(uint64(17662680))) 53 require.True(cfg.IsNewfoundland(uint64(17662681))) 54 require.False(cfg.IsOkhotsk(uint64(21542760))) 55 require.True(cfg.IsOkhotsk(uint64(21542761))) 56 require.False(cfg.IsPalau(uint64(22991400))) 57 require.True(cfg.IsPalau(uint64(22991401))) 58 require.False(cfg.IsQuebec(uint64(24838200))) 59 require.True(cfg.IsQuebec(uint64(24838201))) 60 require.False(cfg.IsRedsea(uint64(26704440))) 61 require.True(cfg.IsRedsea(uint64(26704441))) 62 require.False(cfg.IsSumatra(uint64(28516680))) 63 require.True(cfg.IsSumatra(uint64(28516681))) 64 require.False(cfg.IsTsunami(uint64(29275560))) 65 require.True(cfg.IsTsunami(uint64(29275561))) 66 67 require.Equal(cfg.PacificBlockHeight, uint64(432001)) 68 require.Equal(cfg.AleutianBlockHeight, uint64(864001)) 69 require.Equal(cfg.BeringBlockHeight, uint64(1512001)) 70 require.Equal(cfg.CookBlockHeight, uint64(1641601)) 71 require.Equal(cfg.DardanellesBlockHeight, uint64(1816201)) 72 require.Equal(cfg.DaytonaBlockHeight, uint64(3238921)) 73 require.Equal(cfg.EasterBlockHeight, uint64(4478761)) 74 require.Equal(cfg.FairbankBlockHeight, uint64(5165641)) 75 require.Equal(cfg.FbkMigrationBlockHeight, uint64(5157001)) 76 require.Equal(cfg.GreenlandBlockHeight, uint64(6544441)) 77 require.Equal(cfg.HawaiiBlockHeight, uint64(11267641)) 78 require.Equal(cfg.IcelandBlockHeight, uint64(12289321)) 79 require.Equal(cfg.JutlandBlockHeight, uint64(13685401)) 80 require.Equal(cfg.KamchatkaBlockHeight, uint64(13816441)) 81 require.Equal(cfg.LordHoweBlockHeight, uint64(13979161)) 82 require.Equal(cfg.MidwayBlockHeight, uint64(16509241)) 83 require.Equal(cfg.NewfoundlandBlockHeight, uint64(17662681)) 84 require.Equal(cfg.OkhotskBlockHeight, uint64(21542761)) 85 require.Equal(cfg.PalauBlockHeight, uint64(22991401)) 86 require.Equal(cfg.QuebecBlockHeight, uint64(24838201)) 87 require.Equal(cfg.RedseaBlockHeight, uint64(26704441)) 88 require.Equal(cfg.SumatraBlockHeight, uint64(28516681)) 89 require.Equal(cfg.TsunamiBlockHeight, uint64(29275561)) 90 }