Вопрос

What I should name of a function that quits execution a condition equals true ? Deny ? Is there a common established name ?

anti_assert(1=1, errmsg);

For me it is easier to go that way because then it is possible to do macro in c/c++ like:

#define anti_assert(expression) anti_assert(expresstion, #expression)

And then in log I have the fragment of code that triggered the issue.

Это было полезно?

Решение

I really like refute from Ruby's Minitest. Makes it instantly clear what we want (assert) vs what we don't want (refute).

Другие советы

check antonyms at http://thesaurus.com/browse/assert but i don't like any of that. if i had to choose one i would use 'prevent'. but i think it's not established because it's not needed. assertion in this form has less and less usage because it's not very readable. usually other forms are being used. example from java:

assertThat(actualValue).isEqualTo(expectedValue)
assertThat(actualValue).isNotEqualTo(expectedValue)
assertThat(actualValue).containsSubstring(substring)
assertThat(actualValue).has(feature)
assertThat(actualValue).is(expectedValue)

other languages have libraries allowing you to use similar syntax. in such form, you don't really need anything opposite to assert

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top