@@ -149,31 +149,63 @@ func TestDecodeVar(t *testing.T) {
149149 123 ,
150150 "" ,
151151 },
152+ // {
153+ // []byte{0xc3, 02, 0x0b},
154+ // true,
155+ // 90200,
156+ // "",
157+ // },
152158 {
153- []byte {0xc3 , 02 , 0x0b },
159+ // From the example on https://dev.mysql.com/doc/dev/mysql-server/latest/PageLibsMysqlSerialization.html
160+ // But converted to LE
161+ []byte {0b11111011 , 0b11111111 , 0b00000111 },
154162 true ,
155- 90200 ,
163+ 65535 ,
164+ "" ,
165+ },
166+ {
167+ // From the example on https://dev.mysql.com/doc/dev/mysql-server/latest/PageLibsMysqlSerialization.html
168+ // But converted to LE
169+ []byte {0b11111011 , 0b11111111 , 0b00001111 },
170+ false ,
171+ 65535 ,
156172 "" ,
157173 },
158174 // {
159- // []byte{0x5d, 0x03},
160- // true,
161- // 215,
175+ // // From the example on https://dev.mysql.com/doc/dev/mysql-server/latest/PageLibsMysqlSerialization.html
176+ // // But converted to LE
177+ // []byte{0b11101011, 0b11111111, 0b00001111},
178+ // false,
179+ // -65535,
162180 // "",
163181 // },
164182 // {
165- // []byte{0x7f, 0x39, 0x7d, 0x89, 0x70, 0xdb, 0x2d, 0x06},
166- // true,
167- // 1739270369410361,
183+ // // From the example on https://dev.mysql.com/doc/dev/mysql-server/latest/PageLibsMysqlSerialization.html
184+ // // But converted to LE
185+ // []byte{0b11111011, 0b11111111, 0b00001111},
186+ // false,
187+ // -65536,
168188 // "",
169189 // },
190+ {
191+ []byte {0x5d , 0x03 },
192+ true ,
193+ 215 ,
194+ "" ,
195+ },
196+ {
197+ []byte {0x7f , 0x39 , 0x7d , 0x89 , 0x70 , 0xdb , 0x2d , 0x06 },
198+ true ,
199+ 1739270369410361 ,
200+ "" ,
201+ },
170202 }
171203
172204 for _ , tc := range testcases {
173205 r , err := decodeVar (bytes .NewReader (tc .input ), tc .unsigned )
174206 if tc .err == "" {
175207 require .NoError (t , err )
176- require .Equal (t , tc .result , r )
208+ require .Equal (t , tc .result , r , tc . result )
177209 } else {
178210 require .ErrorContains (t , err , tc .err )
179211 }
0 commit comments