@@ -13,7 +13,7 @@ import (
1313)
1414
1515func TestBool (t * testing.T ) {
16- bools := map [string ]interface {} {
16+ bools := map [string ]any {
1717 "0007" : false ,
1818 "0107" : true ,
1919 }
@@ -22,7 +22,7 @@ func TestBool(t *testing.T) {
2222}
2323
2424func TestDouble (t * testing.T ) {
25- doubles := map [string ]interface {} {
25+ doubles := map [string ]any {
2626 "680000000000000000" : 0.0 ,
2727 "683FE0000000000000" : 0.5 ,
2828 "68400921FB54442EEA" : 3.14159265359 ,
@@ -36,7 +36,7 @@ func TestDouble(t *testing.T) {
3636}
3737
3838func TestFloat (t * testing.T ) {
39- floats := map [string ]interface {} {
39+ floats := map [string ]any {
4040 "040800000000" : float32 (0.0 ),
4141 "04083F800000" : float32 (1.0 ),
4242 "04083F8CCCCD" : float32 (1.1 ),
@@ -51,7 +51,7 @@ func TestFloat(t *testing.T) {
5151}
5252
5353func TestInt32 (t * testing.T ) {
54- int32s := map [string ]interface {} {
54+ int32s := map [string ]any {
5555 "0001" : 0 ,
5656 "0401ffffffff" : - 1 ,
5757 "0101ff" : 255 ,
@@ -69,33 +69,33 @@ func TestInt32(t *testing.T) {
6969}
7070
7171func TestMap (t * testing.T ) {
72- maps := map [string ]interface {} {
73- "e0" : map [string ]interface {} {},
74- "e142656e43466f6f" : map [string ]interface {} {"en" : "Foo" },
75- "e242656e43466f6f427a6843e4baba" : map [string ]interface {} {"en" : "Foo" , "zh" : "人" },
76- "e1446e616d65e242656e43466f6f427a6843e4baba" : map [string ]interface {} {
77- "name" : map [string ]interface {} {"en" : "Foo" , "zh" : "人" },
72+ maps := map [string ]any {
73+ "e0" : map [string ]any {},
74+ "e142656e43466f6f" : map [string ]any {"en" : "Foo" },
75+ "e242656e43466f6f427a6843e4baba" : map [string ]any {"en" : "Foo" , "zh" : "人" },
76+ "e1446e616d65e242656e43466f6f427a6843e4baba" : map [string ]any {
77+ "name" : map [string ]any {"en" : "Foo" , "zh" : "人" },
7878 },
79- "e1496c616e677561676573020442656e427a68" : map [string ]interface {} {
80- "languages" : []interface {} {"en" , "zh" },
79+ "e1496c616e677561676573020442656e427a68" : map [string ]any {
80+ "languages" : []any {"en" , "zh" },
8181 },
8282 }
8383 validateDecoding (t , maps )
8484}
8585
8686func TestSlice (t * testing.T ) {
87- slice := map [string ]interface {} {
88- "0004" : []interface {} {},
89- "010443466f6f" : []interface {} {"Foo" },
90- "020443466f6f43e4baba" : []interface {} {"Foo" , "人" },
87+ slice := map [string ]any {
88+ "0004" : []any {},
89+ "010443466f6f" : []any {"Foo" },
90+ "020443466f6f43e4baba" : []any {"Foo" , "人" },
9191 }
9292 validateDecoding (t , slice )
9393}
9494
9595var testStrings = makeTestStrings ()
9696
97- func makeTestStrings () map [string ]interface {} {
98- str := map [string ]interface {} {
97+ func makeTestStrings () map [string ]any {
98+ str := map [string ]any {
9999 "40" : "" ,
100100 "4131" : "1" ,
101101 "43E4BABA" : "人" ,
@@ -118,7 +118,7 @@ func TestString(t *testing.T) {
118118}
119119
120120func TestByte (t * testing.T ) {
121- b := make (map [string ]interface {} )
121+ b := make (map [string ]any )
122122 for key , val := range testStrings {
123123 oldCtrl , err := hex .DecodeString (key [0 :2 ])
124124 require .NoError (t , err )
@@ -131,7 +131,7 @@ func TestByte(t *testing.T) {
131131}
132132
133133func TestUint16 (t * testing.T ) {
134- uint16s := map [string ]interface {} {
134+ uint16s := map [string ]any {
135135 "a0" : uint64 (0 ),
136136 "a1ff" : uint64 (255 ),
137137 "a201f4" : uint64 (500 ),
@@ -142,7 +142,7 @@ func TestUint16(t *testing.T) {
142142}
143143
144144func TestUint32 (t * testing.T ) {
145- uint32s := map [string ]interface {} {
145+ uint32s := map [string ]any {
146146 "c0" : uint64 (0 ),
147147 "c1ff" : uint64 (255 ),
148148 "c201f4" : uint64 (500 ),
@@ -158,7 +158,7 @@ func TestUint64(t *testing.T) {
158158 ctrlByte := "02"
159159 bits := uint64 (64 )
160160
161- uints := map [string ]interface {} {
161+ uints := map [string ]any {
162162 "00" + ctrlByte : uint64 (0 ),
163163 "02" + ctrlByte + "01f4" : uint64 (500 ),
164164 "02" + ctrlByte + "2a78" : uint64 (10872 ),
@@ -178,7 +178,7 @@ func TestUint128(t *testing.T) {
178178 ctrlByte := "03"
179179 bits := uint (128 )
180180
181- uints := map [string ]interface {} {
181+ uints := map [string ]any {
182182 "00" + ctrlByte : big .NewInt (0 ),
183183 "02" + ctrlByte + "01f4" : big .NewInt (500 ),
184184 "02" + ctrlByte + "2a78" : big .NewInt (10872 ),
@@ -204,13 +204,13 @@ func powBigInt(bi *big.Int, pow uint) *big.Int {
204204 return newInt
205205}
206206
207- func validateDecoding (t * testing.T , tests map [string ]interface {} ) {
207+ func validateDecoding (t * testing.T , tests map [string ]any ) {
208208 for inputStr , expected := range tests {
209209 inputBytes , err := hex .DecodeString (inputStr )
210210 require .NoError (t , err )
211211 d := decoder {inputBytes }
212212
213- var result interface {}
213+ var result any
214214 _ , err = d .decode (0 , reflect .ValueOf (& result ), 0 )
215215 assert .NoError (t , err )
216216
0 commit comments