-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlifepaths.plt
63 lines (48 loc) · 1.93 KB
/
lifepaths.plt
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
:- begin_tests(lifepaths).
:- include(lifepaths).
%% Data consistency checks
test(all_lifepaths_have_valid_settings, all(Lp-Setting = [])) :-
lifepath(id(Lp, Setting)),
\+ setting(Setting, _).
test(all_settings_have_valid_stocks, all(Stock = [])) :-
findall(Stock, setting(_, Stock), AllStocks),
list_to_set(AllStocks, DistinctStocks),
member(Stock, DistinctStocks),
(\+ stock(Stock)).
page_in_range(Book, Page) :-
book(Book, PageRange),
member(range(Start, End), PageRange),
(Start =< Page, Page =< End).
test(all_lifepaths_have_valid_pages, all(_ = [])) :-
lifepath(_, page(Book, Number), _, _),
(\+ page_in_range(Book, Number)).
test(all_lifepaths_have_valid_leads, all(Lead = [])) :-
lifepath(id(_, SettingName), _, _, Leads),
member(Lead, Leads),
setting(SettingName, Stock),
\+ setting(Lead, Stock).
test(all_lifepath_providers_have_valid_lifepaths, all(Lp = [])) :-
findall(Name, lifepath_provides(Name, _), LpNames),
member(Lp, LpNames),
\+ lifepath(Lp).
test(all_lifepath_requirements_have_valid_lifepaths, all(Lp = [])) :-
findall(Name, lifepath_requires(Name, _), LpNames),
member(Lp, LpNames),
\+ lifepath(Lp).
test(no_lifepaths_have_trait_intimidation_or_skill_intimidating, [fail]) :-
lifepath_provides(_, trait(intimidation));
lifepath_provides(_, skill(intimidating)).
test(all_lifepaths_providing_flags_are_valid, all(ProvFails = [[]])) :-
findall(provider(Id, flag(F)), (
lifepath_provides(Id, flag(F)),
\+ flag(F)
), ProvFails).
test(all_lifepaths_requiring_flags_are_valid, all(ReqFails = [[]])) :-
findall(requirement(Id, flag(F)), (
lifepath_requires(Id, Reqs),
member(flag(F), Reqs),
\+ flag(F)
), ReqFails).
test(check_that_pages_didnt_get_transcribed_as_years, all(Fails = [[]])) :-
findall(Id, (lifepath(Id, _, Years, _), Years > 100), Fails).
:- end_tests(lifepaths).