brunomont's blog

By brunomont, 3 months ago, In English

Testcase generation for random inputs.

Hello, Codeforces!

Here I introduce tgen, a single-header C++ library (similar to jngen) for generating random and adversarial testcases for competitive programming problems.

Open tgen on GitHub

Header link · Documentation

Tgen supports lists, permutations, graphs, trees, strings, math, geometry, and more. Here are some examples:

Examples

There is a robust framework for distinct generation:

Distinct examples

Another important feature is adversarial generation, that is, worst-case generation (a.k.a. hacks).

Hack examples

Most of which inspired by Codeforces blogs. There is a feature/time comparison against jngen here.

Give it a try next time you are prepairing a problem! If there are any issues or feature requests, please open an issue on GitHub, and I will sort it out as soon as I can.

Extra: tgen miniblogs

Over the next few weeks, I will post a series of miniblogs discussing interesting mathematical and algorithmic problems that came up during the development of tgen. Stay tuned!

Acknowledgments

I would like to thank Roberio for encouraging me to work on this project, and some friends for the help in discussions: emaneru, bernardo_amorim, rafaelgo, kobus, VinnySJ. Finally, I want to thank ifsmirnov for the inspiring jngen project.

  • Vote: I like it
  • +134
  • Vote: I do not like it

»
3 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

prono is on fire 🔥

»
2 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Haven't try it yet but I can say that this will be sooo good