/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#ifndef UNITY_PROGMEM
#define UNITY_PROGMEM
#endif
/* If omitted from header, declare overrideable prototypes here so they're ready for use */
#ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
void UNITY_OUTPUT_CHAR(int);
#endif
/* Helpful macros for us to use here in Assert functions */
#define UNITY_FAIL_AND_BAIL do { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); } while (0)
#define UNITY_IGNORE_AND_BAIL do { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); } while (0)
#define RETURN_IF_FAIL_OR_IGNORE do { if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) { TEST_ABORT(); } } while (0)
struct UNITY_STORAGE_T Unity;
#ifdef UNITY_OUTPUT_COLOR
const char UNITY_PROGMEM UnityStrOk[] = "\033[42mOK\033[0m";
const char UNITY_PROGMEM UnityStrPass[] = "\033[42mPASS\033[0m";
const char UNITY_PROGMEM UnityStrFail[] = "\033[41mFAIL\033[0m";
const char UNITY_PROGMEM UnityStrIgnore[] = "\033[43mIGNORE\033[0m";
#else
const char UNITY_PROGMEM UnityStrOk[] = "OK";
const char UNITY_PROGMEM UnityStrPass[] = "PASS";
const char UNITY_PROGMEM UnityStrFail[] = "FAIL";
const char UNITY_PROGMEM UnityStrIgnore[] = "IGNORE";
#endif
static const char UNITY_PROGMEM UnityStrNull[] = "NULL";
static const char UNITY_PROGMEM UnityStrSpacer[] = ". ";
static const char UNITY_PROGMEM UnityStrExpected[] = " Expected ";
static const char UNITY_PROGMEM UnityStrWas[] = " Was ";
static const char UNITY_PROGMEM UnityStrGt[] = " to be greater than ";
static const char UNITY_PROGMEM UnityStrLt[] = " to be less than ";
static const char UNITY_PROGMEM UnityStrOrEqual[] = "or equal to ";
static const char UNITY_PROGMEM UnityStrNotEqual[] = " to be not equal to ";
static const char UNITY_PROGMEM UnityStrElement[] = " Element ";
static const char UNITY_PROGMEM UnityStrByte[] = " Byte ";
static const char UNITY_PROGMEM UnityStrMemory[] = " Memory Mismatch.";
static const char UNITY_PROGMEM UnityStrDelta[] = " Values Not Within Delta ";
static const char UNITY_PROGMEM UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
static const char UNITY_PROGMEM UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
static const char UNITY_PROGMEM UnityStrNullPointerForActual[] = " Actual pointer was NULL";
#ifndef UNITY_EXCLUDE_FLOAT
static const char UNITY_PROGMEM UnityStrNot[] = "Not ";
static const char UNITY_PROGMEM UnityStrInf[] = "Infinity";
static const char UNITY_PROGMEM UnityStrNegInf[] = "Negative Infinity";
static const char UNITY_PROGMEM UnityStrNaN[] = "NaN";
static const char UNITY_PROGMEM UnityStrDet[] = "Determinate";
static const char UNITY_PROGMEM UnityStrInvalidFloatTrait[] = "Invalid Float Trait";
#endif
const char UNITY_PROGMEM UnityStrErrShorthand[] = "Unity Shorthand Support Disabled";
const char UNITY_PROGMEM UnityStrErrFloat[] = "Unity Floating Point Disabled";
const char UNITY_PROGMEM UnityStrErrDouble[] = "Unity Double Precision Disabled";
const char UNITY_PROGMEM UnityStrErr64[] = "Unity 64-bit Support Disabled";
static const char UNITY_PROGMEM UnityStrBreaker[] = "-----------------------";
static const char UNITY_PROGMEM UnityStrResultsTests[] = " Tests ";
static const char UNITY_PROGMEM UnityStrResultsFailures[] = " Failures ";
static const char UNITY_PROGMEM UnityStrResultsIgnored[] = " Ignored ";
#ifndef UNITY_EXCLUDE_DETAILS
static const char UNITY_PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
static const char UNITY_PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
#endif
/*-----------------------------------------------
* Pretty Printers & Test Result Output Handlers
*-----------------------------------------------*/
/*-----------------------------------------------*/
/* Local helper function to print characters. */
static void UnityPrintChar(const char* pch)
{
/* printable characters plus CR & LF are printed */
if ((*pch <= 126) && (*pch >= 32))
{
UNITY_OUTPUT_CHAR(*pch);
}
/* write escaped carriage returns */
else if (*pch == 13)
{
UNITY_OUTPUT_CHAR('\\');
UNITY_OUTPUT_CHAR('r');
}
/* write escaped line feeds */
else if (*pch == 10)
{
UNITY_OUTPUT_CHAR('\\');
UNITY_OUTPUT_CHAR('n');
}
/* unprintable characters are shown as codes */
else
{
UNITY_OUTPUT_CHAR('\\');
UNITY_OUTPUT_CHAR('x');
UnityPrintNumberHex((UNITY_UINT)*pch, 2);
}
}
/*-----------------------------------------------*/
/* Local helper function to print ANSI escape strings e.g. "\033[42m". */
#ifdef UNITY_OUTPUT_COLOR
static UNITY_UINT UnityPrintAnsiEscapeString(const char* string)
{
const char* pch = string;
UNITY_UINT count = 0;
while (*pch && (*pch != 'm'))
{
UNITY_OUTPUT_CHAR(*pch);
pch++;
count++;
}
UNITY_OUTPUT_CHAR('m');
count++;
return count;
}
#endif
/*-----------------------------------------------*/
void UnityPrint(const char* string)
{
const char* pch = string;
if (pch != NULL)
{
while (*pch)
{
#ifdef UNITY_OUTPUT_COLOR
/* print ANSI escape code */
if ((*pch == 27) && (*(pch + 1) == '['))
{
pch += UnityPrintAnsiEscapeString(pch);
continue;
}
#endif
UnityPrintChar(pch);
pch++;
}
}
}
/*-----------------------------------------------*/
void UnityPrintLen(const char* string, const UNITY_UINT32 length)
{
const char* pch = string;
if (pch != NULL)
{
while (*pch && ((UNITY_UINT32)(pch - string) < length))
{
/* printable characters plus CR & LF are printed */
if ((*pch <= 126) && (*pch >= 32))
{
UNITY_OUTPUT_CHAR(*pch);
}
/* write escaped carriage returns */
else if (*pch == 13)
{
UNITY_OUTPUT_CHAR('\\');
UNITY_OUTPUT_CHAR('r');
}
/* write escaped line feeds */
else if (*pch == 10)
{
UNITY_OUTPUT_CHAR('\\');
UNITY_OUTPUT_CHAR('n');
}
/* unprintable characters are shown as codes */
else
{
UNITY_OUTPUT_CHAR('\\');
UNITY_OUTPUT_CHAR('x');
UnityPrintNumberHex((UNITY_UINT)*pch, 2);
}
pch++;
}
}
}
/*-----------------------------------------------*/
void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style)
{
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
{
if (style == UNITY_DISPLAY_STYLE_CHAR)
{
/* printable characters plus CR & LF are printed
时时三省
- 粉丝: 1266
- 资源: 4
最新资源
- PLC系列16点PLC生产方案,支持4轴100K脉冲输出,RS232,RS485,2路AB相100K高速计数,2路AD模拟量12位,PID ,DDRVA,DDRVI,D PLSR,D PLSY,DHS
- java项目,课程设计-汽车租赁管理系统(详细文档+视频+源码).zip
- RDPWrap 1.6,windows home版远程桌面服务。自动下载最新rdpwrap.ini
- 使用Matlab对矩阵的基本操作-1
- 汇川is500伺服控制器方案 DSP程序和原理图,代码完整,学习工业代码的范例,含惯量识别,电机参数识别,PWM死区补偿,运动插补等功能 本代码仅用于学习
- Webstack纯静态大气网址导航系统HTML源码.zip
- 主控芯片dsp tms320f28335,基于Matlab Simulink开发的嵌入式模型,模型可自动生成ccs工程代码,生成的代码可直接运行在主控芯片中 该模型利用六步向算法,控制直流无刷电机旋
- 量子遗传算法代码.rar
- 制造业用百度小程序模板智能小程序源代码可第二开放免费的小程序模板
- 永磁同步电机直接转矩控制,电流预测模型,无位置传感,滑模控制
- 基于机器学习的电影大数据预测分析及可视化项目Python源码(毕业设计项目)
- 小学作文格式的田字格文件
- 期末大作业Python基于机器学习的电影大数据预测分析及可视化项目源码
- 智能小程序企业小程序小企业专用小程序简单展示型小程序模板
- Python 图片转ICO格式工具
- JSTL标签库jar包文件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈