Skip to content

Commit

Permalink
add rust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Oct 21, 2024
1 parent ed7f1b1 commit 913f8fa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/ekore/src/anomalous_dimensions/polarized/spacelike/as1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<f64> = 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);
// }

}
14 changes: 14 additions & 0 deletions crates/ekore/src/anomalous_dimensions/polarized/spacelike/as2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ pub fn gamma_singlet(c: &mut Cache, nf: u8) -> [[Complex<f64>; 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;
Expand Down Expand Up @@ -192,4 +193,17 @@ mod tests {
epsilon = 1e-13
);
}

#[test]
fn axial_anomaly() {
const N: Complex<f64> = 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);
}
}

0 comments on commit 913f8fa

Please sign in to comment.