提交 bed9e597 authored 作者: yuanwhy's avatar yuanwhy

add unit-test for ROUND

上级 dda25f5a
...@@ -117,6 +117,7 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -117,6 +117,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
testThatCurrentTimestampStaysTheSameWithinATransaction(); testThatCurrentTimestampStaysTheSameWithinATransaction();
testThatCurrentTimestampUpdatesOutsideATransaction(); testThatCurrentTimestampUpdatesOutsideATransaction();
testAnnotationProcessorsOutput(); testAnnotationProcessorsOutput();
testRound();
deleteDb("functions"); deleteDb("functions");
} }
...@@ -2010,6 +2011,28 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -2010,6 +2011,28 @@ public class TestFunctions extends TestBase implements AggregateFunction {
} }
} }
private void testRound() throws SQLException {
deleteDb("functions");
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
final ResultSet rs = stat.executeQuery(
"select ROUND(-1.2), ROUND(-1.5), ROUND(-1.6), ROUND(2), ROUND(1.5), ROUND(1.8), ROUND(1.1) from dual");
rs.next();
assertEquals(-1, rs.getInt(1));
assertEquals(-2, rs.getInt(2));
assertEquals(-2, rs.getInt(3));
assertEquals(2, rs.getInt(4));
assertEquals(2, rs.getInt(5));
assertEquals(2, rs.getInt(6));
assertEquals(1, rs.getInt(7));
rs.close();
conn.close();
}
private void testThatCurrentTimestampIsSane() throws SQLException, private void testThatCurrentTimestampIsSane() throws SQLException,
ParseException { ParseException {
deleteDb("functions"); deleteDb("functions");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论