-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper_test.go
67 lines (45 loc) · 1.34 KB
/
helper_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
55
56
57
58
59
60
61
62
63
64
65
66
67
package cellwalker
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCreateSheetRange(t *testing.T) {
result := Sheet().String()
assert.Equal(t, "A1:XFD1048576", result)
}
func TestConvertColumnIndexToSingleColumnName(t *testing.T) {
result := ColumnIndexToName(1)
assert.Equal(t, "A", result)
}
func TestConvertLastSingleColumnIndexToSingleColumnName(t *testing.T) {
result := ColumnIndexToName(26)
assert.Equal(t, "Z", result)
}
func TestConvertColumnIndexTo2CharactersColumnName(t *testing.T) {
result := ColumnIndexToName(27)
assert.Equal(t, "AA", result)
}
func TestConvertLastColumnIndexTo2CharactersColumnName(t *testing.T) {
result := ColumnIndexToName(52)
assert.Equal(t, "AZ", result)
}
func TestConvertComplexLastColumnIndexTo2CharactersColumnName(t *testing.T) {
result := ColumnIndexToName(702)
assert.Equal(t, "ZZ", result)
}
func TestColumnIndexTo3CharactersColumnName(t *testing.T) {
result := ColumnIndexToName(703)
assert.Equal(t, "AAA", result)
}
func TestColumnNameToSingleDigitIndex(t *testing.T) {
result := ColumnNameToIndex("A")
assert.Equal(t, 1, result)
}
func TestLast1CharColumnNameToIndex(t *testing.T) {
result := ColumnNameToIndex("Z")
assert.Equal(t, 26, result)
}
func TestFirst2CharsColumnNameToIndex(t *testing.T) {
result := ColumnNameToIndex("AA")
assert.Equal(t, 27, result)
}