From 913f8fa3a7d87c5a8f0103fef84c44800206aad8 Mon Sep 17 00:00:00 2001 From: giacomomagni Date: Mon, 21 Oct 2024 12:40:24 +0200 Subject: [PATCH] add rust tests --- .../polarized/spacelike/as1.rs | 11 +++++++++++ .../polarized/spacelike/as2.rs | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs index 2eec91867..b73a862ad 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs @@ -82,4 +82,15 @@ mod tests { let me = gamma_qg(&mut c, NF); assert_approx_eq_cmplx!(f64, me, Complex::zero(), epsilon = 1e-12); } + + // TODO: activate this test once the beta function will be available + // #[test] + // fn axial_anomaly() { + // const N: Complex = cmplx!(1., 0.); + // let mut c = Cache::new(N); + // let me = gamma_gg(&mut c, NF); + // let beta = -1.0 * beta_qcd_as2(NF); + // assert_approx_eq_cmplx!(f64, me, beta); + // } + } diff --git a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs index 8dcdf6733..d84bd7e1f 100644 --- a/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs +++ b/crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs @@ -129,6 +129,7 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex; 2]; 2] { #[cfg(test)] mod tests { use super::*; + use super::super::as1::gamma_gq as as1_gamma_gq; use crate::harmonics::cache::Cache; use crate::{assert_approx_eq_cmplx, cmplx}; use num::complex::Complex; @@ -192,4 +193,17 @@ mod tests { epsilon = 1e-13 ); } + + #[test] + fn axial_anomaly() { + const N: Complex = cmplx!(1., 0.); + let mut c = Cache::new(N); + let me_ps = gamma_ps(&mut c, NF); + let as1_gq = - 2.0 * (NF as f64) * as1_gamma_gq(&mut c, NF); + assert_approx_eq_cmplx!(f64, me_ps, as1_gq); + // TODO: activate this test once the beta function will be available + // let me_gg = gamma_gg(&mut c, NF); + // let beta = -1.0 * beta_qcd_as2(NF); + // assert_approx_eq_cmplx!(f64, me_gg, beta, rel=9e-7); + } }