-
Notifications
You must be signed in to change notification settings - Fork 502
/
token_test.go
42 lines (36 loc) · 926 Bytes
/
token_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package mssql
import (
"encoding/hex"
"regexp"
"testing"
)
func TestParseFeatureExtAck(t *testing.T) {
spacesRE := regexp.MustCompile(`\s+`)
tests := []string{
" FF",
" 01 03 00 00 00 AB CD EF FF",
" 02 00 00 00 00 FF\n",
" 02 20 00 00 00 00 01 02 03 04 05 06 07 08 09 0A\n" +
"0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A\n" +
"1B 1C 1D 1E 1F FF\n",
" 02 40 00 00 00 00 01 02 03 04 05 06 07 08 09 0A\n" +
"0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A\n" +
"1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A\n" +
"2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A\n" +
"3B 3C 3D 3E 3F FF\n",
}
for _, tst := range tests {
b, err := hex.DecodeString(spacesRE.ReplaceAllString(tst, ""))
if err != nil {
t.Log(err)
t.FailNow()
}
r := &tdsBuffer{
packetSize: len(b),
rbuf: b,
rpos: 0,
rsize: len(b),
}
parseFeatureExtAck(r)
}
}