Skip to content

Standardize assertions #64

@qmathe

Description

@qmathe

Currently we use assert(), ETAssert(), ETDebugAssert(), NSParameterAssert() and sometimes NSAssert() when we want a description.

imo, we should support two assertion levels:

  • release (95 % of the assertions)
  • debug (for relatively expansive checks that would slow down a release build a bit)

and possibly a third level:

  • paranoid or aggressive (for very expansive checks like validating an entire item graph… which slow down the test suite too much to be turned on all the time)

NSAssert machinery with NSAssertionHandler is useless in my experience and require a distinct macro inside C function, so we may be we could change ETAssert(), ETDebugAssert() and ETAssertUnreachable() to simply wrap assert(). Then we would support:

  • ETAssert
  • ETDebugAssert
  • may be ETValidationAssert, ETParanoidAssert or ETSlowAssert
    • might be easier to keep commented out code that we turn on when needed
  • ETAssertUnreachable

We could an ETAssert variation that takes a description and a variable number of arguments to replace NSAssert use cases we have currently.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions