Add some explicit tests for column letter to/from number conversion

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1516978 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2013-08-23 18:52:18 +00:00
parent 8b0334c701
commit 689aa10390

View File

@ -26,6 +26,25 @@ import org.apache.poi.ss.SpreadsheetVersion;
public final class TestCellReference extends TestCase {
public void testColNumConversion() {
assertEquals(0, CellReference.convertColStringToIndex("A"));
assertEquals(1, CellReference.convertColStringToIndex("B"));
assertEquals(25, CellReference.convertColStringToIndex("Z"));
assertEquals(26, CellReference.convertColStringToIndex("AA"));
assertEquals(27, CellReference.convertColStringToIndex("AB"));
assertEquals(51, CellReference.convertColStringToIndex("AZ"));
assertEquals(701, CellReference.convertColStringToIndex("ZZ"));
assertEquals(702, CellReference.convertColStringToIndex("AAA"));
assertEquals(18277, CellReference.convertColStringToIndex("ZZZ"));
assertEquals("A", CellReference.convertNumToColString(0));
assertEquals("B", CellReference.convertNumToColString(1));
assertEquals("Z", CellReference.convertNumToColString(25));
assertEquals("AA", CellReference.convertNumToColString(26));
assertEquals("ZZ", CellReference.convertNumToColString(701));
assertEquals("AAA", CellReference.convertNumToColString(702));
assertEquals("ZZZ", CellReference.convertNumToColString(18277));
}
public void testAbsRef1(){
CellReference cf = new CellReference("$B$5");