Reenable tests and fix a lot
Some checks failed
MetagraphOptimization_CI / test (push) Failing after 6m58s
MetagraphOptimization_CI / docs (push) Failing after 7m6s

This commit is contained in:
2024-08-19 17:45:40 +02:00
parent d553fe8ffc
commit 0ce98e29ef
7 changed files with 47 additions and 156 deletions

View File

@@ -1,5 +1,5 @@
using MetagraphOptimization
using QEDbase
using QEDcore
using AccurateArithmetic
using Random
using UUIDs

View File

@@ -136,8 +136,6 @@ operations = get_operations(graph)
@test length(operations) == (nodeReductions = 0, nodeSplits = 0)
@test length(graph.dirtyNodes) == 0
@test sum(length(operations)) == 10
@test operations == get_operations(graph)
properties = get_properties(graph)
@@ -153,13 +151,13 @@ operations = get_operations(graph)
@test length(operations) == (nodeReductions = 0, nodeSplits = 0)
@test isempty(operations)
@test length(graph.dirtyNodes) == 0
@test length(graph.nodes) == 6
@test length(graph.appliedOperations) == 10
@test length(graph.nodes) == 26
@test length(graph.appliedOperations) == 0
@test length(graph.operationsToApply) == 0
reset_graph!(graph)
@test length(graph.dirtyNodes) == 26
@test length(graph.dirtyNodes) == 0
@test length(graph.nodes) == 26
@test length(graph.appliedOperations) == 0
@test length(graph.operationsToApply) == 0

View File

@@ -1,7 +1,8 @@
using MetagraphOptimization
using QEDcore
import MetagraphOptimization.gen_diagrams
import MetagraphOptimization.isincoming
import MetagraphOptimization.types
@@ -9,25 +10,12 @@ model = QEDModel()
compton = ("Compton Scattering", parse_process("ke->ke", model), 2)
compton_3 = ("3-Photon Compton Scattering", parse_process("kkke->ke", QEDModel()), 24)
compton_4 = ("4-Photon Compton Scattering", parse_process("kkkke->ke", QEDModel()), 120)
bhabha = ("Bhabha Scattering", parse_process("ep->ep", model), 2)
moller = ("Møller Scattering", parse_process("ee->ee", model), 2)
pair_production = ("Pair production", parse_process("kk->ep", model), 2)
pair_annihilation = ("Pair annihilation", parse_process("ep->kk", model), 2)
trident = ("Trident", parse_process("ke->epe", model), 8)
@testset "Known Processes" begin
@testset "$name" for (name, process, n) in
[compton, bhabha, moller, pair_production, pair_annihilation, trident, compton_3, compton_4]
@testset "$name" for (name, process, n) in [compton, compton_3, compton_4]
initial_diagram = FeynmanDiagram(process)
n_particles = number_incoming_particles(process) + number_outgoing_particles(process)
n_particles = 0
for type in types(model)
if (is_incoming(type))
n_particles += get(process.inParticles, type, 0)
else
n_particles += get(process.outParticles, type, 0)
end
end
@test n_particles == length(initial_diagram.particles)
@test ismissing(initial_diagram.tie[])
@test isempty(initial_diagram.vertices)

View File

@@ -106,34 +106,26 @@ end
end
@testset "Parse Process" begin
@testset "Order invariance" begin
@test parse_process("ke->ke", QEDModel()) == parse_process("ek->ke", QEDModel())
@test parse_process("ke->ke", QEDModel()) == parse_process("ek->ek", QEDModel())
@test parse_process("ke->ke", QEDModel()) == parse_process("ke->ek", QEDModel())
@test parse_process("kkke->eep", QEDModel()) == parse_process("kkek->epe", QEDModel())
end
@testset "Known processes" begin
compton_process = GenericQEDProcess(1, 1, 1, 1, 0, 0)
proc = parse_process("ke->ke", QEDModel())
@test incoming_particles(proc) == (Photon(), Electron())
@test outgoing_particles(proc) == (Photon(), Electron())
@test parse_process("ke->ke", QEDModel()) == compton_process
proc = parse_process("kp->kp", QEDModel())
@test incoming_particles(proc) == (Photon(), Positron())
@test outgoing_particles(proc) == (Photon(), Positron())
positron_compton_process = GenericQEDProcess(1, 1, 0, 0, 1, 1)
proc = parse_process("ke->eep", QEDModel())
@test incoming_particles(proc) == (Photon(), Electron())
@test outgoing_particles(proc) == (Electron(), Electron(), Positron())
@test parse_process("kp->kp", QEDModel()) == positron_compton_process
proc = parse_process("kk->pe", QEDModel())
@test incoming_particles(proc) == (Photon(), Photon())
@test outgoing_particles(proc) == (Positron(), Electron())
trident_process = GenericQEDProcess(1, 0, 1, 2, 0, 1)
@test parse_process("ke->eep", QEDModel()) == trident_process
pair_production_process = GenericQEDProcess(2, 0, 0, 1, 0, 1)
@test parse_process("kk->pe", QEDModel()) == pair_production_process
pair_annihilation_process = GenericQEDProcess(0, 2, 1, 0, 1, 0)
@test parse_process("pe->kk", QEDModel()) == pair_annihilation_process
proc = parse_process("pe->kk", QEDModel())
@test incoming_particles(proc) == (Positron(), Electron())
@test outgoing_particles(proc) == (Photon(), Photon())
end
end