@Test
public void testTextBytesToLongBytes() {
long[] factor = new long[] {1, 5, 10};
String[] type = new String[]{"", "b", "k", "m", "g"};
long[] size = new long[]{1, 1, 1024, 1024 * 1024, 1024 * 1024 * 1024};
for (int i = 0; i < 3; i++) {
for (int j = 0; j < type.length; j++) {
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + type[j]));
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + " " + type[j]));
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + type[j].toUpperCase()));
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + " " + type[j].toUpperCase()));
if (j >= 2) {
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + type[j] + "b"));
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + " " + type[j] + "b"));
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + type[j].toUpperCase() + "B"));
assertEquals(factor[i] * size[j], ByteUtil.convertTextBytes(factor[i] + " " + type[j].toUpperCase() + "B"));
}
}
}
}