forked from racingmars/go3270
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbufaddr_test.go
More file actions
33 lines (27 loc) · 795 Bytes
/
bufaddr_test.go
File metadata and controls
33 lines (27 loc) · 795 Bytes
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
// This file is part of https://github.com/racingmars/go3270/
// Copyright 2020 by Matthew R. Wilson, licensed under the MIT license. See
// LICENSE in the project root for license information.
package go3270
import (
"testing"
)
func TestEncode(t *testing.T) {
encoded := getpos(0, 0)
if encoded[0] != 0x40 || encoded[1] != 0x40 {
t.Error("Position (0, 0) not correctly encoded")
}
encoded = getpos(11, 39)
if encoded[0] != 0x4e || encoded[1] != 0xd7 {
t.Error("Position (11, 39) not correctly encoded")
}
}
func TestDecode(t *testing.T) {
decoded := decodeBufAddr([2]byte{0x40, 0x40})
if decoded != 0 {
t.Error("Buffer address incorrectly decoded")
}
decoded = decodeBufAddr([2]byte{0x4e, 0xd7})
if decoded != 919 {
t.Error("Buffer address incorrectly decoded")
}
}