Skip to content

Commit 82d051b

Browse files
committed
Merge branch 'dev' of github.com:MethodicalAcceleratorDesign/MAD into dev
2 parents 93705f9 + bcf7a39 commit 82d051b

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

tests/tests/test-ng-maps/test-multipole-maps.mad

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ end
2020
function TestMult:testQUAD() -- Test the body (~2 min)
2121
local cfg = ref_cfg "quad" {
2222
elm = "quadrupole 'quad' {at=0.75, l=1.5, k1=${bdir}*${k1}, k1s=${bdir}*${k1s},tilt=${tdir}*${tilt}, fringe=0}",
23-
model = 1..2,
23+
model = {1, 2},
2424
method = {2, 4, 6, 8, "'teapot2'", "'teapot4'"},
2525
nslice = 1..3,
2626
energy = {1, 6500}, -- {1, 450, 6500}
2727

28-
tol = 150,
28+
tol = 160,
2929

3030
k1 = {-0.15, 0, 0.2},
3131
k1s = {-0.15, 0, 0.2},
32+
ptcmodel = {false, true},
3233
tilt = 0,
33-
alist = tblcat(ref_cfg.alist, {"k1", "k1s"}),
34+
alist = tblcat(ref_cfg.alist, {"k1", "k1s", "ptcmodel"}),
3435

3536
plot_info = {
3637
title = "Quadrupole NG v NG Maps",

tests/tests/test-ng-maps/test-subelm-maps.mad

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ local object, vector in MAD
22
local tblcat in MAD.utility
33
local run_test in require("trackvsng")
44

5+
--[[
6+
MISSING TEST -> SUB ELEMENTS + FRINGE/TILT/MISALIGNMENT
7+
]]
8+
9+
510
-- Yoshida Integrator Schemes -------------------------------------------------o
611
local function make_yoshida (w)
712
local d, k, n, s = {}, {}, #w+1, 0

tests/tests/test-ng-maps/trackvsng.mad

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,23 @@ local function debug_chk(cfg, dif, script2)
8585
if not cfg.dodbg then return end
8686
if not chk_tol(dif, cfg.tol, cfg.order) then
8787
print("Max dif greater than tolerance, stopping...")
88-
io.open(out_dir("setup1.mad"), "w"):write(cfg.ref_script):close()
89-
io.open(out_dir("setup2.mad"), "w"):write(script2):close()
88+
local setup1 = cfg.ref_script:gsub("debug = 0,", "debug = 4,")
89+
local setup2 = script2:gsub("debug = 0,", "debug = 4,")
90+
io.open(out_dir("setup1.mad"), "w"):write(setup1):close()
91+
io.open(out_dir("setup2.mad"), "w"):write(setup2):close()
92+
os.execute("../mad "..out_dir("setup1.mad").." > setup1.out")
93+
os.execute("../mad "..out_dir("setup2.mad").." > setup2.out")
9094
cfg.stop = true
9195
return
9296
end
9397
end
9498

9599
local function do_unit_test(cfg, dif)
96100
if cfg.do_utest then
97-
assertTrue(chk_tol(dif, cfg.tol, cfg.order), tostring(dif))
101+
assertTrue(
102+
chk_tol(dif, cfg.tol, cfg.order),
103+
tostring(dif) .. "test type: " .. cfg.cur_cfg.test_type
104+
)
98105
end
99106
end
100107

@@ -151,7 +158,7 @@ local function reverse_edir(cfg, results)
151158
end
152159

153160
local function cmaps(cfg, results)
154-
cfg.cmap = true
161+
cfg.cmap = not cfg.cmap
155162
local cmap_script = create_run(cfg, cfg.cur_cfg)
156163
local _, cmap_res = loadstring(cmap_script)()
157164
if cfg.docmap then

tests/tests/tools/test-tool.mad

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,14 @@ local function chk_test(mod_name, test_name) -- Check if the test should be run
173173

174174
-- Check if the test name matches any of the patterns (ignoring 'test')
175175
for _, p in ipairs(patterns) do
176-
if not string.find(test_name:sub(5), p) then chk = false end
176+
if not (string.find(test_name, p) or string.find(mod_name, p))
177+
then chk = false end
177178
end
178179

179180
-- Now check if the test name matches any of the excludes (ignoring 'test')
180181
for _, x in ipairs(excludes) do -- Exclude has priority
181-
if string.find(test_name:sub(5), x) then chk = false end
182+
if string.find(test_name, x) or string.find(mod_name, x)
183+
then chk = false end
182184
end
183185
return chk
184186
end

0 commit comments

Comments
 (0)