github.com/aergoio/aergo@v1.3.1/p2p/p2pcommon/consts_test.go (about) 1 /* 2 * @file 3 * @copyright defined in aergo/LICENSE.txt 4 */ 5 6 package p2pcommon 7 8 import "testing" 9 10 func TestP2PVersion_String(t *testing.T) { 11 tests := []struct { 12 name string 13 v P2PVersion 14 want string 15 }{ 16 {"T030", P2PVersion030, "0.3.0"}, 17 {"T031", P2PVersion031, "0.3.1"}, 18 {"T032", P2PVersion032, "0.3.2"}, 19 {"T100", P2PVersion(0x010000), "1.0.0"}, 20 {"T101", P2PVersion(0x010001), "1.0.1"}, 21 {"T121", P2PVersion(0x010201), "1.2.1"}, 22 } 23 for _, tt := range tests { 24 t.Run(tt.name, func(t *testing.T) { 25 if got := tt.v.String(); got != tt.want { 26 t.Errorf("P2PVersion.String() = %v, want %v", got, tt.want) 27 } 28 }) 29 } 30 }