RagnarGrootKoerkamp / BAPCtools

Tools for developing ICPC-style programming contest problems.
GNU General Public License v3.0
49 stars 22 forks source link

Generator tests #312

Open RagnarGrootKoerkamp opened 1 year ago

RagnarGrootKoerkamp commented 1 year ago

Sometimes generators have bugs where they generate valid but unintended data, and you only find them after a while by inspecting the generated .in files manually.

Maybe we could come up with some simple and clean way to test that generators do what was intended. Maybe something like the following in generators.yaml:

tests:
  - command: linear_sequence.py 10 5
    contains: 
      - "0 5 10"
      - "45 50\n"

On the other hand, I'm not exactly sure how useful it is to only be able test for substring containment. But writing code to detect arbitrary patterns and executing that sounds like a lot of overhead.