Cppunit test macro

Source: Internet
Author: User

The main test method is to write a part of the call according to the object to be tested.CodeAnd check the code. Check the code first to generate the expected value, and then call the assert macro check provided by cppunit. The macro provided by cppunit is as following

A) cppunit_assert (condition): determines whether the value of condition is true. If it is false, an error message is generated.

B)

C) cppunit_assert_message (message, condition): similar to cppunit_assert, but the messsage information is reported when the result is false.

D)

E) cppunit_fail (Message): directly reports the messsage error message.

F)

G) cppunit_assert_equal (expected, actual): determines whether the values of expected and actual are equal, if not, the output error message.

H)

I) cppunit_assert_cmd_message (message, expected, actual): similar to cppunit_assert_equal, but the message is output when the assertion fails.

J)

K) cppunit_assert_doubles_equal (expected, actual, Delta): determines whether the deviation between expected and actual is less than delta, used for floating point comparison.

L)

M) cppunit_assert_throw (expression, exceptiontype): determines whether to throw the exceptiontype exception after executing expression.

N)

O) cppunit_assert_no_throw (expression): No exception is thrown after the expression is executed by the assertion.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.