Issue
I've never worked with the random library and I'm a bit confused about what this fixme statement is asking me to do. Is there a seed number that specifically does this?
The code is making an ordered list ADT and this file is testing the functions within that file. We use the random library to create random numbers that will be added into, or removed from the ordered list ADT.
Please let me know if there's any other information I should give!
Solution
When you set the seed
, as is done here, you should get a consistent set of random numbers afterwards.
If the numbers that you're getting are NOT consistent, then one of the following is true:
- You're using a different random number function somewhere so setting the seed didn't fix it.
- The test depends on external state, so it does different things on different runs.
- You're trying to compare running the entire test suite to testing a single function.
The right fix will depend on which of those is the issue.
- Find where you're using a different generator and either stop, or mock it out.
- Find the external state and set it or mock it out.
- Move setting the seed into a
setUp
method so that it is set fresh for every test.
My guess is that your problem is the last. But if it isn't, hopefully this answer gives you somewhere to start digging from.
Answered By - btilly
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.