Which assertions can I use in the test case specification?
Sample model: Samples/CppSamples/TestConductor/TestingCookbook/ImprovedDebugging
TestConductor offers several pre-defined assertion macros. The code test case tc_using_different_assertion_macros shows how to use these assertion macros. When you execute the test case, you get an overview in which cases the assertions will pass and fail.
-
RTC_ASSERT (e)
Assertion with default name e. The assertion is PASSED, if the result of the boolean expression is TRUE (e!=0), otherwise the assertion FAILED.
-
RTC_ASSERT_FATAL (e)
Assertion with default name e. The assertion is PASSED, if the result of the boolean expression is TRUE (e!=0), otherwise the assertion FAILED. If it is failed, the test case is aborted immediately without executing further assertions.
-
RTC_ASSERT_NAME (n, e)
Named assertion. The user can define the name of the assertion within the argument n. The assertion is PASSED, if the result of the boolean expression is TRUE (e!=0), otherwise the assertion FAILED.
-
RTC_ASSERT_NAME _FATAL(n, e)
Named fatal assertion. The user can define the name of the assertion within the argument n. The assertion is PASSED, if the result of the boolean expression is TRUE (e!=0), otherwise the assertion FAILED. If it is failed, the test case is aborted immediately without executing further assertions.
-
RTC_ASSERT_TRUE (n, e)
This assertion is PASSED, if e == TRUE. Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_FALSE (n, e)
This assertion is PASSED, if e == FALSE. Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_EQUAL (n, e1, e2)
This assertion is PASSED, if e1 == e2. Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_NOT_EQUAL (n, e1, e2)
This assertion is PASSED, if e1 != e2. Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_PTR_EQUAL (n, e1, e2)
This assertion is PASSED, if pointer e1 and pointer e2 are equal (e1 == e2). Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_PTR_NOT_EQUAL (n, e1, e2)
This assertion is PASSED, if pointer e1 and pointer e2 not equal (e1 != e2). Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_PTR_NULL (n, e1)
This assertion is PASSED, if the pointer e1 is NULL. Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_PTR_NOT_NULL (n, e1)
This assertion is PASSED, if the pointer is not NULL. Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_CPTRSTRING_EQUAL (n, e1, e2)
This assertion is PASSED, if the string compare is equal (strcmp(e1,e2) == 0). Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_CPTRSTRING_NOT_EQUAL (n, e1, e2)
This assertion is PASSED, if the string compare is not equal (strcmp(e1,e2) != 0). Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_STRING_EQUAL (n, e1, e2)
This assertion is PASSED, if the comparison of the strings e1 and e2 is equal (e1 == e2). Otherwise the result of the assertion is FAILED.
-
RTC_ASSERT_STRING_NOT_EQUAL (n, e1, e2)
This assertion is PASSED, if the comparison of the strings e1 and e2 is not equal (e1 != e2). Otherwise the result of the assertion is FAILED.