In most programming languages one has the equivalent of a functional test, that can test code and see if the required output is correct and find edge cases.
Is there a way to write similar tests, to see if a piece of LaTeX code satisfies a collection of tests?
A hypothetical example could be to automate testing of submitted LaTeX code for people doing an introductory course. A small case could be that students are required to include a set of packages, but this could for instance be done, one by one, or in bulk or out of order. So only robust way that makes sense to me is to have the equivalent of having the code included and actually run in a LaTeX environment, in order to have certain test cases pass, or fail, that could supply appropriate feedback.
Are such packages or a suggested approach available?