You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ke...@apache.org on 2006/12/12 14:59:13 UTC
svn commit: r486147 -
/ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
Author: kevj
Date: Tue Dec 12 05:59:12 2006
New Revision: 486147
URL: http://svn.apache.org/viewvc?view=rev&rev=486147
Log:
- tests for parseHumanSizes
Modified:
ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java?view=diff&rev=486147&r1=486146&r2=486147
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java Tue Dec 12 05:59:12 2006
@@ -103,4 +103,18 @@
for (int i = 0; i < size; i++) { buf.append(ch); };
return buf;
}
+
+ public void testParseHumanSizes() throws Exception {
+ final long KILOBYTE = 1024;
+ final long MEGABYTE = KILOBYTE * 1024;
+ final long GIGABYTE = MEGABYTE * 1024;
+ final long TERABYTE = GIGABYTE * 1024;
+ final long PETABYTE = TERABYTE * 1024;
+ assertEquals(StringUtils.parseHumanSizes("1K"), KILOBYTE);
+ assertEquals(StringUtils.parseHumanSizes("1M"), MEGABYTE);
+ assertEquals(StringUtils.parseHumanSizes("1G"), GIGABYTE);
+ assertEquals(StringUtils.parseHumanSizes("1T"), TERABYTE);
+ assertEquals(StringUtils.parseHumanSizes("1P"), PETABYTE);
+ assertEquals(StringUtils.parseHumanSizes("1"), 1L);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org