Top "Assert" questions

An assertion is a statement, which aborts a program when it evaluates to false.

NSAssert vs. assert: Which do you use, and when?

I've read two really interesting pieces of advice, recently: In the comments to this StackOverflow answer, @Mike Weller says to …

objective-c assert
Does R have an assert statement as in python?

a statement that checks if something is true and if not prints a given error message and exits

r assert language-design assertions
Design by contract using assertions or exceptions?

When programming by contract a function or method first checks whether its preconditions are fulfilled, before starting to work on …

exception assert design-by-contract
How to check constructor arguments and throw an exception or make an assertion in a default constructor in Scala?

I would like to check constructor arguments and refuse to construct throwing IllegalArgumentException in case the arguments set is not …

scala exception constructor assert
What does assert(0) mean?

I had a question like this on one of my exams and I'm still not too sure how to answer …

c++ c assert assertion
Python : Assert that variable is instance method?

How can one check if a variable is an instance method or not? I'm using python 2.5. Something like this: class …

python methods instance assert
Is it bad practice to have more than one assertion in a unit test?

Is it bad practice to have more than one assertion in a unit test? Does it matter?

unit-testing assert
What's the difference between Assert.AreNotEqual and Assert.AreNotSame?

In C#, what's the difference between Assert.AreNotEqual and Assert.AreNotSame

c# .net unit-testing testing assert
Assert statement in Verilog

I'm completely new to Verilog, so bear with me. I'm wondering if there is an assert statement in Verilog. In …

assert verilog