I
I
ixSci2011-09-11 17:27:47
Unit testing
ixSci, 2011-09-11 17:27:47

How to combine UnitTest with C++ assert?

Let's say there is a function that receives a certain name. This name does not come from outside (from the user) and must obey certain rules. To ensure that the obscene name does not get to us, I make an assert, pseudocode:
void Foo(string)
{
assert(CheckName(string));

}
Question: is there a way to write a test case for Foo so that the assert will work and the test will pass?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Next_Alex, 2011-09-12
@Next_Alex

in my opinion, just override the assert macro itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question