What does DRC message "Assertion failure" mean?

The DRC in KiCad can give you a message “Assertion failure”, found in the source code in drc_item.cpp:

pcbnew/drc/drc_item.cpp · master · KiCad / KiCad Source Code / kicad · GitLab

Could someone give a “high level” explanation of the meaning of this, and what an “Assertion” is in the context of KiCad?

I haven’t been able to easily figure it out from a dictionary or a quick look at the source code, and would be thankful if someone could give me a hint to better understand how it works.

In future-V7 you can write custom DRC rules with assertions: Post-v6 new features and development news - #27 by JeffYoung

You would use an assertion for something that you think will always be true, but you want an error if it’s not. For example you could assert that a particular constraint is always set to a certain value. If it gets overridden in a way that you don’t expect, you’ll get a DRC error.

Ignore this if it is an unhelpful comparison, but this maps to the programming concept of an assertion, except you’re writing an assertion about your board design rather than a programmer writing an assertion about their code.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.