1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
public void testFormatWithAtLeastOneMeaningfulNumber() throws Exception
{
String output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, 10);
assertEquals("10",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, 0);
assertEquals("0",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, 10.1);
assertEquals("10.1",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, 0.1);
assertEquals("0.1",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, 0.0001);
assertEquals("0.0001",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, -0.1);
assertEquals("-0.1",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, -0.0001);
assertEquals("-0.0001",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, -10.0001);
assertEquals("-10",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, 10.008);
assertEquals("10.01",output);
output = StringHelper.formatWithAtLeastOneMeaningfulNumber(Locale.ENGLISH, 2, 10.001);
assertEquals("10",output);
} |
Partager