|
2 | 2 |
|
3 | 3 | import java.io.IOException; |
4 | 4 | import java.io.StringReader; |
| 5 | +import static junit.framework.Assert.assertEquals; |
5 | 6 | import junit.framework.TestCase; |
6 | 7 | import net.sf.jsqlparser.JSQLParserException; |
7 | 8 | import net.sf.jsqlparser.expression.BinaryExpression; |
@@ -502,6 +503,30 @@ public void testDouble() throws JSQLParserException { |
502 | 503 | .getRightExpression()).getValue(), 0); |
503 | 504 | assertStatementCanBeDeparsedAs(select, statement); |
504 | 505 | } |
| 506 | + |
| 507 | + public void testDouble2() throws JSQLParserException { |
| 508 | + String statement = "SELECT 1.e22 FROM mytable"; |
| 509 | + Select select = (Select) parserManager.parse(new StringReader(statement)); |
| 510 | + |
| 511 | + assertEquals(1e22, ((DoubleValue) ((SelectExpressionItem) ((PlainSelect) select.getSelectBody()) |
| 512 | + .getSelectItems().get(0)).getExpression()).getValue(), 0); |
| 513 | + } |
| 514 | + |
| 515 | + public void testDouble3() throws JSQLParserException { |
| 516 | + String statement = "SELECT 1. FROM mytable"; |
| 517 | + Select select = (Select) parserManager.parse(new StringReader(statement)); |
| 518 | + |
| 519 | + assertEquals(1.0, ((DoubleValue) ((SelectExpressionItem) ((PlainSelect) select.getSelectBody()) |
| 520 | + .getSelectItems().get(0)).getExpression()).getValue(), 0); |
| 521 | + } |
| 522 | + |
| 523 | + public void testDouble4() throws JSQLParserException { |
| 524 | + String statement = "SELECT 1.2e22 FROM mytable"; |
| 525 | + Select select = (Select) parserManager.parse(new StringReader(statement)); |
| 526 | + |
| 527 | + assertEquals(1.2e22, ((DoubleValue) ((SelectExpressionItem) ((PlainSelect) select.getSelectBody()) |
| 528 | + .getSelectItems().get(0)).getExpression()).getValue(), 0); |
| 529 | + } |
505 | 530 |
|
506 | 531 | public void testWith() throws JSQLParserException { |
507 | 532 | String statement = "WITH DINFO (DEPTNO, AVGSALARY, EMPCOUNT) AS " |
|
0 commit comments