Skip to content

Commit

Permalink
Add test file
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonReinhard committed Nov 1, 2024
1 parent 0b2207f commit 4443520
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/input_type.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# file for testing that the generated input_type of a generated dag is correct

using Random
using QEDcore
using QEDprocesses
using ComputableDAGs
using QEDFeynmanDiagrams

using RuntimeGeneratedFunctions
RuntimeGeneratedFunctions.init(@__MODULE__)

include("utils.jl")

RNG = MersenneTwister(0)

@testset "Compton-like process with $n incoming photons" for n in (1, 2, 3, 4)
proc = ScatteringProcess(
(Electron(), ntuple(_ -> Photon(), n)...),
(Electron(), Photon()),
(AllSpin(), ntuple(_ -> PolX(), n)...),
(AllSpin(), AllPol()),
)

for n_other in (1, 2, 3, 4)
n_other_proc = ScatteringProcess(
(Electron(), ntuple(_ -> Photon(), n_other)...),
(Electron(), Photon()),
(AllSpin(), ntuple(_ -> PolX(), n_other)...),
(AllSpin(), AllPol()),
)
input = gen_process_input(RNG, n_other_proc)

if n_other == n
@test typeof(input) <: input_type(proc)
else
@test !(typeof(input) <: input_type(proc))
end
end
end
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using SafeTestsets

@safetestset "Input Type" begin
include("input_type.jl")
end

@safetestset "Synced Spins and Polarizations" begin
include("synced_spin_pol.jl")
end

0 comments on commit 4443520

Please sign in to comment.