12#error "Compiler not supported. WinUnit requires at least Microsoft Visual C++ compiler version 9"
100#define MAX_ASSERT_MESSAGE_LENGTH 1024
103#define MAX_TRACE_MESSAGE_LENGTH 1024
107#define MAX_EXPRESSION_STRING 256
112#define MAX_SYSERROR_STRING 120
114#define EMIT_ERROR(...) ¥
115 ::_snwprintf_s(__winUnit_buffer, __winUnit_cchBuffer, _TRUNCATE, __VA_ARGS__);
¥
118#define BEGIN_TEST_FUNC(x) extern "C" __declspec(dllexport) bool __cdecl TEST_##x(wchar_t* __winUnit_buffer, size_t __winUnit_cchBuffer) {
119#define BEGIN_FIXTURE_BLOCK(fixtureName) try { FIXTURE_##fixtureName __fixture_##fixtureName;
120#define BEGIN_TEST_BLOCK try
121#define END_TEST_BLOCK ¥
132#define END_FIXTURE_BLOCK ¥
140 EMIT_ERROR(L
"%s(%d): Exception thrown in fixture.",
¥
144#define END_TEST_FUNC return true; }
152#define BEGIN_TEST(x) BEGIN_TEST_FUNC(x) BEGIN_TEST_BLOCK
162#define END_TEST END_TEST_BLOCK END_TEST_FUNC
169#define BEGIN_TESTF(x, f) BEGIN_TEST_FUNC(x) BEGIN_FIXTURE_BLOCK(f) BEGIN_TEST_BLOCK
173#define END_TESTF END_TEST_BLOCK END_FIXTURE_BLOCK END_TEST_FUNC
191#define WINUNIT_WIDEN2(x) L ## x
192#define WINUNIT_WIDEN(x) WINUNIT_WIDEN2(x)
195#define __WFILE__ WINUNIT_WIDEN(__FILE__)
197#pragma message("WinUnit.h: __WFILE__ already defined")
201#define __WFUNCTION__ WINUNIT_WIDEN(__FUNCTION__)
203#pragma message("WinUnit.h: __WFUNCTION__ already defined")
208#define TSTRING(x) WINUNIT_WIDEN(#x)
209#define __TFILE__ __WFILE__
210#define __TFUNCTION__ __WFUNCTION__
213#define __TFILE__ __FILE__
214#define __TFUNCTION__ __FUNCTION__
217#pragma region WIN_ASSERT_* macros
230#define WIN_ASSERT_EQUAL(expected, actual, ...) WinUnit::Assert::AreEqual(TSTRING(expected), expected, TSTRING(actual), actual, __TFILE__, __LINE__, __VA_ARGS__)
243#define WIN_ASSERT_NOT_EQUAL(notExpected, actual, ...) WinUnit::Assert::AreNotEqual(TSTRING(notExpected), notExpected, TSTRING(actual), actual, __TFILE__, __LINE__, __VA_ARGS__)
257#define WIN_ASSERT_STRING_EQUAL(expected, actual, ...) WinUnit::Assert::StringEqual(expected, actual, __TFILE__, __LINE__, __VA_ARGS__)
263#define WIN_ASSERT_ZERO(zeroExpression, ...) WinUnit::Assert::IsZero(TSTRING(zeroExpression), zeroExpression, __TFILE__, __LINE__, __VA_ARGS__)
269#define WIN_ASSERT_NOT_ZERO(nonzeroExpression, ...) WinUnit::Assert::IsNotZero(TSTRING(nonzeroExpression), nonzeroExpression, __TFILE__, __LINE__, __VA_ARGS__)
278#define WIN_ASSERT_NULL(nullExpression, ...) WinUnit::Assert::IsNull(TSTRING(nullExpression), nullExpression, __TFILE__, __LINE__, __VA_ARGS__)
287#define WIN_ASSERT_NOT_NULL(notNullExpression, ...) WinUnit::Assert::IsNotNull(TSTRING(notNullExpression), notNullExpression, __TFILE__, __LINE__, __VA_ARGS__)
294#define WIN_ASSERT_FAIL(message, ...) WinUnit::Assert::Fail(__TFILE__, __LINE__, message, __VA_ARGS__)
300#define WIN_ASSERT_TRUE(trueExpression, ...) WinUnit::Assert::IsTrue(TSTRING(trueExpression), (trueExpression ? true : false), __TFILE__, __LINE__, __VA_ARGS__)
306#define WIN_ASSERT_FALSE(falseExpression, ...) WinUnit::Assert::IsFalse(TSTRING(falseExpression), (falseExpression ? true : false), __TFILE__, __LINE__, __VA_ARGS__)
319#define WIN_ASSERT_WINAPI_SUCCESS(trueExpression, ...) WinUnit::Assert::WinapiSucceeded(TSTRING(trueExpression), (trueExpression ? true : false), __TFILE__, __LINE__, __VA_ARGS__)
329#define WIN_ASSERT_THROWS(expression, exceptionType, ...) ¥
331 bool __thrown =
false;
¥
332 try { (expression); }
¥
333 catch(exceptionType&) { __thrown =
true; }
¥
336 __thrown,
__TFILE__, __LINE__, __VA_ARGS__);
¥
341#pragma region Setup/Teardown helpers
356 FIXTURE_##x() { Setup(); }
¥
357 ‾FIXTURE_##x() { Teardown(); }
¥
369#define SETUP(x) void FIXTURE_##x::Setup()
380#define TEARDOWN(x) void FIXTURE_##x::Teardown()
384#pragma region AssertException and friends
422#define AssertExceptionT AssertExceptionW<MAX_ASSERT_MESSAGE_LENGTH>
424#define AssertExceptionT AssertExceptionA<MAX_ASSERT_MESSAGE_LENGTH>
427#ifndef EXCLUDE_FROM_DOCUMENTATION
436 template<
size_t size=MAX_ASSERT_MESSAGE_LENGTH>
459 wchar_t* AvailableBufferStart;
465 size_t AvailableBufferLength;
471 size_t MessageLength;
480 template<
size_t size=MAX_ASSERT_MESSAGE_LENGTH>
494#pragma region Assert class definition
506 template <
class T,
class U>
508 const TCHAR* expectedExpressionString,
const T& expectedExpressionValue,
509 const TCHAR* actualExpressionString,
const U& actualExpressionValue,
510 const TCHAR* fileName,
int lineNumber,
511 const TCHAR* message = NULL, ...);
514 template <
class T,
class U>
516 const TCHAR* notExpectedExpressionString,
const T& notExpectedExpressionValue,
517 const TCHAR* actualExpressionString,
const U& actualExpressionValue,
518 const TCHAR* fileName,
int lineNumber,
519 const TCHAR* message = NULL, ...);
523 const wchar_t* expected,
const wchar_t* actual,
524 const TCHAR* fileName,
int lineNumber,
525 const TCHAR* message = NULL, ...);
528 const char* expected,
const char* actual,
529 const TCHAR* fileName,
int lineNumber,
530 const TCHAR* message = NULL, ...);
534 static void IsZero(
const TCHAR* zeroExpressionString,
const T& zeroExpression,
535 const TCHAR* fileName,
int lineNumber,
536 const TCHAR* message = NULL, ...);
540 static void IsNotZero(
const TCHAR* nonzeroExpressionString,
const T& nonzeroExpression,
541 const TCHAR* fileName,
int lineNumber,
542 const TCHAR* message = NULL, ...);
546 static void IsNull(
const TCHAR* expressionString, T* nullExpression,
547 const TCHAR* fileName,
int lineNumber,
548 const TCHAR* message = NULL, ...);
552 static void IsNotNull(
const TCHAR* notNullExpressionString, T* notNullExpression,
553 const TCHAR* fileName,
int lineNumber,
554 const TCHAR* message = NULL, ...);
557 static void Fail(
const TCHAR* fileName,
int lineNumber,
558 const TCHAR* message = NULL, ...);
561 static void IsTrue(
const TCHAR* expressionString,
bool trueExpression,
562 const TCHAR* fileName,
int lineNumber,
563 const TCHAR* message = NULL, ...);
566 static void IsFalse(
const TCHAR* expressionString,
bool falseExpression,
567 const TCHAR* fileName,
int lineNumber,
568 const TCHAR* message = NULL, ...);
573 const TCHAR* fileName,
int lineNumber,
574 const TCHAR* message = NULL, ...);
578 const TCHAR* expressionString,
579 const TCHAR* exceptionType,
580 bool exceptionWasThrown,
581 const TCHAR* fileName,
int lineNumber,
582 const TCHAR* message = NULL, ...);
590#pragma region Assert implementation
595template <
class T,
class U>
597 const TCHAR* expectedExpressionString,
const T& expectedExpressionValue,
598 const TCHAR* actualExpressionString,
const U& actualExpressionValue,
599 const TCHAR* fileName,
int lineNumber,
600 const TCHAR* message , ...)
606 if (expectedExpressionValue == actualExpressionValue) {
return; }
612 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_EQUAL failed. Expected: <%s> (¥"%s¥
"); Actual: <%s> (¥"%s¥
"). "),
615 ToString(expectedExpressionValue, buffer1, ARRAYSIZE(buffer1)),
616 expectedExpressionString,
617 ToString(actualExpressionValue, buffer2, ARRAYSIZE(buffer2)),
618 actualExpressionString);
623 va_start(args, message);
624 exception.AppendMessage(message, args);
632template <
class T,
class U>
634 const TCHAR* notExpectedExpressionString,
const T& notExpectedExpressionValue,
635 const TCHAR* actualExpressionString,
const U& actualExpressionValue,
636 const TCHAR* fileName,
int lineNumber,
637 const TCHAR* message , ...)
643 if (notExpectedExpressionValue != actualExpressionValue) {
return; }
648 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_NOT_EQUAL failed. ¥"%s¥
" and ¥"%s¥
" were expected different, but were same (<%s>). "),
651 notExpectedExpressionString,
652 actualExpressionString,
653 ToString(notExpectedExpressionValue, buffer1, ARRAYSIZE(buffer1)));
658 va_start(args, message);
659 exception.AppendMessage(message, args);
668 const wchar_t* expected,
const wchar_t* actual,
669 const TCHAR* fileName,
int lineNumber,
670 const TCHAR* message , ...)
672 if (::wcscmp(expected, actual) == 0) {
return; }
675 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_STRING_EQUAL failed. "),
676 fileName, lineNumber);
678 wchar_t* formatString = L
"Expected: <¥"%s¥
">; Actual: <¥"%s¥
">. ";
680 char* formatString =
"Expected: <¥"%S¥
">; Actual: <¥"%S¥
">. ";
682 exception.AppendMessage(formatString, expected, actual);
687 va_start(args, message);
688 exception.AppendMessage(message, args);
696 const char* expected,
const char* actual,
697 const TCHAR* fileName,
int lineNumber,
698 const TCHAR* message , ...)
700 if (::strcmp(expected, actual) == 0) {
return; }
703 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_STRING_EQUAL failed. "),
704 fileName, lineNumber);
706 wchar_t* formatString = L
"Expected: <¥"%S¥
">; Actual: <¥"%S¥
">. ";
708 char* formatString =
"Expected: <¥"%s¥
">; Actual: <¥"%s¥
">. ";
710 exception.AppendMessage(formatString, expected, actual);
715 va_start(args, message);
716 exception.AppendMessage(message, args);
725inline void Assert::IsZero(
const TCHAR* zeroExpressionString,
const T& zeroExpression,
726 const TCHAR* fileName,
int lineNumber,
727 const TCHAR* message , ...)
729 if (zeroExpression == 0) {
return; }
734 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_ZERO failed: ¥"%s¥
" expected to be zero, but was <%s>. "),
735 fileName, lineNumber,
736 zeroExpressionString,
737 ToString(zeroExpression, buffer, ARRAYSIZE(buffer)));
742 va_start(args, message);
743 exception.AppendMessage(message, args);
753 const TCHAR* nonzeroExpressionString,
const T& nonzeroExpression,
754 const TCHAR* fileName,
int lineNumber,
755 const TCHAR* message , ...)
757 if (nonzeroExpression != 0) {
return; }
760 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_NOT_ZERO failed: ¥"%s¥
". "),
761 fileName, lineNumber,
762 nonzeroExpressionString);
767 va_start(args, message);
768 exception.AppendMessage(message, args);
778 const TCHAR* fileName,
int lineNumber,
779 const TCHAR* message , ...)
781 if (nullExpression == NULL) {
return; }
786 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_NULL failed: ¥"%s¥
" expected to be NULL, but was <%s>. "),
787 fileName, lineNumber,
789 ToString(nullExpression, buffer, _countof(buffer)));
794 va_start(args, message);
795 exception.AppendMessage(message, args);
805 const TCHAR* notNullExpressionString, T* notNullExpression,
806 const TCHAR* fileName,
int lineNumber,
807 const TCHAR* message , ...)
809 if (notNullExpression != NULL) {
return; }
812 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_NOT_NULL failed: ¥"%s¥
". "),
813 fileName, lineNumber,
814 notNullExpressionString);
819 va_start(args, message);
820 exception.AppendMessage(message, args);
829 const TCHAR* message, ...)
832 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_FAIL failed. "),
837 va_start(args, message);
838 exception.AppendMessage(message, args);
846 const TCHAR* expressionString,
bool expression,
847 const TCHAR* fileName,
int lineNumber,
848 const TCHAR* message, ...)
850 if (expression) {
return; }
853 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_TRUE failed: ¥"%s¥
". "), fileName, lineNumber, expressionString);
858 va_start(args, message);
859 exception.AppendMessage(message, args);
868 const TCHAR* fileName,
int lineNumber,
869 const TCHAR* message , ...)
871 if (!falseExpression) {
return; }
874 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_FALSE failed: ¥"%s¥
". "), fileName, lineNumber, expressionString);
879 va_start(args, message);
880 exception.AppendMessage(message, args);
889 const TCHAR* expressionString,
891 const TCHAR* fileName,
int lineNumber,
892 const TCHAR* message , ...)
894 if (success) {
return; }
897 DWORD error = ::GetLastError();
900 DWORD charsWritten = FormatMessage(
901 FORMAT_MESSAGE_FROM_SYSTEM,
904 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
909 if (charsWritten > 0 &&
910 errorBuffer[charsWritten - 1] == _T(
'¥n') &&
911 errorBuffer[charsWritten - 2] == _T(
'¥r'))
913 errorBuffer[charsWritten - 2] = _T(
'¥0');
917 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_WINAPI_SUCCESS failed: ¥"%s¥
". (%s) "),
918 fileName, lineNumber, expressionString, errorBuffer);
923 va_start(args, message);
924 exception.AppendMessage(message, args);
933 const TCHAR* expressionString,
934 const TCHAR* exceptionType,
935 bool exceptionWasThrown,
936 const TCHAR* fileName,
int lineNumber,
937 const TCHAR* message , ...)
939 if (exceptionWasThrown) {
return; }
943 exception.AppendMessage(_T(
"%s(%d): error : WIN_ASSERT_THROWS failed: Exception %s not thrown by ¥"%s¥
". "),
944 fileName, lineNumber,
945 exceptionType, expressionString);
950 va_start(args, message);
951 exception.AppendMessage(message, args);
961#pragma region AssertExceptionT implementation
963#ifndef EXCLUDE_FROM_DOCUMENTATION
985 va_start(args, message);
987 this->AppendMessage(message, args);
995 if (this->AvailableBufferLength == 0) {
return; }
997 int cchWritten = _vsnwprintf_s(
998 this->AvailableBufferStart,
999 this->AvailableBufferLength,
1008 if (cchWritten == -1)
1010 this->MessageLength = size - 1;
1014 this->MessageLength += cchWritten;
1018template<
size_t size>
1022 va_start(args, message);
1023 this->AppendMessage(message, args);
1027template<
size_t size>
1035 const int bufferSize = (size < INT_MAX) ? size : INT_MAX;
1036 char bufferA[bufferSize] =
"";
1038 int cchWritten = ::vsnprintf_s(
1039 bufferA, bufferSize, _TRUNCATE, message, args);
1041 int availableBufferLength = (int)(this->AvailableBufferLength);
1043 ((cchWritten == -1 || cchWritten > availableBufferLength - 1) ?
1044 availableBufferLength - 1 :
1047 int cchConverted = ::MultiByteToWideChar(CP_ACP, 0,
1048 bufferA, bytesToWrite,
1049 this->AvailableBufferStart, availableBufferLength);
1052 if (cchConverted != 0)
1054 this->MessageLength += cchConverted;
1061#pragma region ToString implementation
1069inline const TCHAR*
ToString(
const T& , TCHAR buffer[],
size_t bufferSize)
1071 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%s"), _T(
"[OBJECT]"));
1077inline const TCHAR*
ToString(T*
object, TCHAR buffer[],
size_t bufferSize)
1079 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"0x%0*p"),
sizeof(
void*) * 2, (
void*)
object);
1084#ifndef BOOL_NOT_DEFINED
1086inline const TCHAR*
ToString(
const bool&
object, TCHAR buffer[],
size_t bufferSize)
1088 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%s"), (
object ? _T(
"true") : _T(
"false")));
1094inline const TCHAR*
ToString(
const signed char&
object, TCHAR buffer[],
size_t bufferSize)
1096 bool isPrintable = (int)
object >= 0 && (
int)
object <= 0xFF && isprint((
int)
object);
1097 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"'%lc' [%i]"),
1098 isPrintable ?
object :
'.', object);
1103inline const TCHAR*
ToString(
const unsigned char&
object, TCHAR buffer[],
size_t bufferSize)
1105 bool isPrintable = (int)
object >= 0 && (
int)
object <= 0xFF && isprint((
int)
object);
1106 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"'%lc' [0x%02X]"),
1107 isPrintable ?
object :
'.', object);
1112inline const TCHAR*
ToString(
const char&
object, TCHAR buffer[],
size_t bufferSize)
1114 bool isPrintable = (int)
object >= 0 && (
int)
object <= 0xFF && isprint((
int)
object);
1115 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"'%lc' [%i]"),
1116 isPrintable ?
object :
'.', object);
1120#ifdef _NATIVE_WCHAR_T_DEFINED
1122inline const TCHAR*
ToString(
const wchar_t&
object, TCHAR buffer[],
size_t bufferSize)
1124 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"'%wc' [0x%04X]"),
1125 iswprint(
object) ?
object : L
'.', object);
1131inline const TCHAR*
ToString(
const __int16&
object, TCHAR buffer[],
size_t bufferSize)
1133 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%ld"),
object);
1138inline const TCHAR*
ToString(
const unsigned __int16&
object, TCHAR buffer[],
size_t bufferSize)
1140 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%lu [0x%04lX]"),
object,
object);
1145inline const TCHAR*
ToString(
const __int32&
object, TCHAR buffer[],
size_t bufferSize)
1147 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%d"),
object);
1152inline const TCHAR*
ToString(
const unsigned __int32&
object, TCHAR buffer[],
size_t bufferSize)
1154 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%u [0x%08X]"),
object,
object);
1159inline const TCHAR*
ToString(
const long&
object, TCHAR buffer[],
size_t bufferSize)
1161 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%d"),
object);
1166inline const TCHAR*
ToString(
const unsigned long&
object, TCHAR buffer[],
size_t bufferSize)
1168 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%u [0x%0*X]"),
object,
sizeof(
object) * 2,
object);
1173inline const TCHAR*
ToString(
const __int64&
object, TCHAR buffer[],
size_t bufferSize)
1175 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%I64i"),
object);
1180inline const TCHAR*
ToString(
const unsigned __int64&
object, TCHAR buffer[],
size_t bufferSize)
1182 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%I64u [0x%0*I64X]"),
object,
sizeof(
object) * 2,
object);
1187inline const TCHAR*
ToString(
const float&
object, TCHAR buffer[],
size_t bufferSize)
1189 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%G"),
object);
1194inline const TCHAR*
ToString(
const double&
object, TCHAR buffer[],
size_t bufferSize)
1196 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%G"),
object);
1201inline const TCHAR*
ToString(
const long double&
object, TCHAR buffer[],
size_t bufferSize)
1203 ::_sntprintf_s(buffer, bufferSize, _TRUNCATE, _T(
"%G"),
object);
1223#define WIN_TRACE(x, ...) WinUnit::Trace(x, __VA_ARGS__)
1229 void Trace(
const wchar_t* formatString, ...);
1230 void Trace(
const char* formatString, ...);
1233 inline void Trace(
const wchar_t* formatString, ...)
1237 va_start(args, formatString);
1239 ::_vsnwprintf_s(buffer, _countof(buffer), _TRUNCATE,
1240 formatString, args);
1243 OutputDebugStringW(buffer);
1247 inline void Trace(
const char* formatString, ...)
1251 va_start(args, formatString);
1253 _vsnprintf_s(buffer, _countof(buffer), _TRUNCATE,
1254 formatString, args);
1257 OutputDebugStringA(buffer);
1263#pragma region Environment
1272 static bool GetVariable(
const TCHAR* variableName,
1273 TCHAR buffer[], DWORD bufferSize,
1274 DWORD* pSizeNeeded = NULL);
1282 const TCHAR* variableName,
1285 DWORD* pSizeNeeded )
1288 DWORD charCount = GetEnvironmentVariable(variableName, buffer, bufferSize);
1289 if (pSizeNeeded != NULL)
1291 *pSizeNeeded = charCount;
1293 return (charCount > 0 && charCount < bufferSize);
#define TSTRING(x)
Definition WinUnit.h:212
#define AssertExceptionT
Definition WinUnit.h:424
#define MAX_SYSERROR_STRING
Definition WinUnit.h:112
#define MAX_TRACE_MESSAGE_LENGTH
Definition WinUnit.h:103
#define __WFILE__
Definition WinUnit.h:195
#define MAX_EXPRESSION_STRING
Definition WinUnit.h:107
#define EMIT_ERROR(...)
Definition WinUnit.h:114
#define __TFILE__
Definition WinUnit.h:213
AssertExceptionA & operator=(AssertExceptionA &)
void AppendMessage(const char *message,...)
Definition WinUnit.h:1019
wchar_t _buffer[size]
Definition WinUnit.h:442
wchar_t * GetAvailableBufferStart()
Definition WinUnit.h:460
AssertExceptionW & operator=(AssertExceptionW &)
__declspec(property(get=GetAvailableBufferStart)) wchar_t *AvailableBufferStart
size_t GetAvailableBufferLength()
Definition WinUnit.h:466
void AppendMessage(const wchar_t *message, va_list args)
Definition WinUnit.h:993
void AppendMessage(const wchar_t *message,...)
Definition WinUnit.h:982
virtual const wchar_t * Message()
Returns the message associated with this exception.
Definition WinUnit.h:976
size_t _messageLength
Definition WinUnit.h:440
__declspec(property(get=GetMessageLength, put=SetMessageLength)) size_t MessageLength
size_t GetMessageLength()
Definition WinUnit.h:472
__declspec(property(get=GetAvailableBufferLength)) size_t AvailableBufferLength
void SetMessageLength(size_t messageLength)
Definition WinUnit.h:473
AssertExceptionW()
Definition WinUnit.h:967
const size_t _cchBuffer
Definition WinUnit.h:441
virtual ‾AssertException()=0
Definition WinUnit.h:415
virtual const wchar_t * Message()=0
Returns the message associated with this exception.
static void AreNotEqual(const TCHAR *notExpectedExpressionString, const T ¬ExpectedExpressionValue, const TCHAR *actualExpressionString, const U &actualExpressionValue, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:633
static void StringEqual(const wchar_t *expected, const wchar_t *actual, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:667
static void IsFalse(const TCHAR *expressionString, bool falseExpression, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:867
static void IsNull(const TCHAR *expressionString, T *nullExpression, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:777
static void WinapiSucceeded(const TCHAR *expressionString, bool success, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:888
static void AreEqual(const TCHAR *expectedExpressionString, const T &expectedExpressionValue, const TCHAR *actualExpressionString, const U &actualExpressionValue, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:596
static void ThrowsException(const TCHAR *expressionString, const TCHAR *exceptionType, bool exceptionWasThrown, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:932
static void IsNotNull(const TCHAR *notNullExpressionString, T *notNullExpression, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:804
static void IsTrue(const TCHAR *expressionString, bool trueExpression, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:845
static void Fail(const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:828
static void IsZero(const TCHAR *zeroExpressionString, const T &zeroExpression, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:725
static void IsNotZero(const TCHAR *nonzeroExpressionString, const T &nonzeroExpression, const TCHAR *fileName, int lineNumber, const TCHAR *message=NULL,...)
Definition WinUnit.h:752
Definition WinUnit.h:1270
static bool GetVariable(const TCHAR *variableName, TCHAR buffer[], DWORD bufferSize, DWORD *pSizeNeeded=NULL)
Definition WinUnit.h:1281
void Trace(const wchar_t *formatString,...)
Wide-character version of function called by WIN_TRACE macro.
Definition WinUnit.h:1233
const TCHAR * ToString(const T &object, TCHAR buffer[], size_t bufferSize)
Size of buffer in TCHARs
Definition WinUnit.h:1069