Author: nick
Date: Fri Aug 23 18:52:18 2013
New Revision: 1516978
URL: http://svn.apache.org/r1516978
Log:
Add some explicit tests for column letter to/from number conversion
Modified:
poi/trunk/src/testcases/org/apache/poi/hssf/util/TestCellReference.java
Modified:
poi/trunk/src/testcases/org/apache/poi/hssf/util/TestCellReference.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/util/TestCellReference.java?rev=1516978&r1=1516977&r2=1516978&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/util/TestCellReference.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/util/TestCellReference.java Fri
Aug 23 18:52:18 2013
@@ -26,6 +26,25 @@ import org.apache.poi.ss.SpreadsheetVers
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");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]