forked from json-iterator/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBase64Float.java
More file actions
32 lines (25 loc) · 1007 Bytes
/
TestBase64Float.java
File metadata and controls
32 lines (25 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.jsoniter.extra;
import com.jsoniter.JsonIterator;
import com.jsoniter.output.JsonStream;
import junit.framework.TestCase;
public class TestBase64Float extends TestCase {
static {
Base64FloatSupport.enableEncodersAndDecoders();
}
public void test_Double() {
String json = JsonStream.serialize(0.123456789d);
assertEquals(0.123456789d, JsonIterator.deserialize(json, Double.class));
}
public void test_double() {
String json = JsonStream.serialize(new double[]{0.123456789d});
assertEquals(0.123456789d, JsonIterator.deserialize(json, double[].class)[0]);
}
public void test_Float() {
String json = JsonStream.serialize(0.12345678f);
assertEquals(0.12345678f, JsonIterator.deserialize(json, Float.class));
}
public void test_float() {
String json = JsonStream.serialize(new float[]{0.12345678f});
assertEquals(0.12345678f, JsonIterator.deserialize(json, float[].class)[0]);
}
}