Skip to main content
bdrx's user avatar
bdrx's user avatar
bdrx's user avatar
bdrx
  • Member for 10 years, 3 months
  • Last seen more than a month ago
  • United States
awarded
awarded
comment
What are good unit tests to cover the use case of rolling a die?
I don't understand why you would want to ensure that mocked_randint is called_with certain values. I understand wanting to mock randint to return predictable values, but isn't the concern just that it returns predictable values and not what values it is called with? It seems to me that checking the called values is unnecessarily tying the test to fine details of implementation. Also why do we care that the die returns the exact value of randint? Don't we really just care that it returns a value > 1 and less than equal to the max?
comment
What are good unit tests to cover the use case of rolling a die?
Say you mock the RNG to be predictable. Well what do you then test? The question asks "Would the following be valid/useful unit tests?" Mocking it to return 0-5 is not a test but rather test setup. How would you "unit test accordingly"? I am failing to understand how it "does catch bugs". I am having a hard time understanding what I need to 'unit' test.
comment
Is having 'Util' classes a cause for concern?
Why would you call it Strings instead of StringUtil(s)? Strings to me sounds like a collection object.
awarded
awarded