Unit testing - how do I test a function that returns random output?

Posted by Extrakun on Stack Overflow See other posts from Stack Overflow or by Extrakun
Published on 2010-04-11T17:53:07Z Indexed on 2010/04/11 18:03 UTC
Read the original article Hit count: 267

Filed under:

I have a function which takes in two parameters, and returns one or the other 50% of the time.

The unit test for this should determine that both parameters could be returned. Luckily, I don't need to prove that the probability for each is 50% but I do need to show that both parameters are possible to be returned.

How do I write a test case for this function?

© Stack Overflow or respective owner

Related posts about unit-testing