Add match_formulas() function to simplify tests writing