💾 Archived View for gemini.ctrl-c.club › ~stack › gemlog › 2022-10-09.unit.gmi captured on 2023-06-16 at 17:10:39. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Re: What is a unit test

gemini://gemini.conman.org/boston/2022/10/08.1

Sean Conner poses this question.

The answer is actually more sensible in C than it was in Smalltalk: a unit is a compilation unit. In C, it is a file.

Any changes to source will require changes to a file. Once a source file is altered, it may screw something up in the resultant binary. Therefore, there should be a unit test to check that the altered unit behaves as expected.

Now, if it's a header, it may alter the behavior of many source units...

The easiest way to think of it in C is: assume make's view of the system.

Makefiles, if constructed as intended, identify units clearly, and all the headers they depend on (unless some coersive tool is used to hide this valuable information in exchange for convenience).

In better languages which allow compiling functions independently, a unit is more of whatever you want it to be...

I've never been able to keep the discipline of unit testing, and think it's kind of a bad idea, especially in more fluid interactive environments early in the project when things are changing.

index

home