Lines Matching refs:test_cpp_expr_optim
843 def test_cpp_expr_optim(expr, expected, macros=None): function
889 test_cpp_expr_optim("0", "(int 0)")
890 test_cpp_expr_optim("1", "(int 1)")
891 test_cpp_expr_optim("1 && 1", "(int 1)")
892 test_cpp_expr_optim("1 && +1", "(int 1)")
893 test_cpp_expr_optim("0x1 && 01", "(oct 01)")
894 test_cpp_expr_optim("1 && 0", "(int 0)")
895 test_cpp_expr_optim("0 && 1", "(int 0)")
896 test_cpp_expr_optim("0 && 0", "(int 0)")
897 test_cpp_expr_optim("1 || 1", "(int 1)")
898 test_cpp_expr_optim("1 || 0", "(int 1)")
899 test_cpp_expr_optim("0 || 1", "(int 1)")
900 test_cpp_expr_optim("0 || 0", "(int 0)")
901 test_cpp_expr_optim("A", "(ident A)")
902 test_cpp_expr_optim("A", "(int 1)", {"A": 1})
903 test_cpp_expr_optim("A || B", "(int 1)", {"A": 1})
904 test_cpp_expr_optim("A || B", "(int 1)", {"B": 1})
905 test_cpp_expr_optim("A && B", "(ident B)", {"A": 1})
906 test_cpp_expr_optim("A && B", "(ident A)", {"B": 1})
907 test_cpp_expr_optim("A && B", "(&& (ident A) (ident B))")
908 test_cpp_expr_optim("EXAMPLE", "(ident EXAMPLE)")
909 test_cpp_expr_optim("EXAMPLE - 3", "(- (ident EXAMPLE) (int 3))")
910 test_cpp_expr_optim("defined(EXAMPLE)", "(defined EXAMPLE)")
911 test_cpp_expr_optim("defined(EXAMPLE)", "(defined XOWOE)",
913 test_cpp_expr_optim("defined(EXAMPLE)", "(int 0)",
915 test_cpp_expr_optim("!defined(EXAMPLE)", "(! (defined EXAMPLE))")
916 test_cpp_expr_optim("!defined(EXAMPLE)", "(! (defined XOWOE))",
918 test_cpp_expr_optim("!defined(EXAMPLE)", "(int 1)",
920 test_cpp_expr_optim("defined(A) || defined(B)",
922 test_cpp_expr_optim("defined(A) || defined(B)", "(int 1)", {"A": "1"})
923 test_cpp_expr_optim("defined(A) || defined(B)", "(int 1)", {"B": "1"})
924 test_cpp_expr_optim("defined(A) || defined(B)", "(defined A)",
926 test_cpp_expr_optim("defined(A) || defined(B)", "(int 0)",
928 test_cpp_expr_optim("defined(A) && defined(B)",
930 test_cpp_expr_optim("defined(A) && defined(B)",
932 test_cpp_expr_optim("defined(A) && defined(B)",
934 test_cpp_expr_optim("defined(A) && defined(B)", "(int 0)",
936 test_cpp_expr_optim("defined(A) && defined(B)",
938 test_cpp_expr_optim("A == 1 || defined(B)",
940 test_cpp_expr_optim(