From 6910f755222e37380831a978617c16233192d649 Mon Sep 17 00:00:00 2001 From: Anton Reinhard Date: Wed, 19 Jun 2024 18:48:48 +0200 Subject: [PATCH] Remove QEDbase namespace from particle types in tests --- test/particles/base_states.jl | 50 +++++++++++++++++------------------ test/particles/propagators.jl | 6 ++--- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/test/particles/base_states.jl b/test/particles/base_states.jl index 4901e4b..269de26 100644 --- a/test/particles/base_states.jl +++ b/test/particles/base_states.jl @@ -6,10 +6,10 @@ using Random include("../utils.jl") FERMION_STATES_GROUNDTRUTH_FACTORY = Dict( - (QEDbase.Incoming, QEDbase.Electron) => IncomingFermionSpinor, - (QEDbase.Outgoing, QEDbase.Electron) => OutgoingFermionSpinor, - (QEDbase.Incoming, QEDbase.Positron) => IncomingAntiFermionSpinor, - (QEDbase.Outgoing, QEDbase.Positron) => OutgoingAntiFermionSpinor, + (QEDbase.Incoming, Electron) => IncomingFermionSpinor, + (QEDbase.Outgoing, Electron) => OutgoingFermionSpinor, + (QEDbase.Incoming, Positron) => IncomingAntiFermionSpinor, + (QEDbase.Outgoing, Positron) => OutgoingAntiFermionSpinor, ) RNG = MersenneTwister(708583836976) @@ -39,14 +39,14 @@ test_broadcast(x::QEDbase.ParticleDirection) = x test_broadcast(x::QEDbase.AbstractSpinOrPolarization) = x @testset "fermion" begin - struct TestFermion <: QEDbase.Fermion end + struct TestFermion <: Fermion end @test QEDbase.is_fermion(TestFermion()) @test QEDbase.is_particle(TestFermion()) @test !QEDbase.is_anti_particle(TestFermion()) @test test_broadcast.(TestFermion()) == TestFermion() @testset "$p $d" for (p, d) in Iterators.product( - (QEDbase.Electron, QEDbase.Positron), (QEDbase.Incoming, QEDbase.Outgoing) + (Electron, Positron), (QEDbase.Incoming, QEDbase.Outgoing) ) mom = SFourMomentum(sqrt(QEDbase.mass(p()) + X^2 + Y^2 + Z^2), X, Y, Z) particle_mass = QEDbase.mass(p()) @@ -73,13 +73,13 @@ test_broadcast(x::QEDbase.AbstractSpinOrPolarization) = x end @testset "photon" begin - @test !QEDbase.is_fermion(QEDbase.Photon()) - @test QEDbase.is_boson(QEDbase.Photon()) - @test QEDbase.is_particle(QEDbase.Photon()) - @test QEDbase.is_anti_particle(QEDbase.Photon()) - @test QEDbase.charge(QEDbase.Photon()) == 0.0 - @test QEDbase.mass(QEDbase.Photon()) == 0.0 - @test test_broadcast.(QEDbase.Photon()) == QEDbase.Photon() + @test !QEDbase.is_fermion(Photon()) + @test QEDbase.is_boson(Photon()) + @test QEDbase.is_particle(Photon()) + @test QEDbase.is_anti_particle(Photon()) + @test QEDbase.charge(Photon()) == 0.0 + @test QEDbase.mass(Photon()) == 0.0 + @test test_broadcast.(Photon()) == Photon() @testset "$D" for D in [QEDbase.Incoming, QEDbase.Outgoing] @testset "$om $cth $phi" for (om, cth, phi) in @@ -88,7 +88,7 @@ end mom = SFourMomentum(_cartesian_coordinates(om, om, cth, phi)) both_photon_states = QEDbase.base_state( - QEDbase.Photon(), D(), mom, QEDbase.AllPolarization() + Photon(), D(), mom, QEDbase.AllPolarization() ) # property test the photon states @@ -105,36 +105,36 @@ end ) # test the single polarization states - @test QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolarizationX()) == + @test QEDbase.base_state(Photon(), D(), mom, QEDbase.PolarizationX()) == both_photon_states[1] - @test QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolarizationY()) == + @test QEDbase.base_state(Photon(), D(), mom, QEDbase.PolarizationY()) == both_photon_states[2] - @test QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolX()) == + @test QEDbase.base_state(Photon(), D(), mom, QEDbase.PolX()) == both_photon_states[1] - @test QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolY()) == + @test QEDbase.base_state(Photon(), D(), mom, QEDbase.PolY()) == both_photon_states[2] @test QEDbase._as_svec( - QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolX()) + QEDbase.base_state(Photon(), D(), mom, QEDbase.PolX()) ) isa SVector @test QEDbase._as_svec( - QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolY()) + QEDbase.base_state(Photon(), D(), mom, QEDbase.PolY()) ) isa SVector @test QEDbase._as_svec( - QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.AllPol()) + QEDbase.base_state(Photon(), D(), mom, QEDbase.AllPol()) ) isa SVector @test QEDbase._as_svec( - QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolX()) + QEDbase.base_state(Photon(), D(), mom, QEDbase.PolX()) )[1] == both_photon_states[1] @test QEDbase._as_svec( - QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.PolY()) + QEDbase.base_state(Photon(), D(), mom, QEDbase.PolY()) )[1] == both_photon_states[2] @test QEDbase._as_svec( - QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.AllPol()) + QEDbase.base_state(Photon(), D(), mom, QEDbase.AllPol()) )[1] == both_photon_states[1] @test QEDbase._as_svec( - QEDbase.base_state(QEDbase.Photon(), D(), mom, QEDbase.AllPol()) + QEDbase.base_state(Photon(), D(), mom, QEDbase.AllPol()) )[2] == both_photon_states[2] end end diff --git a/test/particles/propagators.jl b/test/particles/propagators.jl index bf7a545..6f29f0e 100644 --- a/test/particles/propagators.jl +++ b/test/particles/propagators.jl @@ -10,14 +10,14 @@ function _rand_momentum(rng::AbstractRNG) return SFourMomentum(rand(rng, 4)) end -groundtruth_propagator(::QEDbase.Photon, mom) = one(eltype(mom)) / (mom * mom) -function groundtruth_propagator(particle::QEDbase.FermionLike, mom) +groundtruth_propagator(::Photon, mom) = one(eltype(mom)) / (mom * mom) +function groundtruth_propagator(particle::FermionLike, mom) return (slashed(mom) + QEDbase.mass(particle) * one(DiracMatrix)) / (mom * mom - QEDbase.mass(particle)^2) end @testset "propagators" begin - @testset "$P" for P in (QEDbase.Electron(), QEDbase.Positron(), QEDbase.Photon()) + @testset "$P" for P in (Electron(), Positron(), Photon()) mom = _rand_momentum(RNG) groundtruth = groundtruth_propagator(P, mom) test_prop = QEDbase.propagator(P, mom)