4 ms·
I've been writing unit tests for over 15 years (actually longer, but before that they were just throwaway run-once testing stubs). I wouldn't consider what you
by wizofaus 3y ago
I've been writing unit tests for over 15 years (actually longer, but before that they were just throwaway run-once testing stubs). I wouldn't consider what you got ChatGPT to produce to be an adequate rewrite of a function to make it unit testable (and several others in this thread have expressed the same view). Even the "hack" using monkey patching makes for a more actually-useful test.
- byby 3y agoI've been writing them for over 20. Doesn't matter. What matters is factual correctness. See here what a unit test is versus integration test: https://www.testim.io/blog/unit-test-vs-integration-test/ https://www.testim.io/blog/unit-test-vs-integration-test/ And also see my reply to the other guy where I definitively show that not only is what chatgpt produced correct, but better: https://news.ycombinator.com/item?id=36064097 https://news.ycombinator.com/item?id=36064097
- wizofaus 3y agoI'm perfectly aware of what the difference is, thank you. The function you gave to ChatGPT explicitly requests a stream to format integers as decimals, separated by newlines. The version it gave as being 'unit-testable' did not, and hence wasn't a 'factually correct' answer. In some cases that may be perfectly fine, but in others it most definitely isn't.