1#include "catch.hpp"
2#include "duckdb/common/helper.hpp"
3#include "expression_helper.hpp"
4#include "duckdb/optimizer/rule/conjunction_simplification.hpp"
5
6using namespace duckdb;
7using namespace std;
8
9TEST_CASE("Conjunction simplification test", "[optimizer]") {
10 ExpressionHelper helper;
11
12 REQUIRE(helper.AddColumns("X BOOLEAN").empty());
13 helper.AddRule<ConjunctionSimplificationRule>();
14
15 string input, expected_output;
16
17 // input = "X AND FALSE";
18 // expected_output = "FALSE";
19 // REQUIRE(helper.VerifyRewrite(input, expected_output));
20
21 // input = "FALSE AND X";
22 // expected_output = "FALSE";
23 // REQUIRE(helper.VerifyRewrite(input, expected_output));
24
25 input = "X AND TRUE";
26 expected_output = "X";
27 REQUIRE(helper.VerifyRewrite(input, expected_output));
28
29 // input = "X OR TRUE";
30 // expected_output = "TRUE";
31 // REQUIRE(helper.VerifyRewrite(input, expected_output));
32
33 input = "X OR FALSE";
34 expected_output = "X";
35 REQUIRE(helper.VerifyRewrite(input, expected_output));
36}
37