1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

in progress

This commit is contained in:
stleary 2015-04-08 22:23:39 -05:00
parent 22d5fd3aed
commit a9bce1d6b2

View file

@ -1,5 +1,7 @@
package org.json.junit;
import static org.junit.Assert.*;
import java.util.*;
import org.json.*;
@ -158,4 +160,17 @@ public class JSONObjectTest {
JSONObject expectedJsonObject = new JSONObject(expectedStr);
Util.compareActualVsExpectedJsonObjects(jsonObject, expectedJsonObject);
}
@Test
public void jsonObjectValuesToString() {
String [] expectedStrs = {"1", "1", "-23.4", "-2.345E68", null };
Double [] doubles = { 1.0, 00001.00000, -23.4, -23.45e67,
new Double(1/0) };
for (int i = 0; i < expectedStrs.length; ++i) {
String actualStr = JSONObject.doubleToString(doubles[i]);
assertTrue("double value expected ["+expectedStrs[i]+
"] found ["+actualStr+ "]",
expectedStrs[i].equals(actualStr));
}
}
}