|
#define | WIN_ASSERT_EQUAL(expected, actual, ...) WinUnit::Assert::AreEqual(TSTRING(expected), expected, TSTRING(actual), actual, __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_NOT_EQUAL(notExpected, actual, ...) WinUnit::Assert::AreNotEqual(TSTRING(notExpected), notExpected, TSTRING(actual), actual, __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_STRING_EQUAL(expected, actual, ...) WinUnit::Assert::StringEqual(expected, actual, __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_ZERO(zeroExpression, ...) WinUnit::Assert::IsZero(TSTRING(zeroExpression), zeroExpression, __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_NOT_ZERO(nonzeroExpression, ...) WinUnit::Assert::IsNotZero(TSTRING(nonzeroExpression), nonzeroExpression, __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_NULL(nullExpression, ...) WinUnit::Assert::IsNull(TSTRING(nullExpression), nullExpression, __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_NOT_NULL(notNullExpression, ...) WinUnit::Assert::IsNotNull(TSTRING(notNullExpression), notNullExpression, __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_FAIL(message, ...) WinUnit::Assert::Fail(__TFILE__, __LINE__, message, __VA_ARGS__) |
|
#define | WIN_ASSERT_TRUE(trueExpression, ...) WinUnit::Assert::IsTrue(TSTRING(trueExpression), (trueExpression ? true : false), __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_FALSE(falseExpression, ...) WinUnit::Assert::IsFalse(TSTRING(falseExpression), (falseExpression ? true : false), __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_WINAPI_SUCCESS(trueExpression, ...) WinUnit::Assert::WinapiSucceeded(TSTRING(trueExpression), (trueExpression ? true : false), __TFILE__, __LINE__, __VA_ARGS__) |
|
#define | WIN_ASSERT_THROWS(expression, exceptionType, ...) ¥ |
|
These are the "asserts" you will use to verify conditions which, if not true, indicate a test failure.
The WIN_ASSERT_* macros call similarly named Assert::* functions. While the Assert::* functions can be called without using the macros, the macros add value by including the file and line number and sometimes a string depiction of the expression(s) passed in.
The WIN_ASSERT_* macros all allow for an optional printf-style format string and parameters to be tacked on to the condition part of the assert. The Assert::* functions require at least one message string.
◆ WIN_ASSERT_EQUAL
The operator== is used to compare expected and actual; the test has failed if they are shown to be not equal.
- 引数
-
expected | The expected value. |
actual | The actual value, to be compared with expected. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_FAIL
This "test" always fails, displaying the given message.
- 引数
-
message | A printf-style format string (required). |
... | Optional parameters for the format string. |
◆ WIN_ASSERT_FALSE
The test fails if falseExpression evaluates to true.
- 引数
-
falseExpression | Expression expected to be false. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_NOT_EQUAL
The operator!= is used to compare notExpected and actual; the test has failed if they are shown to be equal.
- 引数
-
notExpected | The value not expected. |
actual | The actual value, to be compared with notExpected. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_NOT_NULL
The test fails if notNullExpression evaluates to NULL.
- 引数
-
notNullExpression | The expression that is expected to evaluate to a non-NULL value. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_NOT_ZERO
The test fails if nonzeroExpression evaluates to 0.
- 引数
-
nonzeroExpression | The expression that is expected to evaluate to a non-zero value. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_NULL
The test fails if nullExpression is not NULL.
- 引数
-
nullExpression | The expression that is expected to evaluate to NULL. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_STRING_EQUAL
A string-compare function (wcscmp or strcmp) is used to do a case-sensitive comparison of the two given strings (up to the first null character); the test has failed if they are not equal.
- 引数
-
expected | The expected string. |
actual | The actual string, to be compared with expected. |
.. | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_THROWS
#define WIN_ASSERT_THROWS |
( |
|
expression, |
|
|
|
exceptionType, |
|
|
|
... |
|
) |
| ¥ |
The test fails if expression does not throw an exception of type exceptionType.
- 引数
-
expression | Expression expected to throw exception. |
exceptionType | The exception type expected to be thrown. |
... | An optional printf-style format string and arguments |
◆ WIN_ASSERT_TRUE
The test fails if trueExpression does not evaluate to true.
- 引数
-
trueExpression | Expression expected to be true. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_WINAPI_SUCCESS
This assert is for testing for success of Windows API functions that require GetLastError() to be called for more information. Because the return value indicating success is not always the same for system functions, the value passed in should be an expression that evaluates to true if successful. Example: WIN_ASSERT_WINAPI_SUCCESS(0 != ::DeleteFile(_T("Foo"))); The string associated with the GetLastError() code is included in the exception message.
- 引数
-
trueExpression | Expression that should be true. |
... | An optional printf-style format string and arguments. |
◆ WIN_ASSERT_ZERO
The test fails if zeroExpression does not evaluate to 0.
- 引数
-
zeroExpression | The expression that is expected to evaluate to zero. |
... | An optional printf-style format string and arguments. |