1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#[macro_export]
macro_rules! test_basic_impls {
([continuous] $fx: expr) => {
test_basic_impls!($fx, 0.5_f64);
};
([categorical] $fx: expr) => {
test_basic_impls!($fx, 0_usize);
};
([count] $fx: expr) => {
test_basic_impls!($fx, 3_u32);
};
([binary] $fx: expr) => {
test_basic_impls!($fx, true);
};
($fx: expr, $x: expr) => {
#[test]
fn should_impl_debug_clone_and_partialeq() {
let fx = $fx;
let fx2 = fx.clone();
assert_eq!($fx, fx2);
let y1 = fx.ln_f(&$x);
let y2 = fx.ln_f(&$x);
assert_eq!(y1, y2);
assert_eq!(fx2, fx);
let _s1 = format!("{:?}", fx);
}
};
}