Files
ages/tests/test_trigger_regex.py

99 lines
3.1 KiB
Python
Raw Normal View History

from agame.trigger import *
def test_get_item():
cases = [
("get item", "item"),
("take item", "item"),
("grab item", "item"),
("pick up item", "item"),
("pickup item", "item"),
("get the item", "item"),
("take the item", "item"),
("grab the item", "item"),
("pick up the item", "item"),
("pickup the item", "item"),
("get a item", "item"),
("take a item", "item"),
("grab a item", "item"),
("pick up a item", "item"),
("pickup a item", "item"),
("get an item", "item"),
("take an item", "item"),
("grab an item", "item"),
("pick up an item", "item"),
("pickup an item", "item"),
("get item", "item"),
("take item", "item"),
("grab item", "item"),
("pick up item", "item"),
("pickup item", "item"),
("get the item", "item"),
("take the item", "item"),
("grab the item", "item"),
("pick up the item", "item"),
("pickup the item", "item"),
("get a item", "item"),
("take a item", "item"),
("grab a item", "item"),
("pick up a item", "item"),
("pickup a item", "item"),
("get an item", "item"),
("take an item", "item"),
("grab an item", "item"),
("pick up an item", "item"),
("pickup an item", "item"),
]
pat = GetTrigger.pattern()
for (line, expected) in cases:
line = line.strip()
match = pat.fullmatch(line)
assert match is not None
assert match["item"] == expected
def test_use_item():
cases = [
("use item", "item"),
("use the item", "item"),
("use a item", "item"),
("use an item", "item"),
("use item", "item"),
("use the item", "item"),
("use a item", "item"),
("use an item", "item"),
("use an item", "item"),
]
pat = UseTrigger.pattern()
for (line, expected) in cases:
line = line.strip()
match = pat.fullmatch(line)
assert match is not None
assert match["item"] == expected
def test_use_item_with():
cases = [
("use item with other item", "item", "other item"),
("use the item with an other item", "item", "other item"),
("use a item with a other item", "item", "other item"),
("use an item with the other item", "item", "other item"),
("use item with other item", "item", "other item"),
("use the item with an other item", "item", "other item"),
("use a item with a other item", "item", "other item"),
("use an item with the other item", "item", "other item"),
]
pat = UseTrigger.pattern()
for (line, item, other_item) in cases:
match = pat.fullmatch(line)
assert match is not None
assert match["item"] == item
assert match["target"] == other_item
# TODO : put
# TODO : look