提交 3ac73efe 编写于 作者: A Aurelien Labrosse

optimisation(AVR): Store static string in AVR EEPROM

* This can save a lot of program memory and allow to run test on ATTiny
上级 1100c5d8
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
#include "unity.h" #include "unity.h"
#include <stddef.h> #include <stddef.h>
#ifdef AVR
#include <avr/pgmspace.h>
#else
#define PROGMEM
#endif
/* If omitted from header, declare overrideable prototypes here so they're ready for use */ /* If omitted from header, declare overrideable prototypes here so they're ready for use */
#ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION #ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
void UNITY_OUTPUT_CHAR(int); void UNITY_OUTPUT_CHAR(int);
...@@ -20,48 +26,48 @@ void UNITY_OUTPUT_CHAR(int); ...@@ -20,48 +26,48 @@ void UNITY_OUTPUT_CHAR(int);
struct UNITY_STORAGE_T Unity; struct UNITY_STORAGE_T Unity;
#ifdef UNITY_OUTPUT_COLOR #ifdef UNITY_OUTPUT_COLOR
const char UnityStrOk[] = "\033[42mOK\033[00m"; const char PROGMEM UnityStrOk[] = "\033[42mOK\033[00m";
const char UnityStrPass[] = "\033[42mPASS\033[00m"; const char PROGMEM UnityStrPass[] = "\033[42mPASS\033[00m";
const char UnityStrFail[] = "\033[41mFAIL\033[00m"; const char PROGMEM UnityStrFail[] = "\033[41mFAIL\033[00m";
const char UnityStrIgnore[] = "\033[43mIGNORE\033[00m"; const char PROGMEM UnityStrIgnore[] = "\033[43mIGNORE\033[00m";
#else #else
const char UnityStrOk[] = "OK"; const char PROGMEM UnityStrOk[] = "OK";
const char UnityStrPass[] = "PASS"; const char PROGMEM UnityStrPass[] = "PASS";
const char UnityStrFail[] = "FAIL"; const char PROGMEM UnityStrFail[] = "FAIL";
const char UnityStrIgnore[] = "IGNORE"; const char PROGMEM UnityStrIgnore[] = "IGNORE";
#endif #endif
static const char UnityStrNull[] = "NULL"; static const char PROGMEM UnityStrNull[] = "NULL";
static const char UnityStrSpacer[] = ". "; static const char PROGMEM UnityStrSpacer[] = ". ";
static const char UnityStrExpected[] = " Expected "; static const char PROGMEM UnityStrExpected[] = " Expected ";
static const char UnityStrWas[] = " Was "; static const char PROGMEM UnityStrWas[] = " Was ";
static const char UnityStrGt[] = " to be greater than "; static const char PROGMEM UnityStrGt[] = " to be greater than ";
static const char UnityStrLt[] = " to be less than "; static const char PROGMEM UnityStrLt[] = " to be less than ";
static const char UnityStrOrEqual[] = "or equal to "; static const char PROGMEM UnityStrOrEqual[] = "or equal to ";
static const char UnityStrElement[] = " Element "; static const char PROGMEM UnityStrElement[] = " Element ";
static const char UnityStrByte[] = " Byte "; static const char PROGMEM UnityStrByte[] = " Byte ";
static const char UnityStrMemory[] = " Memory Mismatch."; static const char PROGMEM UnityStrMemory[] = " Memory Mismatch.";
static const char UnityStrDelta[] = " Values Not Within Delta "; static const char PROGMEM UnityStrDelta[] = " Values Not Within Delta ";
static const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless."; static const char PROGMEM UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
static const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL"; static const char PROGMEM UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
static const char UnityStrNullPointerForActual[] = " Actual pointer was NULL"; static const char PROGMEM UnityStrNullPointerForActual[] = " Actual pointer was NULL";
#ifndef UNITY_EXCLUDE_FLOAT #ifndef UNITY_EXCLUDE_FLOAT
static const char UnityStrNot[] = "Not "; static const char PROGMEM UnityStrNot[] = "Not ";
static const char UnityStrInf[] = "Infinity"; static const char PROGMEM UnityStrInf[] = "Infinity";
static const char UnityStrNegInf[] = "Negative Infinity"; static const char PROGMEM UnityStrNegInf[] = "Negative Infinity";
static const char UnityStrNaN[] = "NaN"; static const char PROGMEM UnityStrNaN[] = "NaN";
static const char UnityStrDet[] = "Determinate"; static const char PROGMEM UnityStrDet[] = "Determinate";
static const char UnityStrInvalidFloatTrait[] = "Invalid Float Trait"; static const char PROGMEM UnityStrInvalidFloatTrait[] = "Invalid Float Trait";
#endif #endif
const char UnityStrErrShorthand[] = "Unity Shorthand Support Disabled"; const char PROGMEM UnityStrErrShorthand[] = "Unity Shorthand Support Disabled";
const char UnityStrErrFloat[] = "Unity Floating Point Disabled"; const char PROGMEM UnityStrErrFloat[] = "Unity Floating Point Disabled";
const char UnityStrErrDouble[] = "Unity Double Precision Disabled"; const char PROGMEM UnityStrErrDouble[] = "Unity Double Precision Disabled";
const char UnityStrErr64[] = "Unity 64-bit Support Disabled"; const char PROGMEM UnityStrErr64[] = "Unity 64-bit Support Disabled";
static const char UnityStrBreaker[] = "-----------------------"; static const char PROGMEM UnityStrBreaker[] = "-----------------------";
static const char UnityStrResultsTests[] = " Tests "; static const char PROGMEM UnityStrResultsTests[] = " Tests ";
static const char UnityStrResultsFailures[] = " Failures "; static const char PROGMEM UnityStrResultsFailures[] = " Failures ";
static const char UnityStrResultsIgnored[] = " Ignored "; static const char PROGMEM UnityStrResultsIgnored[] = " Ignored ";
static const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " "; static const char PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
static const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " "; static const char PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
/*----------------------------------------------- /*-----------------------------------------------
* Pretty Printers & Test Result Output Handlers * Pretty Printers & Test Result Output Handlers
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册