-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtests.py
64 lines (45 loc) · 1.76 KB
/
tests.py
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
# -*- coding: utf-8 -*-
from __future__ import print_function
from collections import Counter
import os
import suites
from suites import *
REPO = os.path.abspath(os.path.dirname(__file__))
def _get_domains():
return sorted(
domain
for domain in os.listdir(REPO)
if os.path.isdir(os.path.join(REPO, domain)) and
not domain.startswith((".", "_")) and
domain != "unofficial-reformulations")
def test_for_duplicates():
for funcname in dir(suites):
if not funcname.startswith('suite_'):
continue
print('Test', funcname)
func = getattr(suites, funcname)
domains = func()
assert domains == sorted(domains)
assert len(set(domains)) == len(domains), Counter(domains)
def test_suite_satisficing():
assert (
set(suite_satisficing_adl() + suite_satisficing_strips()) ==
set(suite_ipc98_to_ipc04() + suite_ipc06() +
suite_ipc06_strips_compilations() + suite_ipc08_sat() +
suite_ipc11_sat() + suite_ipc14_sat() + suite_ipc18_sat() +
suite_ipc23_sat()))
def test_suite_optimal():
assert (
set(suite_optimal_adl() + suite_optimal_strips()) ==
set(suite_ipc98_to_ipc04() + suite_ipc06() +
suite_ipc06_strips_compilations() + suite_ipc08_opt() +
suite_ipc11_opt() + suite_ipc14_opt() + suite_ipc18_opt() +
suite_ipc23_opt()))
def test_all_domains_covered():
assert set(suite_all()) == set(_get_domains())
def test_file_endings():
for path in _get_domains():
for filename in sorted(os.listdir(path)):
assert filename.endswith(".pddl"), (path, filename)
def test_all_domains_in_domain_to_tags():
assert set(DOMAIN_TO_TAGS.keys()) == set(_get_domains())