4 ms·
My problem with this definition is what "tests a bit of code" means. For example, in a codebase I work on we use a custom sort function, and memory manager. We
by CJefferson 5y ago
My problem with this definition is what "tests a bit of code" means.
For example, in a codebase I work on we use a custom sort function, and memory manager. We have tests for both (as you would expect).
However, both sorting and allocation are fairly large pieces of code. Does that mean any test of any function which calls sort or allocates memory isn't a unit test, as it's (indirectly) using something much bigger than a single function? But "stubbing" out either sort, or memory allocation, seems stupid (the stub would just have to do the same thing).
- bckr 5y agoThat makes sense. My immediate reaction is: 1) focus on business logic: is your code "about" sorting and allocation, or could you treat those as built-ins? 2) It's OK if a function is calling other functions. The point is that it's a business-logic-level unit of functionality, which is smaller than a module or so. Ymmv. Maybe we should read the scriptures.