Mon, 24 Jun 2019 00:51:04 +0300
added a test for mirrored studs
tests/subfiles.py | file | annotate | diff | comparison | revisions |
--- a/tests/subfiles.py Mon Jun 24 00:38:18 2019 +0300 +++ b/tests/subfiles.py Mon Jun 24 00:51:04 2019 +0300 @@ -278,11 +278,32 @@ ) break +@problem_type('mirrored-studs', + severity = 'warning', + message = lambda primitive: str.format( + '"{primitive}" should not be mirrored', + primitive = primitive, + ) +) +def mirrored_studs_test(model): + for subfile_reference in model.subfile_references: + # Test whether any stud subfile is mirrored. + # A subfile is mirrored if its determinant is negative. + if subfile_reference.subfile_path.startswith('stu') \ + and subfile_reference.subfile_path != 'stud4.dat' \ + and subfile_reference.matrix.determinant() < 0: + yield report_problem( + 'mirrored-studs', + bad_object = subfile_reference, + primitive = subfile_reference.subfile_path, + ) + manifest = { 'tests': [ determinant_test, scaling_legality_test, dependent_subfile_tests, category_test, + mirrored_studs_test, ], }