| 322 | |
| 323 | #[test] |
| 324 | fn test_const_evaluator() { |
| 325 | // true --> true |
| 326 | test_evaluate(lit(true), lit(true)); |
| 327 | // true or true --> true |
| 328 | test_evaluate(lit(true).or(lit(true)), lit(true)); |
| 329 | // true or false --> true |
| 330 | test_evaluate(lit(true).or(lit(false)), lit(true)); |
| 331 | |
| 332 | // "foo" == "foo" --> true |
| 333 | test_evaluate(lit("foo").eq(lit("foo")), lit(true)); |
| 334 | // "foo" != "foo" --> false |
| 335 | test_evaluate(lit("foo").not_eq(lit("foo")), lit(false)); |
| 336 | |
| 337 | // c = 1 --> c = 1 |
| 338 | test_evaluate(col("c").eq(lit(1)), col("c").eq(lit(1))); |
| 339 | // c = 1 + 2 --> c + 3 |
| 340 | test_evaluate(col("c").eq(lit(1) + lit(2)), col("c").eq(lit(3))); |
| 341 | // (foo != foo) OR (c = 1) --> false OR (c = 1) |
| 342 | test_evaluate( |
| 343 | (lit("foo").not_eq(lit("foo"))).or(col("c").eq(lit(1))), |
| 344 | col("c").eq(lit(1)), |
| 345 | ); |
| 346 | } |
| 347 | |
| 348 | #[test] |
| 349 | fn test_const_evaluator_alias() { |