userspace/libsinsp/test/filter_parser.ut.cpp
// complex test case with all supported node types
complex test case with all supported node types
complex test case with all supported node types
TEST(parser, expr_all_node_types)
{
	test_equal_ast(
		"evt.name exists and evt.type in (a, b) and not evt.dir=< or proc.name=cat",
		new or_expr({
			new and_expr({
				new unary_check_expr("evt.name", "", "exists"), 
				new binary_check_expr("evt.type", "", "in", new list_expr({"a", "b"})),
				new not_expr(
					new binary_check_expr("evt.dir", "", "=", new value_expr("<"))
				),
			}),
			new binary_check_expr("proc.name", "", "=", new value_expr("cat")),
		})
	);
}
TEST ( parser , expr_all_node_types ) { test_equal_ast ( " " , new or_expr ( { new and_expr ( { new unary_check_expr ( " " , " " , " " ) , new binary_check_expr ( " " , " " , " " , new list_expr ( { " " , " " } ) ) , new not_expr ( new binary_check_expr ( " " , " " , " " , new value_expr ( " " ) ) ) , } ) , new binary_check_expr ( " " , " " , " " , new value_expr ( " " ) ) , } ) ) ; }
complex test case with all supported node types
complex test case with all supported node types