|
9 | 9 | */ |
10 | 10 | package net.sf.jsqlparser.util.cnfexpression; |
11 | 11 |
|
| 12 | +import net.sf.jsqlparser.JSQLParserException; |
12 | 13 | import net.sf.jsqlparser.expression.Expression; |
13 | 14 | import net.sf.jsqlparser.parser.CCJSqlParserUtil; |
14 | 15 | import static org.junit.jupiter.api.Assertions.assertEquals; |
| 16 | +import org.junit.jupiter.api.Disabled; |
15 | 17 | import org.junit.jupiter.api.Test; |
16 | 18 |
|
17 | 19 | public class CNFTest { |
@@ -328,4 +330,48 @@ public void test5() throws Exception { |
328 | 330 | assertEquals(expected.toString(), result.toString()); |
329 | 331 | } |
330 | 332 |
|
| 333 | + @Test |
| 334 | + @Disabled |
| 335 | + public void testStackOverflowIssue1576() throws JSQLParserException { |
| 336 | + Expression expr = CCJSqlParserUtil.parseCondExpression( |
| 337 | + "((3.0 >= 4.0 AND 5.0 <= 6.0) OR " |
| 338 | + + "(7.0 < 8.0 AND 9.0 > 10.0) OR " |
| 339 | + + "(11.0 = 11.0 AND 19.0 > 20.0) OR " |
| 340 | + + "(17.0 = 14.0 AND 19.0 > 17.0) OR " |
| 341 | + + "(17.0 = 18.0 AND 20.0 > 20.0) OR " |
| 342 | + + "(17.0 = 16.0 AND 19.0 > 20.0) OR " |
| 343 | + + "(17.0 = 18.0 AND 19.0 > 20.0) OR " |
| 344 | + + "(17.0 = 18.0 AND 19.0 > 20.0) OR " |
| 345 | + + "(17.0 = 22.0 AND 19.0 > 20.0) OR " |
| 346 | + + "(18.0 = 18.0 AND 22.0 > 20.0) OR " |
| 347 | + + "(17.0 = 18.0 AND 19.0 > 20.0) OR " |
| 348 | + + "(18.0 = 18.0 AND 22.0 > 20.0) OR " |
| 349 | + + "(18.0 = 19.0 AND 22.0 > 20.0) OR " |
| 350 | + + "(17.0 = 18.0 AND 19.0 > 20.0))" |
| 351 | + ); |
| 352 | + |
| 353 | + System.out.println(expr); |
| 354 | + |
| 355 | + Expression result = CNFConverter.convertToCNF(expr); |
| 356 | + |
| 357 | + System.out.println(result); |
| 358 | + } |
| 359 | + |
| 360 | + @Test |
| 361 | + public void testStackOverflowIssue1576_2() throws JSQLParserException { |
| 362 | + Expression expr = CCJSqlParserUtil.parseCondExpression( |
| 363 | + "((3.0 >= 4.0 AND 5.0 <= 6.0) OR " |
| 364 | + + "(7.0 < 8.0 AND 9.0 > 10.0) OR " |
| 365 | + + "(11.0 = 11.0 AND 19.0 > 20.0) OR " |
| 366 | + + "(17.0 = 14.0 AND 19.0 > 17.0) OR " |
| 367 | + + "(17.0 = 18.0 AND 20.0 > 20.0) OR " |
| 368 | + + "(17.0 = 16.0 AND 19.0 > 20.0))" |
| 369 | + ); |
| 370 | + |
| 371 | + System.out.println(expr); |
| 372 | + |
| 373 | + Expression result = CNFConverter.convertToCNF(expr); |
| 374 | + |
| 375 | + System.out.println(result); |
| 376 | + } |
331 | 377 | } |
0 commit comments