Monday, October 10, 2022
The Martian Business Calendar describes a hypothetical calendar for Mars. It's only marginally more complex than the Gregorian calendar we currently use and the tradeoffs made are interesting to read about (it includes a “leap week” instead of our “leap day” and the reasons for it are both rational and irrational at the same time, depending upon your point of view). But what I would like to see is a Venusian calendar—what tradeoffs have to be made as the Venusian day is longer than the Venusian year.
An answer to my question about unit tests
I was browsing Gemini when I came across a reponse to my unit test question:
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.
The easiest way to think of it in C is: assume make's view of the system.
That is not a bad answer for C. In fact, it's probably not a bad answer for several different languages. The only clarification I can see being made is to only test non-static functions (functions that have visibility outside the file they're defined in) and not have specific tests for static functions (functions that only have visibility to code in the C file) to allow greater flexibility in implemenation and prevent tests from breaking too often.