macro_rules! test_fn {
(
$(#[$meta:meta])*
$name:ident, $rules:expr,
$(runner = $runner:expr,)?
$start:literal
=>
$($goal:literal),+ $(,)?
$(@check $check_fn:expr)?
) => { ... };
}
Expand description
Utility to make a test proving expressions equivalent
Example
egg::test_fn! {
// name of the generated test function
my_test_name,
// the rules to use
[
rewrite!("my_silly_rewrite"; "(foo ?a)" => "(bar ?a)"),
rewrite!("my_other_rewrite"; "(bar ?a)" => "(baz ?a)"),
],
// the `runner = ...` is optional
// if included, this must come right after the rules
runner = Runner::<SymbolLang, (), _>::default(),
// the initial expression
"(foo 1)" =>
// 1 or more goal expressions, all of which will be check to be
// equivalent to the initial one
"(bar 1)",
"(baz 1)",
}