ParserHelper { public float nextFloat() { skipWhitespace(); float f = parseFloat(); skipNumberSeparator(); return f; } ParserHelper(CharSequence s, int pos); void skipWhitespace(); void skipNumberSeparator(); void advance(); float parseFloat(); static float buildFloat(int mant, int exp); float nextFloat(); public int pos; }
@Test public void testNextFloat() { ParserHelper parserHelper = new ParserHelper("+0.1 +05.1 -10.2E-13 1.234e2 3.8E8 .7e3 -1.4e-45 3.4e+38f", 0); assertThat(parserHelper.parseFloat(), is(0.1f)); assertThat(parserHelper.nextFloat(), is(5.1f)); assertThat(parserHelper.nextFloat(), is(-1.02E-12F)); assertThat(parserHelper.nextFloat(), is(1.234e2F)); assertThat(parserHelper.nextFloat(), is(3.8E8F)); assertThat(parserHelper.nextFloat(), is(700.0F)); assertThat(parserHelper.nextFloat(), is(-1.4E-45F)); assertThat(parserHelper.nextFloat(), is(3.4e+38f)); }