github.com/Finschia/finschia-sdk@v0.48.1/codec/unknownproto/unit_helpers_test.go (about) 1 package unknownproto 2 3 import ( 4 "fmt" 5 "testing" 6 7 "google.golang.org/protobuf/encoding/protowire" 8 ) 9 10 func TestWireTypeToString(t *testing.T) { 11 tests := []struct { 12 typ protowire.Type 13 want string 14 }{ 15 {typ: 0, want: "varint"}, 16 {typ: 1, want: "fixed64"}, 17 {typ: 2, want: "bytes"}, 18 {typ: 3, want: "start_group"}, 19 {typ: 4, want: "end_group"}, 20 {typ: 5, want: "fixed32"}, 21 {typ: 95, want: "unknown type: 95"}, 22 } 23 24 for _, tt := range tests { 25 tt := tt 26 t.Run(fmt.Sprintf("wireType=%d", tt.typ), func(t *testing.T) { 27 if g, w := wireTypeToString(tt.typ), tt.want; g != w { 28 t.Fatalf("Mismatch:\nGot: %q\nWant: %q\n", g, w) 29 } 30 }) 31 } 32 }