Skip to content

Commit

Permalink
Ut doc value format test (#6581)
Browse files Browse the repository at this point in the history
* add some new unit test case for DocValueFormat

Signed-off-by: Nan Xiaochen <netcock@sina.cn>
Signed-off-by: brian <flyunrain@163.com>

* add some new unit test case for DocValueFormat

Signed-off-by: Nan Xiaochen <netcock@sina.cn>
Signed-off-by: brian <flyunrain@163.com>

* add some new unit test case for DocValueFormat

Signed-off-by: Nan Xiaochen <netcock@sina.cn>
Signed-off-by: brian <flyunrain@163.com>

* add some new unit test case for DocValueFormat

Signed-off-by: Nan Xiaochen <netcock@sina.cn>
Signed-off-by: brian <flyunrain@163.com>

* add some new unit test case for DocValueFormat

Signed-off-by: Nan Xiaochen <netcock@sina.cn>
Signed-off-by: brian <flyunrain@163.com>

* add some new unit test case for DocValueFormat

Signed-off-by: Nan Xiaochen <netcock@sina.cn>
Signed-off-by: brian <flyunrain@163.com>

---------

Signed-off-by: Nan Xiaochen <netcock@sina.cn>
Signed-off-by: brian <flyunrain@163.com>
Co-authored-by: brian <flyunrain@163.com>
  • Loading branch information
XiaochenNan and flyunrain authored Mar 11, 2023
1 parent d139ebc commit 671f1ba
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,23 @@ public void testDecimalParse() {
assertEquals(0.859d, parser.parseDouble("0.859", true, null), 0.0d);
assertEquals(0.8598023539251286d, parser.parseDouble("0.8598023539251286", true, null), 0.0d);
}

public void testLongParse() {
assertEquals(DocValueFormat.RAW.format(0), 0L);
assertEquals(DocValueFormat.RAW.format(-1), -1L);
assertEquals(DocValueFormat.RAW.format(1), 1L);
assertEquals(DocValueFormat.RAW.format(0d), 0d);
assertEquals(DocValueFormat.RAW.format(9.5d), 9.5d);
assertEquals(DocValueFormat.RAW.format(-1d), -1d);
}

public void testGeoTileParse() {
assertEquals(DocValueFormat.GEOTILE.format(longEncode(0, 0, 0)), "0/0/0");
assertEquals(DocValueFormat.GEOTILE.format(longEncode(30, 70, 15)), "15/19114/7333");
assertEquals(DocValueFormat.GEOTILE.format(longEncode(179.999, 89.999, 29)), "29/536869420/0");
assertEquals(DocValueFormat.GEOTILE.format(longEncode(-179.999, -89.999, 29)), "29/1491/536870911");
assertEquals(DocValueFormat.GEOTILE.format(longEncode(1, 1, 2)), "2/2/1");
assertEquals(DocValueFormat.GEOTILE.format(longEncode(13, 95, 1)), "1/1/0");
assertEquals(DocValueFormat.GEOTILE.format(longEncode(13, -95, 1)), "1/1/1");
}
}

0 comments on commit 671f1ba

Please sign in to comment.