Jim Freeze wrote: > * James Britt <james_b / neurogami.com> [2005-04-28 07:33:00 +0900]: > > BTW, what should one do when given code that does not pass unit tests? > > Assume the main code is authoritative, and therefor correct, and change > > the unit test? > > I don't follow this from the previous comments. Unit tests are code, > not documentation. So, when a ut fails, you have two pieces of > code that disagree. Using Dave's language, one (or both) of the > peices of code have to be lying. :) Neither piece of code is lying. Code cannot lie. The unit test says, "Something is incorrect in this region." How you interpret this depends on the context. If the test worked, and you change something and it breaks, then you can assume yoru change caused the problem. If you are writing the test then taking a first cut at the method, then you need to examine both to figure out which one is not expressing the correct intent. But I suspect everyone allready knew this. :)