General Random Unit tests are by default disabled via a compiler flag to enable faster compilation times. They
can be enabled by setting PERFORMANCE_TESTS
in the Player Settings
( Edit -> Project Settings -> Player -> Script Compilation).
Random number generators need to be initialized with a seed. C# allows the creation of structs
by bypassing the
constructor. Please use any defined constructor or helper method like:
to construct the RNG.
Please make sure the struct is passed by reference and correctly initialized.
Unity Code Coverage plugin has a bug where it doesn’t report code coverage for all methods that rely on generics. These methods have to be validated manually, unfortunately. There are reports in the forum about this in 2022, but it doesn’t seem to be high in the unity priority list and still persists in Code Coverage 1.2.2.
Additionally, there is “dead” code in the RouletteDistribution, that is needed to silence a compiler warning.