-
Notifications
You must be signed in to change notification settings - Fork 540
Expand file tree
/
Copy pathtest_src.lua
More file actions
142 lines (134 loc) · 3.48 KB
/
test_src.lua
File metadata and controls
142 lines (134 loc) · 3.48 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
-- Test different src functions
local tests = {
makeplural = {
algae = "algae",
amoeba = "amoebae",
baluchitherium = "baluchitheria",
Bordeaux = "Bordeaux",
["bunch of grapes"] = "bunches of grapes",
bus = "buses",
candelabrum = "candelabra",
caveman = "cavemen",
child = "children",
cookie = "cookies",
deer = "deer",
dingo = "dingoes",
epoch = "epochs",
["Federal Bureau of Investigation"] = "Federal Bureaus of Investigation",
fish = "fish",
foot = "feet",
fox = "foxes",
fungus = "fungi",
gateau = "gateaux",
gauntlet = "gauntlets",
["gauntlet of power"] = "gauntlets of power",
goose = "geese",
homunculus = "homunculi",
hoof = "hooves",
hyphae = "hyphae",
knife = "knives",
larvae = "larvae",
loch = "lochs",
lotus = "lotuses",
louse = "lice",
manes = "manes",
matzah = "matzot",
matzoh = "matzot",
mech = "mechs",
mouse = "mice",
mycelium = "mycelia",
nemesis = "nemeses",
nerf = "nerfs",
ninja = "ninja",
ox = "oxen",
potato = "potatoes",
priestess = "priestesses",
ronin = "ronin",
roshi = "roshi",
scale = "scales",
serf = "serfs",
shaman = "shamans",
sheep = "sheep",
shito = "shito",
["slice of cake"] = "slices of cake",
stamen = "stamens",
tech = "techs",
tengu = "tengu",
tomato = "tomatoes",
tooth = "teeth",
tuna = "tuna",
valkyrie = "valkyries",
VAX = "VAXES",
vertebra = "vertebrae",
vortex = "vortices",
woman = "women",
wumpus = "wumpuses",
zorkmid = "zorkmids",
monarch = "monarchs",
stomach = "stomachs",
loch = "lochs",
tech = "techs",
},
makesingular = {
algae = "alga",
amoebae = "amoeba",
baluchitheria = "baluchitherium",
Bordeaux = "Bordeaux",
buses = "bus",
dingoes = "dingo",
["gateaux au chocolat"] = "gateau au chocolat",
larvae = "larva",
lice = "louse",
matzot = "matzo",
mycelia = "mycelium",
nemeses = "nemesis",
oxen = "ox",
potatoes = "potato",
["pots of tulips"] = "pot of tulips",
priestesses = "priestess",
ronin = "ronin",
["set of dragon scales"] = "set of dragon scales",
techs = "tech",
tuna = "tuna",
vertebrae = "vertebra",
vortices = "vortex",
},
an = {
a = "an a",
b = "a b",
["the foo"] = "the foo",
["molten lava"] = "molten lava",
["iron bars"] = "iron bars",
ice = "ice",
unicorn = "a unicorn",
uranium = "a uranium",
["one-eyed"] = "a one-eyed",
candy = "a candy",
eucalyptus = "a eucalyptus",
ukulele = "a ukulele",
uke = "a uke",
["useful tool"] = "a useful tool",
}
}
for func, fval in pairs(tests) do
for instr, outstr in pairs(fval) do
local ret = nh[func](instr)
if ret ~= outstr then
error(func .. "(\"" .. instr .. "\") != \"" .. outstr .. "\" (returned \"" .. ret .. "\") instead")
end
end
end
function test_getlin()
nh.pushkey("AbC");
local str = nh.getlin("What?");
if str ~= "AbC" then
error("nh.getlin fail, got \"" .. str .. "\"");
end
end
function test_abscoord()
local ax,ay = nh.abscoord(3, 8);
local pt = nh.abscoord({ x = 10, y = 5 });
end
test_getlin();
test_abscoord();
nh.flip_level(3);