The test logic is to compare the actual and expected count in bins. This works as long as the actual and expected pdf's are properly normalized.
In the prior code this assumption failed when the upper and lower bin limits (given by gslt-lower-limit and gslt-upper-limit) were such that some of the PDF was left unsampled. Under those conditions, the tests in limits-check would never pass. For some distribution functions the tests took forever to complete because upon a failure test the number of samples would be doubled (up to 50 times, leading to a 10^15 increase in the number of points).
The proposed merge fixes to code so to satisfy this assumption. I also re-factored some code and added documentation.
After the change, all the tests run in a finite amount of time and pass as well.