summaryrefslogtreecommitdiff
path: root/lib_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-08-06 22:44:43 +0800
committerxuri <xuri.me@gmail.com>2021-08-06 22:44:43 +0800
commitcf9fbafdd805874267a0f5d27fd1c720b148ec91 (patch)
tree4eda7bd0d974160b5f396c05cd914ba8baf504da /lib_test.go
parent933159f9391f9be1b41b51e85885722124f8a7aa (diff)
This closes #979, fix the data validation deletion issue and tidy the internal function in the source code
Diffstat (limited to 'lib_test.go')
-rw-r--r--lib_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib_test.go b/lib_test.go
index 315688f..2e0e506 100644
--- a/lib_test.go
+++ b/lib_test.go
@@ -211,6 +211,27 @@ func TestCoordinatesToCellName_Error(t *testing.T) {
}
}
+func TestCoordinatesToAreaRef(t *testing.T) {
+ f := NewFile()
+ _, err := f.coordinatesToAreaRef([]int{})
+ assert.EqualError(t, err, ErrCoordinates.Error())
+ _, err = f.coordinatesToAreaRef([]int{1, -1, 1, 1})
+ assert.EqualError(t, err, "invalid cell coordinates [1, -1]")
+ _, err = f.coordinatesToAreaRef([]int{1, 1, 1, -1})
+ assert.EqualError(t, err, "invalid cell coordinates [1, -1]")
+ ref, err := f.coordinatesToAreaRef([]int{1, 1, 1, 1})
+ assert.NoError(t, err)
+ assert.EqualValues(t, ref, "A1:A1")
+}
+
+func TestSortCoordinates(t *testing.T) {
+ assert.EqualError(t, sortCoordinates(make([]int, 3)), ErrCoordinates.Error())
+}
+
+func TestInStrSlice(t *testing.T) {
+ assert.EqualValues(t, -1, inStrSlice([]string{}, ""))
+}
+
func TestBytesReplace(t *testing.T) {
s := []byte{0x01}
assert.EqualValues(t, s, bytesReplace(s, []byte{}, []byte{}, 0))