Liskov principle and unittest

deadalnix deadalnix at gmail.com
Sun Sep 25 11:02:51 PDT 2011


>
> I think what he wants is to have automatically generated unittests for
> derived classes that check if the unittests of the parent still pass for
> them. I don't know of a nice way to do that without requiring some
> minimal effort by the implementor of the derived class. Contracts
> quickly detect and report otherwise potentially unnoticed bugs during
> test runs, but they don't provide the robustness of running actual unit
> tests. The two features can be combined very well though.
>

Yes, that's it.

Actually, I'm not blaming D, as I explained, the same problem exists 
with others languages.

Contract is a part of the solution, but not really the same as unittest. 
Indeed, contract are very compatible with Liskov's principle, but 
unittest isn't.

I just wanted to open up the discution on that.


More information about the Digitalmars-d mailing list