Ejemplo n.º 1
0
 public static Alpha parse(JSONParser json) {
   Alpha a = new Alpha();
   json.enterMap();
   while (json.hasNext()) {
     String key = json.nextKey();
     double d = json.nextDouble();
     a.map.put(key, d);
   }
   return a;
 }
Ejemplo n.º 2
0
  public void testNumbers() {
    String script[] = {"0", "1", "-123.52e20", "-123.52e-20", "0.5"};
    for (int i = 0; i < script.length; i++) {
      String s = script[i];
      json(s);

      double d = json.nextDouble();
      assertFalse(json.hasNext());
      assertEquals(Double.parseDouble(s), d, 1e-10);
    }
  }