~cpp int gNumTests = 0; int gNumFailures = 0; void Assert(bool condition) { ++gNumTests; if(!condition) { ++gNumFailures; } } #define Assert(cond) AssertImpl(cond, #cond, __LINE__, __FILE__) void AssertImpl( bool condition, const char* condStr, int lineNum, const char* fileName) { ++gNumTests; if(!condition) { ++gNumFailures; printf("file %s', line %d, assert '%s' failed\n", fileName, (int)lineNum, condStr); } } void printTestResult() { printf("%d tests run, %d tests failed\n", (int)gNumTests,(int)gNumFailures); } int main(int argc, char* argv[]) { Assert(1==2); printTestResult(); return 0; }