tests/misc.py

Sun, 23 Jun 2019 00:38:01 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 23 Jun 2019 00:38:01 +0300
changeset 73
9664583cd1c9
parent 71
4e24867a0110
child 74
831d9f81a48c
permissions
-rw-r--r--

added alias tests

62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
1 from testsuite import problem_type, report_problem
38
66c9591b733d added proper handling of syntax errors
Teemu Piippo <teemu@hecknology.net>
parents: 26
diff changeset
2 import linetypes
25
8990ac138cc2 added check for invalid colours
Santeri Piippo
parents:
diff changeset
3
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
4 @problem_type('bad-colour',
64
1c0884f5506e changed severity names to be better understood
Teemu Piippo <teemu@hecknology.net>
parents: 62
diff changeset
5 severity = 'hold',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
6 message = lambda colour_index, count: str.format(
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
7 'invalid colour {} used {} time(s)',
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
8 colour_index,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
9 count,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
10 ),
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
11 )
25
8990ac138cc2 added check for invalid colours
Santeri Piippo
parents:
diff changeset
12 def colours_test(model):
26
7c263b864371 Added command line option to list all checks.
Santeri Piippo
parents: 25
diff changeset
13 ''' Checks that all colours used in the part model are valid. '''
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
14 from collections import defaultdict
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
15 bad_colours = defaultdict(lambda: {'count': 0, 'first-occurrence': None})
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
16 for element in model.body:
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
17 if hasattr(element, 'colour') and not element.colour.is_valid:
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
18 bad_colours[element.colour.index]['count'] += 1
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
19 if not bad_colours[element.colour.index]['first-occurrence']:
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
20 bad_colours[element.colour.index]['first-occurrence'] = element
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
21 yield from [
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
22 report_problem(
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
23 'bad-colour',
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
24 bad_object = bad_colour['first-occurrence'],
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
25 colour_index = colour_index,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
26 count = bad_colour['count'],
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
27 )
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
28 for colour_index, bad_colour in bad_colours.items()
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
29 ]
25
8990ac138cc2 added check for invalid colours
Santeri Piippo
parents:
diff changeset
30
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
31 @problem_type('syntax-error',
64
1c0884f5506e changed severity names to be better understood
Teemu Piippo <teemu@hecknology.net>
parents: 62
diff changeset
32 severity = 'hold',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
33 message = lambda reason: str.format('syntax error: {}', reason),
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
34 )
38
66c9591b733d added proper handling of syntax errors
Teemu Piippo <teemu@hecknology.net>
parents: 26
diff changeset
35 def syntax_errors(model):
66c9591b733d added proper handling of syntax errors
Teemu Piippo <teemu@hecknology.net>
parents: 26
diff changeset
36 yield from (
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
37 report_problem('syntax-error',
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
38 bad_object = element,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
39 reason = element.reason
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
40 )
38
66c9591b733d added proper handling of syntax errors
Teemu Piippo <teemu@hecknology.net>
parents: 26
diff changeset
41 for element in model.body
66c9591b733d added proper handling of syntax errors
Teemu Piippo <teemu@hecknology.net>
parents: 26
diff changeset
42 if isinstance(element, linetypes.Error)
66c9591b733d added proper handling of syntax errors
Teemu Piippo <teemu@hecknology.net>
parents: 26
diff changeset
43 )
66c9591b733d added proper handling of syntax errors
Teemu Piippo <teemu@hecknology.net>
parents: 26
diff changeset
44
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
45 @problem_type('bad-header',
64
1c0884f5506e changed severity names to be better understood
Teemu Piippo <teemu@hecknology.net>
parents: 62
diff changeset
46 severity = 'hold',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
47 message = lambda reason: str.format('bad header: {}', reason),
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
48 )
47
4da025d0b283 added work on header check
Teemu Piippo <teemu@hecknology.net>
parents: 38
diff changeset
49 def bad_header(model):
4da025d0b283 added work on header check
Teemu Piippo <teemu@hecknology.net>
parents: 38
diff changeset
50 import header
4da025d0b283 added work on header check
Teemu Piippo <teemu@hecknology.net>
parents: 38
diff changeset
51 if isinstance(model.header, header.BadHeader):
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
52 yield report_problem(
47
4da025d0b283 added work on header check
Teemu Piippo <teemu@hecknology.net>
parents: 38
diff changeset
53 'bad-header',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
54 bad_object = model.body[model.header.index],
47
4da025d0b283 added work on header check
Teemu Piippo <teemu@hecknology.net>
parents: 38
diff changeset
55 reason = model.header.reason,
4da025d0b283 added work on header check
Teemu Piippo <teemu@hecknology.net>
parents: 38
diff changeset
56 )
4da025d0b283 added work on header check
Teemu Piippo <teemu@hecknology.net>
parents: 38
diff changeset
57
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
58 @problem_type('bfc-nocertify',
64
1c0884f5506e changed severity names to be better understood
Teemu Piippo <teemu@hecknology.net>
parents: 62
diff changeset
59 severity = 'hold',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
60 message = 'all new parts must be BFC certified',
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
61 )
48
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
62 def nocertify_test(model):
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
63 import header
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
64 if model.header.valid and model.header.bfc == 'NOCERTIFY':
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
65 yield report_problem(
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
66 'bfc-nocertify',
69
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
67 bad_object = model.find_first_header_object('bfc'),
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
68 )
48
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
69
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
70 @problem_type('physical-colour-part',
64
1c0884f5506e changed severity names to be better understood
Teemu Piippo <teemu@hecknology.net>
parents: 62
diff changeset
71 severity = 'hold',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
72 message = 'no new physical colour parts are accepted',
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
73 )
48
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
74 def physical_colours_test(model):
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
75 if model.header.valid and 'Physical_Colour' in model.header.qualifiers:
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
76 yield report_problem(
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
77 'physical-colour-part',
69
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
78 bad_object = model.find_first_header_object('part type'),
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
79 )
48
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
80
66
e28b249b4422 Fix unofficial part test
Teemu Piippo <teemu@hecknology.net>
parents: 64
diff changeset
81 @problem_type('unofficial-part',
64
1c0884f5506e changed severity names to be better understood
Teemu Piippo <teemu@hecknology.net>
parents: 62
diff changeset
82 severity = 'hold',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
83 message = 'new parts must be unofficial',
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
84 )
48
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
85 def unofficiality_test(model):
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
86 if model.header.valid and not model.header.filetype.startswith('Unofficial_'):
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
87 yield report_problem(
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
88 'unofficial-part',
69
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
89 bad_object = model.find_first_header_object('part type')
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
90 )
48
38b0919c1934 added some header tests
Teemu Piippo <teemu@hecknology.net>
parents: 47
diff changeset
91
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
92 @problem_type('primitive-ccw',
64
1c0884f5506e changed severity names to be better understood
Teemu Piippo <teemu@hecknology.net>
parents: 62
diff changeset
93 severity = 'hold',
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
94 message = 'primitives must have CCW winding',
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
95 )
68
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
96 @problem_type('no-bfc-line',
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
97 severity = 'hold',
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
98 message = 'BFC declaration is missing',
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
99 )
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
100 def header_bfc_test(model):
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
101 if model.header.valid and not model.header.bfc:
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
102 yield report_problem(
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
103 'no-bfc-line',
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
104 bad_object = model.body[0],
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
105 )
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
106 elif model.header.valid \
50
0193f8820ba8 added primitive CCW test
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
107 and model.header.filetype.endswith('Primitive') \
0193f8820ba8 added primitive CCW test
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
108 and model.header.bfc != 'CERTIFY CCW':
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
109 yield report_problem(
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
110 'primitive-bfc-ccw',
69
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
111 bad_object = model.find_first_header_object('bfc'),
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
112 )
50
0193f8820ba8 added primitive CCW test
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
113
69
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
114 @problem_type('keywords-for-nonparts',
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
115 severity = 'warning',
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
116 message = lambda type: str.format(
71
4e24867a0110 fix capitalization
Teemu Piippo <teemu@hecknology.net>
parents: 70
diff changeset
117 'keywords are not allowed for {type} files',
69
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
118 type = type,
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
119 ),
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
120 )
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
121 def keywords_tests(model):
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
122 if model.header.valid:
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
123 if model.header.keywords \
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
124 and model.header.effective_filetype != 'Part':
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
125 yield report_problem(
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
126 'keywords-for-nonparts',
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
127 bad_object = model.find_first_header_object('keywords'),
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
128 type = model.header.effective_filetype,
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
129 )
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
130
70
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
131 @problem_type('bad-colour-24-nonline',
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
132 severity = 'hold',
71
4e24867a0110 fix capitalization
Teemu Piippo <teemu@hecknology.net>
parents: 70
diff changeset
133 message = 'colour 24 used on non-lines',
70
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
134 )
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
135 @problem_type('bad-colour-24-line',
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
136 severity = 'hold',
71
4e24867a0110 fix capitalization
Teemu Piippo <teemu@hecknology.net>
parents: 70
diff changeset
137 message = 'line with colour other than 24',
70
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
138 )
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
139 def colour_24_test(model):
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
140 for element in model.body:
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
141 if hasattr(element, 'colour'):
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
142 is_line = isinstance(element, linetypes.LineSegment)
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
143 if not is_line and element.colour.index == 24:
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
144 yield report_problem('bad-colour-24-nonline', bad_object = element)
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
145 if is_line and element.colour.index != 24:
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
146 yield report_problem('bad-colour-24-line', bad_object = element)
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
147
25
8990ac138cc2 added check for invalid colours
Santeri Piippo
parents:
diff changeset
148 manifest = {
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
149 'tests': [
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
150 colours_test,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
151 syntax_errors,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
152 bad_header,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
153 nocertify_test,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
154 physical_colours_test,
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
155 unofficiality_test,
68
c19dd0d3248e complain about missing BFC declarations
Teemu Piippo <teemu@hecknology.net>
parents: 66
diff changeset
156 header_bfc_test,
69
a24c4490d9f2 added a check for keywords in non-parts
Teemu Piippo <teemu@hecknology.net>
parents: 68
diff changeset
157 keywords_tests,
70
2453681c6a69 added tests for colour 24 usage
Teemu Piippo <teemu@hecknology.net>
parents: 69
diff changeset
158 colour_24_test,
62
f0a6bf48b05e Problem reporting revamp, program is now aware of its problem types
Teemu Piippo <teemu@hecknology.net>
parents: 50
diff changeset
159 ],
25
8990ac138cc2 added check for invalid colours
Santeri Piippo
parents:
diff changeset
160 }

mercurial