public void testObjectWithDoubles() throws IOException {
    ByteArrayOutputStream bo = new ByteArrayOutputStream();
    SmileGenerator g = smileGenerator(bo, false);
    g.writeStartObject();
    g.writeNumberField("x", 0.5);
    g.writeNumberField("y", 0.01338);
    g.writeEndObject();
    g.close();

    byte[] data = bo.toByteArray();

    // first let's just skip
    SmileParser p = _smileParser(data);
    assertToken(JsonToken.START_OBJECT, p.nextToken());
    assertToken(JsonToken.FIELD_NAME, p.nextToken());
    assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());
    assertToken(JsonToken.FIELD_NAME, p.nextToken());
    assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());
    assertToken(JsonToken.END_OBJECT, p.nextToken());
    p.close();

    // and then check data too (skip codepath distinct)
    p = _smileParser(data);
    assertToken(JsonToken.START_OBJECT, p.nextToken());
    assertToken(JsonToken.FIELD_NAME, p.nextToken());
    assertEquals("x", p.getText());
    assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());
    assertEquals(0.5, p.getDoubleValue());
    assertToken(JsonToken.FIELD_NAME, p.nextToken());
    assertEquals("y", p.getText());
    assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());
    assertEquals(0.01338, p.getDoubleValue());
    assertToken(JsonToken.END_OBJECT, p.nextToken());
    p.close();
  }
  public void testLongs() throws IOException {
    long l = Long.MAX_VALUE;
    byte[] data = _smileDoc(String.valueOf(l));
    SmileParser p = _smileParser(data);
    assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
    assertEquals(JsonParser.NumberType.LONG, p.getNumberType());
    assertEquals(l, p.getLongValue());
    assertEquals(String.valueOf(l), p.getText());
    p.close();

    l = Long.MIN_VALUE;
    data = _smileDoc(String.valueOf(l));
    p = _smileParser(data);
    assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
    assertEquals(JsonParser.NumberType.LONG, p.getNumberType());
    assertEquals(l, p.getLongValue());
    assertEquals(String.valueOf(l), p.getText());
    p.close();
  }
  public void testIntsMedium() throws IOException {
    byte[] data = _smileDoc("255");
    SmileParser p = _smileParser(data);
    assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
    assertEquals(255, p.getIntValue());
    assertEquals("255", p.getText());
    data = _smileDoc("-999");
    p.close();

    p = _smileParser(data);
    assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
    assertEquals(JsonParser.NumberType.INT, p.getNumberType());
    assertEquals(-999, p.getIntValue());
    assertEquals("-999", p.getText());
    p.close();

    data = _smileDoc("123456789");
    p = _smileParser(data);
    assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken());
    assertEquals(JsonParser.NumberType.INT, p.getNumberType());
    assertEquals(123456789, p.getIntValue());
    p.close();
  }