/** * Common error routines for wpi_assertEqual_impl and wpi_assertNotEqual_impl * This should not be called directly; it should only be used by * wpi_assertEqual_impl and wpi_assertNotEqual_impl. */ void wpi_assertEqual_common_impl(int valueA, int valueB, const std::string& equalityType, const std::string& message, const std::string& fileName, uint32_t lineNumber, const std::string& funcName) { // Error string buffer std::stringstream error; // If an error message was specified, include it // Build error string if (message.size() > 0) { error << "Assertion failed: \"" << message << "\", \"" << valueA << "\" " << equalityType << " \"" << valueB << "\" in " << funcName << "() in " << fileName << " at line " << lineNumber << "\n"; } else { error << "Assertion failed: \"" << valueA << "\" " << equalityType << " \"" << valueB << "\" in " << funcName << "() in " << fileName << " at line " << lineNumber << "\n"; } // Print to console and send to remote dashboard std::cout << "\n\n>>>>" << error.str(); wpi_handleTracing(); }
/** * Common error routines for wpi_assertEqual_impl and wpi_assertNotEqual_impl * This should not be called directly; it should only be used by wpi_assertEqual_impl * and wpi_assertNotEqual_impl. */ void wpi_assertEqual_common_impl(int valueA, int valueB, const char *equalityType, const char *message, const char *fileName, UINT32 lineNumber, const char *funcName) { // Error string buffer char error[256]; // If an error message was specified, include it // Build error string if(message != NULL) { sprintf(error, "Assertion failed: \"%s\", \"%d\" %s \"%d\" in %s() in %s at line %d\n", message, valueA, equalityType, valueB, funcName, fileName, lineNumber); } else { sprintf(error, "Assertion failed: \"%d\" %s \"%d\" in %s() in %s at line %d\n", valueA, equalityType, valueB, funcName, fileName, lineNumber); } // Print to console and send to remote dashboard printf("\n\n>>>>%s", error); setErrorData(error, strlen(error), 100); wpi_handleTracing(); if (suspendOnAssertEnabled) taskSuspend(0); }
/** * Assert implementation. * This allows breakpoints to be set on an assert. * The users don't call this, but instead use the wpi_assert macros in Utility.h. */ bool wpi_assert_impl(bool conditionValue, const char *conditionText, const char *message, const char *fileName, UINT32 lineNumber, const char *funcName) { if (!conditionValue) { // Error string buffer char error[256]; // If an error message was specified, include it // Build error string if(message != NULL) { sprintf(error, "Assertion failed: \"%s\", \"%s\" failed in %s() in %s at line %d\n", message, conditionText, funcName, fileName, lineNumber); } else { sprintf(error, "Assertion failed: \"%s\" in %s() in %s at line %d\n", conditionText, funcName, fileName, lineNumber); } // Print to console and send to remote dashboard printf("\n\n>>>>%s", error); setErrorData(error, strlen(error), 100); wpi_handleTracing(); if (suspendOnAssertEnabled) taskSuspend(0); } return conditionValue; }
void wpi_fatal_impl(const INT32 statusCode, const char *statusString, const char *fileName, UINT32 lineNumber, const char *funcName) { printf("\n\n>>>>Fatal error \"%s\" in %s() in %s at line %d\n", statusString, funcName, fileName, lineNumber); wpi_handleTracing(); }
/** * Assert implementation. * This allows breakpoints to be set on an assert. * The users don't call this, but instead use the wpi_assert macros in Utility.h. */ bool wpi_assert_impl(bool conditionValue, const std::string &conditionText, const std::string &message, const std::string &fileName, uint32_t lineNumber, const std::string &funcName) { if (!conditionValue) { // Error string buffer std::stringstream error; // If an error message was specified, include it // Build error string if (message.size()) { error << "Assertion failed: \"" << message << "\", \"" << conditionText << "\" failed in " << funcName + "() in " << fileName << " at line " << lineNumber; } else { error << "Assertion failed: \"" << conditionText << "\" in " << funcName << "() in " << fileName << " at line " << lineNumber; } // Print to console and send to remote dashboard std::cout << "\n\n>>>>" << error; wpi_handleTracing(); } return conditionValue; }
/** * Assert status clean implementation. * This allows breakpoints to be set on an assert. * This allows the fatal status to be printed. * The users don't call this, but instead use the wpi_assertCleanStatus macro in Utility.h. */ void wpi_assertCleanStatus_impl(INT32 status, const char *fileName, UINT32 lineNumber, const char *funcName) { if (status != 0) { printf("\n\n>>>>%s: status == %d (0x%08X) in %s() in %s at line %d\n", status < 0 ? "ERROR" : "WARNING", status, (UINT32)status, funcName, fileName, lineNumber); wpi_handleTracing(); if (suspendOnAssertEnabled) taskSuspend(0); } }
/** * Assert implementation. * This allows breakpoints to be set on an assert. * The users don't call this, but instead use the wpi_assert macro in Utility.h. */ void wpi_assert_impl(bool conditionValue, const char *conditionText, const char *fileName, UINT32 lineNumber, const char *funcName) { if (!conditionValue) { printf("\n\n>>>>Assert \"%s\" failed in %s() in %s at line %d\n", conditionText, funcName, fileName, lineNumber); wpi_handleTracing(); if (suspendOnAssertEnabled) taskSuspend(0); } }
void wpi_fatal_impl(const INT32 statusCode, const char *statusString, const char *fileName, UINT32 lineNumber, const char *funcName) { // Error string buffer char error[256]; // Build error strings sprintf(error, "Fatal error \"%s\" in %s() in %s at line %d\n", statusString, funcName, fileName, lineNumber); // Print to console and send to remote dashboard printf("\n\n>>>>%s", error); setErrorData(error, strlen(error), 100); wpi_handleTracing(); }
/** * Assert status clean implementation. * This allows breakpoints to be set on an assert. * This allows the fatal status to be printed. * The users don't call this, but instead use the wpi_assertCleanStatus macro in Utility.h. */ void wpi_assertCleanStatus_impl(INT32 status, const char *fileName, UINT32 lineNumber, const char *funcName) { if (status != 0) { // Error string buffers char error[256]; char error_with_code[256]; // Build error strings sprintf(error, "%s: status == %d (0x%08X) in %s() in %s at line %d\n", status < 0 ? "ERROR" : "WARNING", status, (UINT32)status, funcName, fileName, lineNumber); sprintf(error_with_code,"<Code>%d %s", status, error); // Print to console and send to remote dashboard printf("\n\n>>>>%s", error); setErrorData(error_with_code, strlen(error_with_code), 100); wpi_handleTracing(); if (suspendOnAssertEnabled) taskSuspend(0); } }
/** * Assert implementation. * This allows breakpoints to be set on an assert. * The users don't call this, but instead use the wpi_assert macros in * Utility.h. */ bool wpi_assert_impl(bool conditionValue, const char* conditionText, const char* message, const char* fileName, uint32_t lineNumber, const char* funcName) { if (!conditionValue) { std::stringstream errorStream; errorStream << "Assertion \"" << conditionText << "\" "; errorStream << "on line " << lineNumber << " "; errorStream << "of " << basename(fileName) << " "; if (message[0] != '\0') { errorStream << "failed: " << message << std::endl; } else { errorStream << "failed." << std::endl; } // Print to console and send to remote dashboard std::cout << "\n\n>>>>" << errorStream.str(); wpi_handleTracing(); } return conditionValue; }