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:
parent
22d5fd3aed
commit
a9bce1d6b2
1 changed files with 15 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
package org.json.junit;
|
package org.json.junit;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.json.*;
|
import org.json.*;
|
||||||
|
@ -158,4 +160,17 @@ public class JSONObjectTest {
|
||||||
JSONObject expectedJsonObject = new JSONObject(expectedStr);
|
JSONObject expectedJsonObject = new JSONObject(expectedStr);
|
||||||
Util.compareActualVsExpectedJsonObjects(jsonObject, expectedJsonObject);
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue