test_engine: refactor test_complex_or() and test_complex_and()