diff options
author | Olivier Mengué <dolmen@cpan.org> | 2019-02-02 04:05:01 +0100 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2019-02-02 11:05:01 +0800 |
commit | e780e41e0222517caa9c69030b5955ab2b458a49 (patch) | |
tree | 4fd0a659471568e314e13dc12ea9b4fd26968c32 /excelize_test.go | |
parent | b7b925c03fa611b0157214357cc7f7b949b32992 (diff) |
Faster TitleToNumber (#343)
* TestTitleToNumber: more test cases
* TitleToNumber: drop use of math.Pow()
Compute using pure integers
* TitleToNumber: simplify
Remove unecessary casts to int
Diffstat (limited to 'excelize_test.go')
-rw-r--r-- | excelize_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/excelize_test.go b/excelize_test.go index 6a106ec..ebbfcf7 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -1546,8 +1546,12 @@ func TestConditionalFormatError(t *testing.T) { } func TestTitleToNumber(t *testing.T) { + assert.Equal(t, 0, TitleToNumber("A")) + assert.Equal(t, 25, TitleToNumber("Z")) + assert.Equal(t, 26, TitleToNumber("AA")) assert.Equal(t, 36, TitleToNumber("AK")) assert.Equal(t, 36, TitleToNumber("ak")) + assert.Equal(t, 51, TitleToNumber("AZ")) } func TestSharedStrings(t *testing.T) { |