Macro multiversion_test

Source
macro_rules! multiversion_test {
    (
        use {$($($path:ident::)+*),*};

        #[test]
        $(#[$m:meta])* $v:vis fn multiversion() $body:block
    ) => { ... };
    (
        use {$($($path:ident::)+*),*};

        { $($tail:tt)+ }
    ) => { ... };
    (@expr $e:expr) => { ... };
}
Expand description

Helper for testing and benchmarking multiversion! library functions.

The first rule is for testing and creates individual #[test] functions for each implementation.

The second rule is more general, duplicating the same expression for each implementation and is useful for benchmarking.

#[target_feature(...)] isn’t applied to the test code as the feature-specific code should be elsewhere, inside a multiversion! macro.