On 4/21/22 6:26 PM, Alain De Vos wrote:
I don't know when to use a static assert and when to use a unit test ?

An assert in general is something that must be true for the program to be valid.

A normal assert is some runtime condition that must be true or the program will be terminated.

A static assert is some compile-time condition that must be true or the compilation will be terminated.

A unittest is a completely different thing -- this is testing generally a piece of your program (like a function), to ensure that given known inputs it returns known results. A unittest uses asserts to test that the results are valid.

-Steve

Reply via email to