Ai
3 Star 7 Fork 0

Gitee 极速下载/excelize

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/Luxurioust/excelize
克隆/下载
lib_test.go 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
xuri 提交于 2018-01-31 11:12 +08:00 . - gofmted with -s;
package excelize
import "testing"
func TestAxisLowerOrEqualThan(t *testing.T) {
trueExpectedInputList := [][2]string{
{"A", "B"},
{"A", "AA"},
{"B", "AA"},
{"BC", "ABCD"},
{"1", "2"},
{"2", "11"},
}
for _, trueExpectedInput := range trueExpectedInputList {
isLowerOrEqual := axisLowerOrEqualThan(trueExpectedInput[0], trueExpectedInput[1])
if !isLowerOrEqual {
t.Fatalf("Expected %v <= %v = true, got false\n", trueExpectedInput[0], trueExpectedInput[1])
}
}
falseExpectedInputList := [][2]string{
{"B", "A"},
{"AA", "A"},
{"AA", "B"},
{"ABCD", "AB"},
{"2", "1"},
{"11", "2"},
}
for _, falseExpectedInput := range falseExpectedInputList {
isLowerOrEqual := axisLowerOrEqualThan(falseExpectedInput[0], falseExpectedInput[1])
if isLowerOrEqual {
t.Fatalf("Expected %v <= %v = false, got true\n", falseExpectedInput[0], falseExpectedInput[1])
}
}
}
func TestGetCellColRow(t *testing.T) {
cellExpectedColRowList := map[string][2]string{
"C220": {"C", "220"},
"aaef42": {"aaef", "42"},
"bonjour": {"bonjour", ""},
"59": {"", "59"},
"": {"", ""},
}
for cell, expectedColRow := range cellExpectedColRowList {
col, row := getCellColRow(cell)
if col != expectedColRow[0] {
t.Fatalf("Expected cell %v to return col %v, got col %v\n", cell, expectedColRow[0], col)
}
if row != expectedColRow[1] {
t.Fatalf("Expected cell %v to return row %v, got row %v\n", cell, expectedColRow[1], row)
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/excelize.git
git@gitee.com:mirrors/excelize.git
mirrors
excelize
excelize
v1.4.0

搜索帮助