-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenc_test.go
executable file
·54 lines (44 loc) · 1.47 KB
/
enc_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
43
44
45
46
47
48
49
50
51
52
53
54
package uu
import (
"gopkg.in/check.v1"
"testing"
)
// Test hooks up gocheck into the "go test" runner.
func Test(t *testing.T) { check.TestingT(t) }
//TstEnc is the test suit
type TstEnc struct{}
var _ = check.Suite(&TstEnc{})
//TestFindLevel tests hello world
func (s *TstEnc) TestConv3Bytes1(c *check.C) {
lRes := ToUUPack([3]byte{0x14, 0x0F, 0xA8})
c.Check(lRes, check.Equals, [4]byte{0x25, 0x20, 0x5E, 0x48})
}
//TestFindLevel tests hello world
func (s *TstEnc) TestConv3Bytes2(c *check.C) {
lRes := ToUUPack([3]byte{0x17, 0x00, 0x00})
c.Check(lRes, check.Equals, [4]byte{0x25, 0x50, 0x20, 0x20})
}
//TestFindLevel tests hello world
func (s *TstEnc) TestEncodeLineInvalidLen(c *check.C) {
lIn := make([]byte, MaxBytesPerLine+1)
lRes := EncodeLine(lIn)
c.Check(lRes, check.IsNil)
}
//TestFindLevel tests hello world
func (s *TstEnc) TestEncodeLine3Bytes(c *check.C) {
lIn := []byte{0x14, 0x0F, 0xA8}
lRes := string(EncodeLine(lIn))
c.Check(lRes, check.Equals, "#% ^H\r\n")
}
//TestFindLevel tests hello world
func (s *TstEnc) TestEncodeLine4Bytes(c *check.C) {
lIn := []byte{0x14, 0x0F, 0xA8, 0x17}
lRes := string(EncodeLine(lIn))
c.Check(lRes, check.Equals, "$% ^H%P \r\n")
}
//TestFindLevel tests hello world
func (s *TstEnc) TestEncodeLine1(c *check.C) {
lIn := []byte("http://www.wikipedia.org\r\n")
lRes := string(EncodeLine(lIn[:len(lIn)]))
c.Check(lRes, check.Equals, "::'1T<#HO+W=W=RYW:6MI<&5D:6$N;W)G#0H \r\n")
}