1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
-- Test correct handling of you.unique_creatures.
local function test_uniques()
debug.save_uniques()
debug.generate_level()
assert(debug.check_uniques(),
"you.uniques out of sync with actually placed uniques")
end
local function test_uniques_branch(branch, depth)
crawl.message("Running unique placement tests in branch " .. branch)
debug.flush_map_memory()
for d = 1, depth do
debug.goto_place(branch .. ":" .. d)
test_uniques()
end
end
local function test_uniques_blank(branch, depth, nlevels)
local place = branch .. ":" .. depth
crawl.message("Running blanked placement test at " .. place)
debug.goto_place(place)
for lev_i = 1, nlevels do
debug.reset_uniques()
debug.flush_map_memory()
test_uniques()
end
end
local function test_uniques_random(branch, depth, nlevels)
local place = branch .. ":" .. depth
crawl.message("Running randomized placement test at " .. place)
debug.goto_place(place)
for lev_i = 1, nlevels do
debug.randomize_uniques()
debug.flush_map_memory()
test_uniques()
end
end
local function run_unique_tests()
test_uniques_branch("D", 16)
test_uniques_branch("Depths", 6)
test_uniques_branch("Dis", 7)
for depth = 1, 16 do
test_uniques_blank("D", depth, 3)
test_uniques_random("D", depth, 3)
end
for depth = 1, 6 do
test_uniques_blank("Depths", depth, 3)
test_uniques_random("Depths", depth, 3)
end
for depth = 1, 7 do
test_uniques_blank("Dis", depth, 3)
if depth < 7 then
-- otherwise we get failures for randomly placed Dispater
-- getting placed again
test_uniques_random("Dis", depth, 3)
end
end
for depth = 5, 1, -1 do
test_uniques_blank("Swamp", depth, 3)
if depth < 5 then
-- otherwise problem with lernaean, like Dispater above
test_uniques_random("Swamp", depth, 3)
end
end
end
run_unique_tests()
|