|
9 | 9 | import java.io.IOException; |
10 | 10 | import java.math.BigDecimal; |
11 | 11 | import java.math.BigInteger; |
| 12 | +import java.util.Arrays; |
12 | 13 | import java.util.ResourceBundle; |
13 | 14 |
|
14 | 15 | import static org.junit.Assert.*; |
@@ -502,15 +503,23 @@ public void testBasicDecimal128Vector_toJsonString() throws IOException { |
502 | 503 | BasicDecimal128Vector re1 = new BasicDecimal128Vector(tmp_string_v,4); |
503 | 504 | String re = JSONObject.toJSONString(re1); |
504 | 505 | System.out.println(re); |
505 | | - assertEquals("{\"chart\":false,\"chunk\":false,\"dataCategory\":\"DENARY\",\"dataForm\":\"DF_VECTOR\",\"dataType\":\"DT_DECIMAL128\",\"dictionary\":false,\"elementClass\":\"com.xxdb.data.BasicDecimal128\",\"matrix\":false,\"pair\":false,\"scalar\":false,\"scale\":4,\"string\":\"[0.0000,-123.0043,132.2042,100.0000]\",\"table\":false,\"unitLength\":16,\"vector\":true}", re); |
| 506 | + assertEquals("{\"chart\":false,\"chunk\":false,\"dataCategory\":\"DENARY\",\"dataForm\":\"DF_VECTOR\",\"dataType\":\"DT_DECIMAL128\",\"dictionary\":false,\"elementClass\":\"com.xxdb.data.BasicDecimal128\",\"matrix\":false,\"pair\":false,\"scalar\":false,\"scale\":4,\"string\":\"[0.0000,-123.0043,132.2042,100.0000]\",\"table\":false,\"unitLength\":16,\"unscaledValues\":[0,-1230043,1322042,1000000],\"vector\":true}", re); |
506 | 507 | } |
507 | 508 | @Test |
508 | 509 | public void testBasicDecimal128Vector_toJsonString_null() throws IOException { |
509 | 510 | BasicDecimal128Vector re1 = new BasicDecimal128Vector(2,2); |
510 | 511 | String re = JSONObject.toJSONString(re1); |
511 | 512 | System.out.println(re); |
512 | | - assertEquals("{\"chart\":false,\"chunk\":false,\"dataCategory\":\"DENARY\",\"dataForm\":\"DF_VECTOR\",\"dataType\":\"DT_DECIMAL128\",\"dictionary\":false,\"elementClass\":\"com.xxdb.data.BasicDecimal128\",\"matrix\":false,\"pair\":false,\"scalar\":false,\"scale\":2,\"string\":\"[0.00,0.00]\",\"table\":false,\"unitLength\":16,\"vector\":true}", re); |
513 | | - } |
| 513 | + assertEquals("{\"chart\":false,\"chunk\":false,\"dataCategory\":\"DENARY\",\"dataForm\":\"DF_VECTOR\",\"dataType\":\"DT_DECIMAL128\",\"dictionary\":false,\"elementClass\":\"com.xxdb.data.BasicDecimal128\",\"matrix\":false,\"pair\":false,\"scalar\":false,\"scale\":2,\"string\":\"[0.00,0.00]\",\"table\":false,\"unitLength\":16,\"unscaledValues\":[0,0],\"vector\":true}", re); |
| 514 | + } |
| 515 | +// @Test |
| 516 | +// public void testBasicDecimal128Vector_getValue() throws IOException { |
| 517 | +// String[] tmp_string_v = {"0.0","-123.00432","132.204234","100.0"}; |
| 518 | +// BasicDecimal128Vector re1 = new BasicDecimal128Vector(tmp_string_v,4); |
| 519 | +// BigInteger[] re = re1.getValues(); |
| 520 | +// System.out.println(Arrays.toString(re)); |
| 521 | +// assertEquals("[0, -1230043, 1322042, 1000000]",Arrays.toString(re)); |
| 522 | +// } |
514 | 523 | @Test |
515 | 524 | public void test_BasicDecimal128Vector_deserialize() throws Exception { |
516 | 525 | String[] tmp_string_v = {"0.0","-123.00432","132.204234","100.0"}; |
|
0 commit comments