CFIXCC_ASSERT_EQUALS_MESSAGE allows typesafe comparison of values. Failed comparisons are treated as a failure, i.e. in the same manner as a failed CFIX_ASSERT. The benefit over using CFIX_ASSERT( Expected == Actual ) is that the expected and actual value will be visible in the failure report.
Unlike CFIXCC_ASSERT_EQUALS, CFIXCC_ASSERT_EQUALS_MESSAGE additionally allows a user defined message to be specified. This message will be contained in the failure report.
void CFIXCC_ASSERT_EQUALS_MESSAGE( __in T Expected, __in T Actual, __in PCWSTR Message, ... ); void CFIXCC_ASSERT_EQUALS_MESSAGE( __in T Expected, __in T Actual, __in PCSTR Message, ... );
T can be any type, but the types of both values must be compatible. See discussion below.
[in] Expected: The expected value.
[in] Actual: The actual value that is to be checked.
[in] Message: Message to be included in a failure report. This parameter allows printf-style formatters to be used. The routine is overloaded and allows Message to be either a unicode or an ANSI string.
For a discussion on how the comparisons is conducted, see CFIXCC_ASSERT_EQUALS.
CFIXCC_ASSERT_EQUALS_MESSAGE( 2.0f, FloatValue, "Comparing %f against 2.0", FloatValue );
|User Mode||Kernel Mode|
|Header||Declared in cfixcc.h||N/A|
|Library||Link to cfix.lib||N/A|
Note that due to the use of variadic macro arguments, at least cl 14.00 (Visual Studio 2005) is required to use the formatting capabilities of this routine. For downlevel compilers, Message is treated as-is (i.e. without formatting) and the variadic argument list has to be empty.