Unit testing for stochastic processes?

Viewed 1789

Is there a sane way to unit test a stochastic process? For example say that you have coded a simulator for a specific system model. The simulator works randomly based on the seeds of the rngs so the state of the system cannot be predicted and if it can be every test should bring the system to a specific state before it attempts to test any method of a class. Is there a better way to do this?

5 Answers

you need to find the Q0 and p00 for the system. p00 is the predicted state while qo is the calculated state.the predicted state can lead to find the recurrant system which is the smallest value, say k in the system.

If your model is stochastic, then you could treat output as a randomly generated sample. Then, in your unit testing function, you could perform some sort of hypothesis testing with confidence interval. If the test output is within the confidence bound, then the test is successful. However, there will be a possibility of generating false positive/false negative.

Related