| 570 | |
| 571 | #[test] |
| 572 | fn math_all_unary_functions() { |
| 573 | let km = PyKernelModule::new(); |
| 574 | let funcs: Vec<fn(&PyKernelModule, PyExpr) -> PyExpr> = vec![ |
| 575 | PyKernelModule::sqrt, |
| 576 | PyKernelModule::abs, |
| 577 | PyKernelModule::log, |
| 578 | PyKernelModule::exp, |
| 579 | PyKernelModule::log2, |
| 580 | PyKernelModule::log10, |
| 581 | PyKernelModule::floor, |
| 582 | PyKernelModule::ceil, |
| 583 | PyKernelModule::round, |
| 584 | PyKernelModule::sin, |
| 585 | PyKernelModule::cos, |
| 586 | PyKernelModule::tan, |
| 587 | ]; |
| 588 | for f in funcs { |
| 589 | let x = km.arg("x"); |
| 590 | let result = f(&km, x.clone()); |
| 591 | assert_eq!(result.temp_args.len(), 1); |
| 592 | assert!(matches!(result.inner, Expr::Unary(_, _))); |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | // --- Binary math functions --- |
| 597 | |