mirror of
https://github.com/dvorka/hstr.git
synced 2024-09-20 06:46:13 +08:00
Adding Unity C test framework.
This commit is contained in:
parent
742c51c756
commit
ade822ff4a
|
@ -14,8 +14,6 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Run unit tests w/ Valgrind.
|
ruby ../test/unity/src/ruby/generate_test_runner.rb ../test/src/test.c ../test/src/test_runner.c
|
||||||
|
|
||||||
valgrind --tool=memcheck --leak-check=full ../src/hstr
|
|
||||||
|
|
||||||
# eof
|
# eof
|
|
@ -16,4 +16,27 @@
|
||||||
|
|
||||||
# Run unit tests.
|
# Run unit tests.
|
||||||
|
|
||||||
|
# options
|
||||||
|
#export OPTION_RUN_VALGRIND=yes # run test(s) w/ Valgrind (comment this line to disable)
|
||||||
|
|
||||||
|
# generate test runner
|
||||||
|
./test-generate-unity-test-runner.sh
|
||||||
|
|
||||||
|
# compile
|
||||||
|
cd ../test && qmake hstr-unit-tests.pro && make clean && make -j 8
|
||||||
|
if [ ${?} -ne 0 ]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run
|
||||||
|
if [ ${OPTION_RUN_VALGRIND} ]
|
||||||
|
then
|
||||||
|
valgrind --track-origins=yes --tool=memcheck --leak-check=full --show-leak-kinds=all ./hstr-unit-tests
|
||||||
|
# Valgrind's GDB
|
||||||
|
#valgrind --vgdb=yes --vgdb-error=0 --track-origins=yes --tool=memcheck --leak-check=full --show-leak-kinds=all ./hstr-unit-tests
|
||||||
|
else
|
||||||
|
./hstr-unit-tests
|
||||||
|
fi
|
||||||
|
|
||||||
# eof
|
# eof
|
||||||
|
|
|
@ -19,6 +19,9 @@ CONFIG += console
|
||||||
CONFIG -= app_bundle
|
CONFIG -= app_bundle
|
||||||
CONFIG -= qt
|
CONFIG -= qt
|
||||||
|
|
||||||
|
# includes
|
||||||
|
INCLUDEPATH += unity/src/c
|
||||||
|
|
||||||
# -L for where to look for library, -l for linking the library
|
# -L for where to look for library, -l for linking the library
|
||||||
LIBS += -lm -lreadline -lncursesw
|
LIBS += -lm -lreadline -lncursesw
|
||||||
|
|
||||||
|
@ -32,7 +35,9 @@ SOURCES += \
|
||||||
../src/hstr_utils.c \
|
../src/hstr_utils.c \
|
||||||
../src/hstr.c \
|
../src/hstr.c \
|
||||||
../src/radixsort.c \
|
../src/radixsort.c \
|
||||||
../test/src/test.c
|
../test/src/test.c \
|
||||||
|
unity/src/c/unity.c \
|
||||||
|
src/test_runner.c
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
../src/include/hashset.h \
|
../src/include/hashset.h \
|
||||||
|
@ -43,7 +48,10 @@ HEADERS += \
|
||||||
../src/include/hstr_regexp.h \
|
../src/include/hstr_regexp.h \
|
||||||
../src/include/hstr_utils.h \
|
../src/include/hstr_utils.h \
|
||||||
../src/include/radixsort.h \
|
../src/include/radixsort.h \
|
||||||
../src/include/hstr.h
|
../src/include/hstr.h \
|
||||||
|
unity/src/c/unity_config.h \
|
||||||
|
unity/src/c/unity_internals.h \
|
||||||
|
unity/src/c/unity.h
|
||||||
|
|
||||||
# compiler and linker
|
# compiler and linker
|
||||||
QMAKE_CC = ccache gcc
|
QMAKE_CC = ccache gcc
|
||||||
|
|
|
@ -16,9 +16,32 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "../../src/include/hstr.h"
|
#include "../../src/include/hstr.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
// HSTR uses Unity C test framework: https://github.com/ThrowTheSwitch/Unity
|
||||||
|
#include "unity/src/c/unity.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IMPORTANT: make sure to run TEST RUNNER GENERATOR script after any change!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
void setUp(void)
|
||||||
{
|
{
|
||||||
return hstrMain(argc, argv);
|
}
|
||||||
|
|
||||||
|
void tearDown(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_failure(void)
|
||||||
|
{
|
||||||
|
TEST_ASSERT_TRUE(1);
|
||||||
|
TEST_ASSERT_FALSE(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_help(void)
|
||||||
|
{
|
||||||
|
//return hstrMain(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
75
test/src/test_runner.c
Normal file
75
test/src/test_runner.c
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/* AUTOGENERATED FILE. DO NOT EDIT. */
|
||||||
|
|
||||||
|
/*=======Test Runner Used To Run Each Test Below=====*/
|
||||||
|
#define RUN_TEST(TestFunc, TestLineNum) \
|
||||||
|
{ \
|
||||||
|
Unity.CurrentTestName = #TestFunc; \
|
||||||
|
Unity.CurrentTestLineNumber = TestLineNum; \
|
||||||
|
Unity.NumberOfTests++; \
|
||||||
|
if (TEST_PROTECT()) \
|
||||||
|
{ \
|
||||||
|
setUp(); \
|
||||||
|
TestFunc(); \
|
||||||
|
} \
|
||||||
|
if (TEST_PROTECT()) \
|
||||||
|
{ \
|
||||||
|
tearDown(); \
|
||||||
|
} \
|
||||||
|
UnityConcludeTest(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/*=======Automagically Detected Files To Include=====*/
|
||||||
|
#ifdef __WIN32__
|
||||||
|
#define UNITY_INCLUDE_SETUP_STUBS
|
||||||
|
#endif
|
||||||
|
#include "unity.h"
|
||||||
|
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||||
|
#include <setjmp.h>
|
||||||
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "../../src/include/hstr.h"
|
||||||
|
|
||||||
|
/*=======External Functions This Runner Calls=====*/
|
||||||
|
extern void setUp(void);
|
||||||
|
extern void tearDown(void);
|
||||||
|
extern void test_failure(void);
|
||||||
|
extern void test_help(void);
|
||||||
|
|
||||||
|
|
||||||
|
/*=======Suite Setup=====*/
|
||||||
|
static void suite_setup(void)
|
||||||
|
{
|
||||||
|
#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)
|
||||||
|
suiteSetUp();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*=======Suite Teardown=====*/
|
||||||
|
static int suite_teardown(int num_failures)
|
||||||
|
{
|
||||||
|
#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)
|
||||||
|
return suiteTearDown(num_failures);
|
||||||
|
#else
|
||||||
|
return num_failures;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*=======Test Reset Option=====*/
|
||||||
|
void resetTest(void);
|
||||||
|
void resetTest(void)
|
||||||
|
{
|
||||||
|
tearDown();
|
||||||
|
setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*=======MAIN=====*/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
suite_setup();
|
||||||
|
UnityBegin("../test/src/test.c");
|
||||||
|
RUN_TEST(test_failure, 38);
|
||||||
|
RUN_TEST(test_help, 44);
|
||||||
|
|
||||||
|
return suite_teardown(UnityEnd());
|
||||||
|
}
|
1572
test/unity/src/c/unity.c
Normal file
1572
test/unity/src/c/unity.c
Normal file
File diff suppressed because it is too large
Load diff
503
test/unity/src/c/unity.h
Normal file
503
test/unity/src/c/unity.h
Normal file
|
@ -0,0 +1,503 @@
|
||||||
|
/* ==========================================
|
||||||
|
Unity Project - A Test Framework for C
|
||||||
|
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||||
|
[Released under MIT License. Please refer to license.txt for details]
|
||||||
|
========================================== */
|
||||||
|
|
||||||
|
#ifndef UNITY_FRAMEWORK_H
|
||||||
|
#define UNITY_FRAMEWORK_H
|
||||||
|
#define UNITY
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "unity_internals.h"
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Setup / Teardown
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* These functions are intended to be called before and after each test. */
|
||||||
|
void setUp(void);
|
||||||
|
void tearDown(void);
|
||||||
|
|
||||||
|
/* These functions are intended to be called at the beginning and end of an
|
||||||
|
* entire test suite. suiteTearDown() is passed the number of tests that
|
||||||
|
* failed, and its return value becomes the exit code of main(). */
|
||||||
|
void suiteSetUp(void);
|
||||||
|
int suiteTearDown(int num_failures);
|
||||||
|
|
||||||
|
/* If the compiler supports it, the following block provides stub
|
||||||
|
* implementations of the above functions as weak symbols. Note that on
|
||||||
|
* some platforms (MinGW for example), weak function implementations need
|
||||||
|
* to be in the same translation unit they are called from. This can be
|
||||||
|
* achieved by defining UNITY_INCLUDE_SETUP_STUBS before including unity.h. */
|
||||||
|
#ifdef UNITY_INCLUDE_SETUP_STUBS
|
||||||
|
#ifdef UNITY_WEAK_ATTRIBUTE
|
||||||
|
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
|
||||||
|
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
|
||||||
|
UNITY_WEAK_ATTRIBUTE void suiteSetUp(void) { }
|
||||||
|
UNITY_WEAK_ATTRIBUTE int suiteTearDown(int num_failures) { return num_failures; }
|
||||||
|
#elif defined(UNITY_WEAK_PRAGMA)
|
||||||
|
#pragma weak setUp
|
||||||
|
void setUp(void) { }
|
||||||
|
#pragma weak tearDown
|
||||||
|
void tearDown(void) { }
|
||||||
|
#pragma weak suiteSetUp
|
||||||
|
void suiteSetUp(void) { }
|
||||||
|
#pragma weak suiteTearDown
|
||||||
|
int suiteTearDown(int num_failures) { return num_failures; }
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Configuration Options
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* All options described below should be passed as a compiler flag to all files using Unity. If you must add #defines, place them BEFORE the #include above.
|
||||||
|
|
||||||
|
* Integers/longs/pointers
|
||||||
|
* - Unity attempts to automatically discover your integer sizes
|
||||||
|
* - define UNITY_EXCLUDE_STDINT_H to stop attempting to look in <stdint.h>
|
||||||
|
* - define UNITY_EXCLUDE_LIMITS_H to stop attempting to look in <limits.h>
|
||||||
|
* - If you cannot use the automatic methods above, you can force Unity by using these options:
|
||||||
|
* - define UNITY_SUPPORT_64
|
||||||
|
* - set UNITY_INT_WIDTH
|
||||||
|
* - set UNITY_LONG_WIDTH
|
||||||
|
* - set UNITY_POINTER_WIDTH
|
||||||
|
|
||||||
|
* Floats
|
||||||
|
* - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons
|
||||||
|
* - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT
|
||||||
|
* - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats
|
||||||
|
* - define UNITY_INCLUDE_DOUBLE to allow double floating point comparisons
|
||||||
|
* - define UNITY_EXCLUDE_DOUBLE to disallow double floating point comparisons (default)
|
||||||
|
* - define UNITY_DOUBLE_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_DOUBLE
|
||||||
|
* - define UNITY_DOUBLE_TYPE to specify something other than double
|
||||||
|
* - define UNITY_EXCLUDE_FLOAT_PRINT to trim binary size, won't print floating point values in errors
|
||||||
|
|
||||||
|
* Output
|
||||||
|
* - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired
|
||||||
|
* - define UNITY_DIFFERENTIATE_FINAL_FAIL to print FAILED (vs. FAIL) at test end summary - for automated search for failure
|
||||||
|
|
||||||
|
* Optimization
|
||||||
|
* - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge
|
||||||
|
* - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests.
|
||||||
|
|
||||||
|
* Test Cases
|
||||||
|
* - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script
|
||||||
|
|
||||||
|
* Parameterized Tests
|
||||||
|
* - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing
|
||||||
|
|
||||||
|
* Tests with Arguments
|
||||||
|
* - you'll want to define UNITY_USE_COMMAND_LINE_ARGS if you have the test runner passing arguments to Unity
|
||||||
|
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* Basic Fail and Ignore
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, (message))
|
||||||
|
#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL)
|
||||||
|
#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, (message))
|
||||||
|
#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL)
|
||||||
|
#define TEST_ONLY()
|
||||||
|
|
||||||
|
/* It is not necessary for you to call PASS. A PASS condition is assumed if nothing fails.
|
||||||
|
* This method allows you to abort a test immediately with a PASS state, ignoring the remainder of the test. */
|
||||||
|
#define TEST_PASS() TEST_ABORT()
|
||||||
|
|
||||||
|
/* This macro does nothing, but it is useful for build tools (like Ceedling) to make use of this to figure out
|
||||||
|
* which files should be linked to in order to perform a test. Use it like TEST_FILE("sandwiches.c") */
|
||||||
|
#define TEST_FILE(a)
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Asserts (simple)
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Boolean */
|
||||||
|
#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE")
|
||||||
|
#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE")
|
||||||
|
#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE")
|
||||||
|
#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE")
|
||||||
|
#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL")
|
||||||
|
#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL")
|
||||||
|
|
||||||
|
/* Integers (of all sizes) */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(-1), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(0), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Integer Greater Than/ Less Than (of all sizes) */
|
||||||
|
#define TEST_ASSERT_GREATER_THAN(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_THAN(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT8(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Integer Ranges (of all sizes) */
|
||||||
|
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_INT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_UINT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Structs and Strings */
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Arrays */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Arrays Compared To Single Value */
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT8((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT64((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT8((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT64((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX8((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX32(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX64((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_PTR((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_STRING(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_STRING((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_MEMORY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY((expected), (actual), (len), (num_elements), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Floating Point (If Enabled) */
|
||||||
|
#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_FLOAT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NEG_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NAN(actual) UNITY_TEST_ASSERT_FLOAT_IS_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_DETERMINATE(actual) UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NAN(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/* Double (If Enabled) */
|
||||||
|
#define TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE(expected, actual) UNITY_TEST_ASSERT_EQUAL_DOUBLE((expected), (actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE((expected), (actual), (num_elements), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NEG_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NAN(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual) UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, NULL)
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, NULL)
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Asserts (with additional messages)
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Boolean */
|
||||||
|
#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Integers (of all sizes) */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(-1), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(0), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Integer Greater Than/ Less Than (of all sizes) */
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_THAN_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_THAN_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Integer Ranges (of all sizes) */
|
||||||
|
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT8_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_INT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT8_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_UINT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Structs and Strings */
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_STRING_LEN((expected), (actual), (len), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY((expected), (actual), (len), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Arrays */
|
||||||
|
#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_PTR_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Arrays Compared To Single Value*/
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT8_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT8((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT16((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT32_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_INT64_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT64((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT8_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT8((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT16((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT32_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_UINT64_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT64((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX8_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX8((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX16((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX32_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_HEX64_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX64((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_PTR_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_PTR((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_STRING_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_STRING((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_MEMORY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY((expected), (actual), (len), (num_elements), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Floating Point (If Enabled) */
|
||||||
|
#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_FLOAT_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* Double (If Enabled) */
|
||||||
|
#define TEST_ASSERT_DOUBLE_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE((expected), (actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_EACH_EQUAL_DOUBLE_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE((expected), (actual), (num_elements), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, (message))
|
||||||
|
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, (message))
|
||||||
|
|
||||||
|
/* end of UNITY_FRAMEWORK_H */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
247
test/unity/src/c/unity_config.h
Normal file
247
test/unity/src/c/unity_config.h
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
/* Unity Configuration
|
||||||
|
* As of May 11th, 2016 at ThrowTheSwitch/Unity commit 837c529
|
||||||
|
* Update: December 29th, 2016
|
||||||
|
* See Also: Unity/docs/UnityConfigurationGuide.pdf
|
||||||
|
*
|
||||||
|
* Unity is designed to run on almost anything that is targeted by a C compiler.
|
||||||
|
* It would be awesome if this could be done with zero configuration. While
|
||||||
|
* there are some targets that come close to this dream, it is sadly not
|
||||||
|
* universal. It is likely that you are going to need at least a couple of the
|
||||||
|
* configuration options described in this document.
|
||||||
|
*
|
||||||
|
* All of Unity's configuration options are `#defines`. Most of these are simple
|
||||||
|
* definitions. A couple are macros with arguments. They live inside the
|
||||||
|
* unity_internals.h header file. We don't necessarily recommend opening that
|
||||||
|
* file unless you really need to. That file is proof that a cross-platform
|
||||||
|
* library is challenging to build. From a more positive perspective, it is also
|
||||||
|
* proof that a great deal of complexity can be centralized primarily to one
|
||||||
|
* place in order to provide a more consistent and simple experience elsewhere.
|
||||||
|
*
|
||||||
|
* Using These Options
|
||||||
|
* It doesn't matter if you're using a target-specific compiler and a simulator
|
||||||
|
* or a native compiler. In either case, you've got a couple choices for
|
||||||
|
* configuring these options:
|
||||||
|
*
|
||||||
|
* 1. Because these options are specified via C defines, you can pass most of
|
||||||
|
* these options to your compiler through command line compiler flags. Even
|
||||||
|
* if you're using an embedded target that forces you to use their
|
||||||
|
* overbearing IDE for all configuration, there will be a place somewhere in
|
||||||
|
* your project to configure defines for your compiler.
|
||||||
|
* 2. You can create a custom `unity_config.h` configuration file (present in
|
||||||
|
* your toolchain's search paths). In this file, you will list definitions
|
||||||
|
* and macros specific to your target. All you must do is define
|
||||||
|
* `UNITY_INCLUDE_CONFIG_H` and Unity will rely on `unity_config.h` for any
|
||||||
|
* further definitions it may need.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UNITY_CONFIG_H
|
||||||
|
#define UNITY_CONFIG_H
|
||||||
|
|
||||||
|
/* ************************* AUTOMATIC INTEGER TYPES ***************************
|
||||||
|
* C's concept of an integer varies from target to target. The C Standard has
|
||||||
|
* rules about the `int` matching the register size of the target
|
||||||
|
* microprocessor. It has rules about the `int` and how its size relates to
|
||||||
|
* other integer types. An `int` on one target might be 16 bits while on another
|
||||||
|
* target it might be 64. There are more specific types in compilers compliant
|
||||||
|
* with C99 or later, but that's certainly not every compiler you are likely to
|
||||||
|
* encounter. Therefore, Unity has a number of features for helping to adjust
|
||||||
|
* itself to match your required integer sizes. It starts off by trying to do it
|
||||||
|
* automatically.
|
||||||
|
**************************************************************************** */
|
||||||
|
|
||||||
|
/* The first attempt to guess your types is to check `limits.h`. Some compilers
|
||||||
|
* that don't support `stdint.h` could include `limits.h`. If you don't
|
||||||
|
* want Unity to check this file, define this to make it skip the inclusion.
|
||||||
|
* Unity looks at UINT_MAX & ULONG_MAX, which were available since C89.
|
||||||
|
*/
|
||||||
|
/* #define UNITY_EXCLUDE_LIMITS_H */
|
||||||
|
|
||||||
|
/* The second thing that Unity does to guess your types is check `stdint.h`.
|
||||||
|
* This file defines `UINTPTR_MAX`, since C99, that Unity can make use of to
|
||||||
|
* learn about your system. It's possible you don't want it to do this or it's
|
||||||
|
* possible that your system doesn't support `stdint.h`. If that's the case,
|
||||||
|
* you're going to want to define this. That way, Unity will know to skip the
|
||||||
|
* inclusion of this file and you won't be left with a compiler error.
|
||||||
|
*/
|
||||||
|
/* #define UNITY_EXCLUDE_STDINT_H */
|
||||||
|
|
||||||
|
/* ********************** MANUAL INTEGER TYPE DEFINITION ***********************
|
||||||
|
* If you've disabled all of the automatic options above, you're going to have
|
||||||
|
* to do the configuration yourself. There are just a handful of defines that
|
||||||
|
* you are going to specify if you don't like the defaults.
|
||||||
|
**************************************************************************** */
|
||||||
|
|
||||||
|
/* Define this to be the number of bits an `int` takes up on your system. The
|
||||||
|
* default, if not auto-detected, is 32 bits.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_INT_WIDTH 16 */
|
||||||
|
|
||||||
|
/* Define this to be the number of bits a `long` takes up on your system. The
|
||||||
|
* default, if not autodetected, is 32 bits. This is used to figure out what
|
||||||
|
* kind of 64-bit support your system can handle. Does it need to specify a
|
||||||
|
* `long` or a `long long` to get a 64-bit value. On 16-bit systems, this option
|
||||||
|
* is going to be ignored.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_LONG_WIDTH 16 */
|
||||||
|
|
||||||
|
/* Define this to be the number of bits a pointer takes up on your system. The
|
||||||
|
* default, if not autodetected, is 32-bits. If you're getting ugly compiler
|
||||||
|
* warnings about casting from pointers, this is the one to look at.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_POINTER_WIDTH 64 */
|
||||||
|
|
||||||
|
/* Unity will automatically include 64-bit support if it auto-detects it, or if
|
||||||
|
* your `int`, `long`, or pointer widths are greater than 32-bits. Define this
|
||||||
|
* to enable 64-bit support if none of the other options already did it for you.
|
||||||
|
* There can be a significant size and speed impact to enabling 64-bit support
|
||||||
|
* on small targets, so don't define it if you don't need it.
|
||||||
|
*/
|
||||||
|
/* #define UNITY_INCLUDE_64 */
|
||||||
|
|
||||||
|
|
||||||
|
/* *************************** FLOATING POINT TYPES ****************************
|
||||||
|
* In the embedded world, it's not uncommon for targets to have no support for
|
||||||
|
* floating point operations at all or to have support that is limited to only
|
||||||
|
* single precision. We are able to guess integer sizes on the fly because
|
||||||
|
* integers are always available in at least one size. Floating point, on the
|
||||||
|
* other hand, is sometimes not available at all. Trying to include `float.h` on
|
||||||
|
* these platforms would result in an error. This leaves manual configuration as
|
||||||
|
* the only option.
|
||||||
|
**************************************************************************** */
|
||||||
|
|
||||||
|
/* By default, Unity guesses that you will want single precision floating point
|
||||||
|
* support, but not double precision. It's easy to change either of these using
|
||||||
|
* the include and exclude options here. You may include neither, just float,
|
||||||
|
* or both, as suits your needs.
|
||||||
|
*/
|
||||||
|
/* #define UNITY_EXCLUDE_FLOAT */
|
||||||
|
/* #define UNITY_INCLUDE_DOUBLE */
|
||||||
|
/* #define UNITY_EXCLUDE_DOUBLE */
|
||||||
|
|
||||||
|
/* For features that are enabled, the following floating point options also
|
||||||
|
* become available.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Unity aims for as small of a footprint as possible and avoids most standard
|
||||||
|
* library calls (some embedded platforms don't have a standard library!).
|
||||||
|
* Because of this, its routines for printing integer values are minimalist and
|
||||||
|
* hand-coded. To keep Unity universal, though, we eventually chose to develop
|
||||||
|
* our own floating point print routines. Still, the display of floating point
|
||||||
|
* values during a failure are optional. By default, Unity will print the
|
||||||
|
* actual results of floating point assertion failures. So a failed assertion
|
||||||
|
* will produce a message like "Expected 4.0 Was 4.25". If you would like less
|
||||||
|
* verbose failure messages for floating point assertions, use this option to
|
||||||
|
* give a failure message `"Values Not Within Delta"` and trim the binary size.
|
||||||
|
*/
|
||||||
|
/* #define UNITY_EXCLUDE_FLOAT_PRINT */
|
||||||
|
|
||||||
|
/* If enabled, Unity assumes you want your `FLOAT` asserts to compare standard C
|
||||||
|
* floats. If your compiler supports a specialty floating point type, you can
|
||||||
|
* always override this behavior by using this definition.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_FLOAT_TYPE float16_t */
|
||||||
|
|
||||||
|
/* If enabled, Unity assumes you want your `DOUBLE` asserts to compare standard
|
||||||
|
* C doubles. If you would like to change this, you can specify something else
|
||||||
|
* by using this option. For example, defining `UNITY_DOUBLE_TYPE` to `long
|
||||||
|
* double` could enable gargantuan floating point types on your 64-bit processor
|
||||||
|
* instead of the standard `double`.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_DOUBLE_TYPE long double */
|
||||||
|
|
||||||
|
/* If you look up `UNITY_ASSERT_EQUAL_FLOAT` and `UNITY_ASSERT_EQUAL_DOUBLE` as
|
||||||
|
* documented in the Unity Assertion Guide, you will learn that they are not
|
||||||
|
* really asserting that two values are equal but rather that two values are
|
||||||
|
* "close enough" to equal. "Close enough" is controlled by these precision
|
||||||
|
* configuration options. If you are working with 32-bit floats and/or 64-bit
|
||||||
|
* doubles (the normal on most processors), you should have no need to change
|
||||||
|
* these options. They are both set to give you approximately 1 significant bit
|
||||||
|
* in either direction. The float precision is 0.00001 while the double is
|
||||||
|
* 10^-12. For further details on how this works, see the appendix of the Unity
|
||||||
|
* Assertion Guide.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_FLOAT_PRECISION 0.001f */
|
||||||
|
/* #define UNITY_DOUBLE_PRECISION 0.001f */
|
||||||
|
|
||||||
|
|
||||||
|
/* *************************** TOOLSET CUSTOMIZATION ***************************
|
||||||
|
* In addition to the options listed above, there are a number of other options
|
||||||
|
* which will come in handy to customize Unity's behavior for your specific
|
||||||
|
* toolchain. It is possible that you may not need to touch any of these but
|
||||||
|
* certain platforms, particularly those running in simulators, may need to jump
|
||||||
|
* through extra hoops to operate properly. These macros will help in those
|
||||||
|
* situations.
|
||||||
|
**************************************************************************** */
|
||||||
|
|
||||||
|
/* By default, Unity prints its results to `stdout` as it runs. This works
|
||||||
|
* perfectly fine in most situations where you are using a native compiler for
|
||||||
|
* testing. It works on some simulators as well so long as they have `stdout`
|
||||||
|
* routed back to the command line. There are times, however, where the
|
||||||
|
* simulator will lack support for dumping results or you will want to route
|
||||||
|
* results elsewhere for other reasons. In these cases, you should define the
|
||||||
|
* `UNITY_OUTPUT_CHAR` macro. This macro accepts a single character at a time
|
||||||
|
* (as an `int`, since this is the parameter type of the standard C `putchar`
|
||||||
|
* function most commonly used). You may replace this with whatever function
|
||||||
|
* call you like.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* Say you are forced to run your test suite on an embedded processor with no
|
||||||
|
* `stdout` option. You decide to route your test result output to a custom
|
||||||
|
* serial `RS232_putc()` function you wrote like thus:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
|
||||||
|
/* #define UNITY_OUTPUT_CHAR_HEADER_DECLARATION RS232_putc(int) */
|
||||||
|
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
|
||||||
|
/* #define UNITY_OUTPUT_FLUSH_HEADER_DECLARATION RS232_flush(void) */
|
||||||
|
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
|
||||||
|
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
|
||||||
|
|
||||||
|
/* For some targets, Unity can make the otherwise required `setUp()` and
|
||||||
|
* `tearDown()` functions optional. This is a nice convenience for test writers
|
||||||
|
* since `setUp` and `tearDown` don't often actually _do_ anything. If you're
|
||||||
|
* using gcc or clang, this option is automatically defined for you. Other
|
||||||
|
* compilers can also support this behavior, if they support a C feature called
|
||||||
|
* weak functions. A weak function is a function that is compiled into your
|
||||||
|
* executable _unless_ a non-weak version of the same function is defined
|
||||||
|
* elsewhere. If a non-weak version is found, the weak version is ignored as if
|
||||||
|
* it never existed. If your compiler supports this feature, you can let Unity
|
||||||
|
* know by defining `UNITY_SUPPORT_WEAK` as the function attributes that would
|
||||||
|
* need to be applied to identify a function as weak. If your compiler lacks
|
||||||
|
* support for weak functions, you will always need to define `setUp` and
|
||||||
|
* `tearDown` functions (though they can be and often will be just empty). The
|
||||||
|
* most common options for this feature are:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_SUPPORT_WEAK weak */
|
||||||
|
/* #define UNITY_SUPPORT_WEAK __attribute__((weak)) */
|
||||||
|
/* #define UNITY_NO_WEAK */
|
||||||
|
|
||||||
|
/* Some compilers require a custom attribute to be assigned to pointers, like
|
||||||
|
* `near` or `far`. In these cases, you can give Unity a safe default for these
|
||||||
|
* by defining this option with the attribute you would like.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*/
|
||||||
|
/* #define UNITY_PTR_ATTRIBUTE __attribute__((far)) */
|
||||||
|
/* #define UNITY_PTR_ATTRIBUTE near */
|
||||||
|
|
||||||
|
/* Print execution time of each test when executed in verbose mode
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* TEST - PASS (10 ms)
|
||||||
|
*/
|
||||||
|
/* #define UNITY_INCLUDE_EXEC_TIME */
|
||||||
|
|
||||||
|
#endif /* UNITY_CONFIG_H */
|
924
test/unity/src/c/unity_internals.h
Normal file
924
test/unity/src/c/unity_internals.h
Normal file
|
@ -0,0 +1,924 @@
|
||||||
|
/* ==========================================
|
||||||
|
Unity Project - A Test Framework for C
|
||||||
|
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||||
|
[Released under MIT License. Please refer to license.txt for details]
|
||||||
|
========================================== */
|
||||||
|
|
||||||
|
#ifndef UNITY_INTERNALS_H
|
||||||
|
#define UNITY_INTERNALS_H
|
||||||
|
|
||||||
|
#ifdef UNITY_INCLUDE_CONFIG_H
|
||||||
|
#include "unity_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||||
|
#include <setjmp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_MATH_H
|
||||||
|
#include <math.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Unity Attempts to Auto-Detect Integer Types
|
||||||
|
* Attempt 1: UINT_MAX, ULONG_MAX in <limits.h>, or default to 32 bits
|
||||||
|
* Attempt 2: UINTPTR_MAX in <stdint.h>, or default to same size as long
|
||||||
|
* The user may override any of these derived constants:
|
||||||
|
* UNITY_INT_WIDTH, UNITY_LONG_WIDTH, UNITY_POINTER_WIDTH */
|
||||||
|
#ifndef UNITY_EXCLUDE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_TIME_H
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Guess Widths If Not Specified
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Determine the size of an int, if not already specified.
|
||||||
|
* We cannot use sizeof(int), because it is not yet defined
|
||||||
|
* at this stage in the translation of the C program.
|
||||||
|
* Therefore, infer it from UINT_MAX if possible. */
|
||||||
|
#ifndef UNITY_INT_WIDTH
|
||||||
|
#ifdef UINT_MAX
|
||||||
|
#if (UINT_MAX == 0xFFFF)
|
||||||
|
#define UNITY_INT_WIDTH (16)
|
||||||
|
#elif (UINT_MAX == 0xFFFFFFFF)
|
||||||
|
#define UNITY_INT_WIDTH (32)
|
||||||
|
#elif (UINT_MAX == 0xFFFFFFFFFFFFFFFF)
|
||||||
|
#define UNITY_INT_WIDTH (64)
|
||||||
|
#endif
|
||||||
|
#else /* Set to default */
|
||||||
|
#define UNITY_INT_WIDTH (32)
|
||||||
|
#endif /* UINT_MAX */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Determine the size of a long, if not already specified. */
|
||||||
|
#ifndef UNITY_LONG_WIDTH
|
||||||
|
#ifdef ULONG_MAX
|
||||||
|
#if (ULONG_MAX == 0xFFFF)
|
||||||
|
#define UNITY_LONG_WIDTH (16)
|
||||||
|
#elif (ULONG_MAX == 0xFFFFFFFF)
|
||||||
|
#define UNITY_LONG_WIDTH (32)
|
||||||
|
#elif (ULONG_MAX == 0xFFFFFFFFFFFFFFFF)
|
||||||
|
#define UNITY_LONG_WIDTH (64)
|
||||||
|
#endif
|
||||||
|
#else /* Set to default */
|
||||||
|
#define UNITY_LONG_WIDTH (32)
|
||||||
|
#endif /* ULONG_MAX */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Determine the size of a pointer, if not already specified. */
|
||||||
|
#ifndef UNITY_POINTER_WIDTH
|
||||||
|
#ifdef UINTPTR_MAX
|
||||||
|
#if (UINTPTR_MAX <= 0xFFFF)
|
||||||
|
#define UNITY_POINTER_WIDTH (16)
|
||||||
|
#elif (UINTPTR_MAX <= 0xFFFFFFFF)
|
||||||
|
#define UNITY_POINTER_WIDTH (32)
|
||||||
|
#elif (UINTPTR_MAX <= 0xFFFFFFFFFFFFFFFF)
|
||||||
|
#define UNITY_POINTER_WIDTH (64)
|
||||||
|
#endif
|
||||||
|
#else /* Set to default */
|
||||||
|
#define UNITY_POINTER_WIDTH UNITY_LONG_WIDTH
|
||||||
|
#endif /* UINTPTR_MAX */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Int Support (Define types based on detected sizes)
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if (UNITY_INT_WIDTH == 32)
|
||||||
|
typedef unsigned char UNITY_UINT8;
|
||||||
|
typedef unsigned short UNITY_UINT16;
|
||||||
|
typedef unsigned int UNITY_UINT32;
|
||||||
|
typedef signed char UNITY_INT8;
|
||||||
|
typedef signed short UNITY_INT16;
|
||||||
|
typedef signed int UNITY_INT32;
|
||||||
|
#elif (UNITY_INT_WIDTH == 16)
|
||||||
|
typedef unsigned char UNITY_UINT8;
|
||||||
|
typedef unsigned int UNITY_UINT16;
|
||||||
|
typedef unsigned long UNITY_UINT32;
|
||||||
|
typedef signed char UNITY_INT8;
|
||||||
|
typedef signed int UNITY_INT16;
|
||||||
|
typedef signed long UNITY_INT32;
|
||||||
|
#else
|
||||||
|
#error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* 64-bit Support
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef UNITY_SUPPORT_64
|
||||||
|
#if UNITY_LONG_WIDTH == 64 || UNITY_POINTER_WIDTH == 64
|
||||||
|
#define UNITY_SUPPORT_64
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_SUPPORT_64
|
||||||
|
/* No 64-bit Support */
|
||||||
|
typedef UNITY_UINT32 UNITY_UINT;
|
||||||
|
typedef UNITY_INT32 UNITY_INT;
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* 64-bit Support */
|
||||||
|
#if (UNITY_LONG_WIDTH == 32)
|
||||||
|
typedef unsigned long long UNITY_UINT64;
|
||||||
|
typedef signed long long UNITY_INT64;
|
||||||
|
#elif (UNITY_LONG_WIDTH == 64)
|
||||||
|
typedef unsigned long UNITY_UINT64;
|
||||||
|
typedef signed long UNITY_INT64;
|
||||||
|
#else
|
||||||
|
#error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported)
|
||||||
|
#endif
|
||||||
|
typedef UNITY_UINT64 UNITY_UINT;
|
||||||
|
typedef UNITY_INT64 UNITY_INT;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Pointer Support
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if (UNITY_POINTER_WIDTH == 32)
|
||||||
|
#define UNITY_PTR_TO_INT UNITY_INT32
|
||||||
|
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32
|
||||||
|
#elif (UNITY_POINTER_WIDTH == 64)
|
||||||
|
#define UNITY_PTR_TO_INT UNITY_INT64
|
||||||
|
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64
|
||||||
|
#elif (UNITY_POINTER_WIDTH == 16)
|
||||||
|
#define UNITY_PTR_TO_INT UNITY_INT16
|
||||||
|
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16
|
||||||
|
#else
|
||||||
|
#error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_PTR_ATTRIBUTE
|
||||||
|
#define UNITY_PTR_ATTRIBUTE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_INTERNAL_PTR
|
||||||
|
#define UNITY_INTERNAL_PTR UNITY_PTR_ATTRIBUTE const void*
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Float Support
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
|
||||||
|
/* No Floating Point Support */
|
||||||
|
#ifndef UNITY_EXCLUDE_DOUBLE
|
||||||
|
#define UNITY_EXCLUDE_DOUBLE /* Remove double when excluding float support */
|
||||||
|
#endif
|
||||||
|
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
||||||
|
#define UNITY_EXCLUDE_FLOAT_PRINT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Floating Point Support */
|
||||||
|
#ifndef UNITY_FLOAT_PRECISION
|
||||||
|
#define UNITY_FLOAT_PRECISION (0.00001f)
|
||||||
|
#endif
|
||||||
|
#ifndef UNITY_FLOAT_TYPE
|
||||||
|
#define UNITY_FLOAT_TYPE float
|
||||||
|
#endif
|
||||||
|
typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
|
||||||
|
|
||||||
|
/* isinf & isnan macros should be provided by math.h */
|
||||||
|
#ifndef isinf
|
||||||
|
/* The value of Inf - Inf is NaN */
|
||||||
|
#define isinf(n) (isnan((n) - (n)) && !isnan(n))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef isnan
|
||||||
|
/* NaN is the only floating point value that does NOT equal itself.
|
||||||
|
* Therefore if n != n, then it is NaN. */
|
||||||
|
#define isnan(n) ((n != n) ? 1 : 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Double Float Support
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* unlike float, we DON'T include by default */
|
||||||
|
#if defined(UNITY_EXCLUDE_DOUBLE) || !defined(UNITY_INCLUDE_DOUBLE)
|
||||||
|
|
||||||
|
/* No Floating Point Support */
|
||||||
|
#ifndef UNITY_EXCLUDE_DOUBLE
|
||||||
|
#define UNITY_EXCLUDE_DOUBLE
|
||||||
|
#else
|
||||||
|
#undef UNITY_INCLUDE_DOUBLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_FLOAT
|
||||||
|
#ifndef UNITY_DOUBLE_TYPE
|
||||||
|
#define UNITY_DOUBLE_TYPE double
|
||||||
|
#endif
|
||||||
|
typedef UNITY_FLOAT UNITY_DOUBLE;
|
||||||
|
/* For parameter in UnityPrintFloat(UNITY_DOUBLE), which aliases to double or float */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Double Floating Point Support */
|
||||||
|
#ifndef UNITY_DOUBLE_PRECISION
|
||||||
|
#define UNITY_DOUBLE_PRECISION (1e-12)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_DOUBLE_TYPE
|
||||||
|
#define UNITY_DOUBLE_TYPE double
|
||||||
|
#endif
|
||||||
|
typedef UNITY_DOUBLE_TYPE UNITY_DOUBLE;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Output Method: stdout (DEFAULT)
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
#ifndef UNITY_OUTPUT_CHAR
|
||||||
|
/* Default to using putchar, which is defined in stdio.h */
|
||||||
|
#include <stdio.h>
|
||||||
|
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
|
||||||
|
#else
|
||||||
|
/* If defined as something else, make sure we declare it here so it's ready for use */
|
||||||
|
#ifdef UNITY_OUTPUT_CHAR_HEADER_DECLARATION
|
||||||
|
extern void UNITY_OUTPUT_CHAR_HEADER_DECLARATION;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_OUTPUT_FLUSH
|
||||||
|
#ifdef UNITY_USE_FLUSH_STDOUT
|
||||||
|
/* We want to use the stdout flush utility */
|
||||||
|
#include <stdio.h>
|
||||||
|
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
|
||||||
|
#else
|
||||||
|
/* We've specified nothing, therefore flush should just be ignored */
|
||||||
|
#define UNITY_OUTPUT_FLUSH()
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
/* If defined as something else, make sure we declare it here so it's ready for use */
|
||||||
|
#ifdef UNITY_OUTPUT_FLUSH_HEADER_DECLARATION
|
||||||
|
extern void UNITY_OUTPUT_FLUSH_HEADER_DECLARATION;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_OUTPUT_FLUSH
|
||||||
|
#define UNITY_FLUSH_CALL()
|
||||||
|
#else
|
||||||
|
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_PRINT_EOL
|
||||||
|
#define UNITY_PRINT_EOL() UNITY_OUTPUT_CHAR('\n')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_OUTPUT_START
|
||||||
|
#define UNITY_OUTPUT_START()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_OUTPUT_COMPLETE
|
||||||
|
#define UNITY_OUTPUT_COMPLETE()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXEC_TIME_RESET
|
||||||
|
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||||
|
#define UNITY_EXEC_TIME_RESET()\
|
||||||
|
Unity.CurrentTestStartTime = 0;\
|
||||||
|
Unity.CurrentTestStopTime = 0;
|
||||||
|
#else
|
||||||
|
#define UNITY_EXEC_TIME_RESET()
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXEC_TIME_START
|
||||||
|
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||||
|
#define UNITY_EXEC_TIME_START() Unity.CurrentTestStartTime = UNITY_CLOCK_MS();
|
||||||
|
#else
|
||||||
|
#define UNITY_EXEC_TIME_START()
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXEC_TIME_STOP
|
||||||
|
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||||
|
#define UNITY_EXEC_TIME_STOP() Unity.CurrentTestStopTime = UNITY_CLOCK_MS();
|
||||||
|
#else
|
||||||
|
#define UNITY_EXEC_TIME_STOP()
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_PRINT_EXEC_TIME
|
||||||
|
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||||
|
#define UNITY_PRINT_EXEC_TIME() \
|
||||||
|
UnityPrint(" (");\
|
||||||
|
UNITY_COUNTER_TYPE execTimeMs = (Unity.CurrentTestStopTime - Unity.CurrentTestStartTime);
|
||||||
|
UnityPrintNumberUnsigned(execTimeMs);\
|
||||||
|
UnityPrint(" ms)");
|
||||||
|
#else
|
||||||
|
#define UNITY_PRINT_EXEC_TIME()
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Footprint
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef UNITY_LINE_TYPE
|
||||||
|
#define UNITY_LINE_TYPE UNITY_UINT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_COUNTER_TYPE
|
||||||
|
#define UNITY_COUNTER_TYPE UNITY_UINT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Language Features Available
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
#if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA)
|
||||||
|
# if defined(__GNUC__) || defined(__ghs__) /* __GNUC__ includes clang */
|
||||||
|
# if !(defined(__WIN32__) && defined(__clang__)) && !defined(__TMS470__)
|
||||||
|
# define UNITY_WEAK_ATTRIBUTE __attribute__((weak))
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNITY_NO_WEAK
|
||||||
|
# undef UNITY_WEAK_ATTRIBUTE
|
||||||
|
# undef UNITY_WEAK_PRAGMA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Internal Structs Needed
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef void (*UnityTestFunction)(void);
|
||||||
|
|
||||||
|
#define UNITY_DISPLAY_RANGE_INT (0x10)
|
||||||
|
#define UNITY_DISPLAY_RANGE_UINT (0x20)
|
||||||
|
#define UNITY_DISPLAY_RANGE_HEX (0x40)
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
UNITY_DISPLAY_STYLE_INT = sizeof(int)+ UNITY_DISPLAY_RANGE_INT,
|
||||||
|
UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT,
|
||||||
|
UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT,
|
||||||
|
UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT,
|
||||||
|
#ifdef UNITY_SUPPORT_64
|
||||||
|
UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UNITY_DISPLAY_STYLE_UINT = sizeof(unsigned) + UNITY_DISPLAY_RANGE_UINT,
|
||||||
|
UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT,
|
||||||
|
UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT,
|
||||||
|
UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT,
|
||||||
|
#ifdef UNITY_SUPPORT_64
|
||||||
|
UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX,
|
||||||
|
UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX,
|
||||||
|
UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX,
|
||||||
|
#ifdef UNITY_SUPPORT_64
|
||||||
|
UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UNITY_DISPLAY_STYLE_UNKNOWN
|
||||||
|
} UNITY_DISPLAY_STYLE_T;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
UNITY_EQUAL_TO = 1,
|
||||||
|
UNITY_GREATER_THAN = 2,
|
||||||
|
UNITY_GREATER_OR_EQUAL = 2 + UNITY_EQUAL_TO,
|
||||||
|
UNITY_SMALLER_THAN = 4,
|
||||||
|
UNITY_SMALLER_OR_EQUAL = 4 + UNITY_EQUAL_TO
|
||||||
|
} UNITY_COMPARISON_T;
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_FLOAT
|
||||||
|
typedef enum UNITY_FLOAT_TRAIT
|
||||||
|
{
|
||||||
|
UNITY_FLOAT_IS_NOT_INF = 0,
|
||||||
|
UNITY_FLOAT_IS_INF,
|
||||||
|
UNITY_FLOAT_IS_NOT_NEG_INF,
|
||||||
|
UNITY_FLOAT_IS_NEG_INF,
|
||||||
|
UNITY_FLOAT_IS_NOT_NAN,
|
||||||
|
UNITY_FLOAT_IS_NAN,
|
||||||
|
UNITY_FLOAT_IS_NOT_DET,
|
||||||
|
UNITY_FLOAT_IS_DET,
|
||||||
|
UNITY_FLOAT_INVALID_TRAIT
|
||||||
|
} UNITY_FLOAT_TRAIT_T;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
UNITY_ARRAY_TO_VAL = 0,
|
||||||
|
UNITY_ARRAY_TO_ARRAY
|
||||||
|
} UNITY_FLAGS_T;
|
||||||
|
|
||||||
|
struct UNITY_STORAGE_T
|
||||||
|
{
|
||||||
|
const char* TestFile;
|
||||||
|
const char* CurrentTestName;
|
||||||
|
#ifndef UNITY_EXCLUDE_DETAILS
|
||||||
|
const char* CurrentDetail1;
|
||||||
|
const char* CurrentDetail2;
|
||||||
|
#endif
|
||||||
|
UNITY_LINE_TYPE CurrentTestLineNumber;
|
||||||
|
UNITY_COUNTER_TYPE NumberOfTests;
|
||||||
|
UNITY_COUNTER_TYPE TestFailures;
|
||||||
|
UNITY_COUNTER_TYPE TestIgnores;
|
||||||
|
UNITY_COUNTER_TYPE CurrentTestFailed;
|
||||||
|
UNITY_COUNTER_TYPE CurrentTestIgnored;
|
||||||
|
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||||
|
UNITY_COUNTER_TYPE CurrentTestStartTime;
|
||||||
|
UNITY_COUNTER_TYPE CurrentTestStopTime;
|
||||||
|
#endif
|
||||||
|
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||||
|
jmp_buf AbortFrame;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct UNITY_STORAGE_T Unity;
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Suite Management
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
void UnityBegin(const char* filename);
|
||||||
|
int UnityEnd(void);
|
||||||
|
void UnityConcludeTest(void);
|
||||||
|
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum);
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Details Support
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef UNITY_EXCLUDE_DETAILS
|
||||||
|
#define UNITY_CLR_DETAILS()
|
||||||
|
#define UNITY_SET_DETAIL(d1)
|
||||||
|
#define UNITY_SET_DETAILS(d1,d2)
|
||||||
|
#else
|
||||||
|
#define UNITY_CLR_DETAILS() { Unity.CurrentDetail1 = 0; Unity.CurrentDetail2 = 0; }
|
||||||
|
#define UNITY_SET_DETAIL(d1) { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = 0; }
|
||||||
|
#define UNITY_SET_DETAILS(d1,d2) { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = (d2); }
|
||||||
|
|
||||||
|
#ifndef UNITY_DETAIL1_NAME
|
||||||
|
#define UNITY_DETAIL1_NAME "Function"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_DETAIL2_NAME
|
||||||
|
#define UNITY_DETAIL2_NAME "Argument"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Output
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
void UnityPrint(const char* string);
|
||||||
|
void UnityPrintLen(const char* string, const UNITY_UINT32 length);
|
||||||
|
void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number);
|
||||||
|
void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style);
|
||||||
|
void UnityPrintNumber(const UNITY_INT number_to_print);
|
||||||
|
void UnityPrintNumberUnsigned(const UNITY_UINT number);
|
||||||
|
void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print);
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
||||||
|
void UnityPrintFloat(const UNITY_DOUBLE input_number);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Assertion Functions
|
||||||
|
*-------------------------------------------------------
|
||||||
|
* Use the macros below this section instead of calling
|
||||||
|
* these directly. The macros have a consistent naming
|
||||||
|
* convention and will pull in file and line information
|
||||||
|
* for you. */
|
||||||
|
|
||||||
|
void UnityAssertEqualNumber(const UNITY_INT expected,
|
||||||
|
const UNITY_INT actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_DISPLAY_STYLE_T style);
|
||||||
|
|
||||||
|
void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
|
||||||
|
const UNITY_INT actual,
|
||||||
|
const UNITY_COMPARISON_T compare,
|
||||||
|
const char *msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_DISPLAY_STYLE_T style);
|
||||||
|
|
||||||
|
void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
||||||
|
UNITY_INTERNAL_PTR actual,
|
||||||
|
const UNITY_UINT32 num_elements,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_DISPLAY_STYLE_T style,
|
||||||
|
const UNITY_FLAGS_T flags);
|
||||||
|
|
||||||
|
void UnityAssertBits(const UNITY_INT mask,
|
||||||
|
const UNITY_INT expected,
|
||||||
|
const UNITY_INT actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertEqualString(const char* expected,
|
||||||
|
const char* actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertEqualStringLen(const char* expected,
|
||||||
|
const char* actual,
|
||||||
|
const UNITY_UINT32 length,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertEqualStringArray( UNITY_INTERNAL_PTR expected,
|
||||||
|
const char** actual,
|
||||||
|
const UNITY_UINT32 num_elements,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_FLAGS_T flags);
|
||||||
|
|
||||||
|
void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
|
||||||
|
UNITY_INTERNAL_PTR actual,
|
||||||
|
const UNITY_UINT32 length,
|
||||||
|
const UNITY_UINT32 num_elements,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_FLAGS_T flags);
|
||||||
|
|
||||||
|
void UnityAssertNumbersWithin(const UNITY_UINT delta,
|
||||||
|
const UNITY_INT expected,
|
||||||
|
const UNITY_INT actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_DISPLAY_STYLE_T style);
|
||||||
|
|
||||||
|
void UnityFail(const char* msg, const UNITY_LINE_TYPE line);
|
||||||
|
|
||||||
|
void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line);
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_FLOAT
|
||||||
|
void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
|
||||||
|
const UNITY_FLOAT expected,
|
||||||
|
const UNITY_FLOAT actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
|
||||||
|
UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
|
||||||
|
const UNITY_UINT32 num_elements,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_FLAGS_T flags);
|
||||||
|
|
||||||
|
void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_FLOAT_TRAIT_T style);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_DOUBLE
|
||||||
|
void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
|
||||||
|
const UNITY_DOUBLE expected,
|
||||||
|
const UNITY_DOUBLE actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber);
|
||||||
|
|
||||||
|
void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
|
||||||
|
UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
|
||||||
|
const UNITY_UINT32 num_elements,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_FLAGS_T flags);
|
||||||
|
|
||||||
|
void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
||||||
|
const char* msg,
|
||||||
|
const UNITY_LINE_TYPE lineNumber,
|
||||||
|
const UNITY_FLOAT_TRAIT_T style);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Helpers
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size);
|
||||||
|
#ifndef UNITY_EXCLUDE_FLOAT
|
||||||
|
UNITY_INTERNAL_PTR UnityFloatToPtr(const float num);
|
||||||
|
#endif
|
||||||
|
#ifndef UNITY_EXCLUDE_DOUBLE
|
||||||
|
UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Error Strings We Might Need
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern const char UnityStrErrFloat[];
|
||||||
|
extern const char UnityStrErrDouble[];
|
||||||
|
extern const char UnityStrErr64[];
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Running Macros
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||||
|
#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)
|
||||||
|
#define TEST_ABORT() longjmp(Unity.AbortFrame, 1)
|
||||||
|
#else
|
||||||
|
#define TEST_PROTECT() 1
|
||||||
|
#define TEST_ABORT() return
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_TIME_H
|
||||||
|
#define UNITY_CLOCK_MS() (UNITY_COUNTER_TYPE)((clock() * 1000) / CLOCKS_PER_SEC)
|
||||||
|
#else
|
||||||
|
#define UNITY_CLOCK_MS()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__) */
|
||||||
|
#ifndef RUN_TEST
|
||||||
|
#ifdef __STDC_VERSION__
|
||||||
|
#if __STDC_VERSION__ >= 199901L
|
||||||
|
#define RUN_TEST(...) UnityDefaultTestRun(RUN_TEST_FIRST(__VA_ARGS__), RUN_TEST_SECOND(__VA_ARGS__))
|
||||||
|
#define RUN_TEST_FIRST(...) RUN_TEST_FIRST_HELPER(__VA_ARGS__, throwaway)
|
||||||
|
#define RUN_TEST_FIRST_HELPER(first, ...) (first), #first
|
||||||
|
#define RUN_TEST_SECOND(...) RUN_TEST_SECOND_HELPER(__VA_ARGS__, __LINE__, throwaway)
|
||||||
|
#define RUN_TEST_SECOND_HELPER(first, second, ...) (second)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If we can't do the tricky version, we'll just have to require them to always include the line number */
|
||||||
|
#ifndef RUN_TEST
|
||||||
|
#ifdef CMOCK
|
||||||
|
#define RUN_TEST(func, num) UnityDefaultTestRun(func, #func, num)
|
||||||
|
#else
|
||||||
|
#define RUN_TEST(func) UnityDefaultTestRun(func, #func, __LINE__)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TEST_LINE_NUM (Unity.CurrentTestLineNumber)
|
||||||
|
#define TEST_IS_IGNORED (Unity.CurrentTestIgnored)
|
||||||
|
#define UNITY_NEW_TEST(a) \
|
||||||
|
Unity.CurrentTestName = (a); \
|
||||||
|
Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)(__LINE__); \
|
||||||
|
Unity.NumberOfTests++;
|
||||||
|
|
||||||
|
#ifndef UNITY_BEGIN
|
||||||
|
#define UNITY_BEGIN() UnityBegin(__FILE__)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UNITY_END
|
||||||
|
#define UNITY_END() UnityEnd()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------
|
||||||
|
* Command Line Argument Support
|
||||||
|
*-----------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef UNITY_USE_COMMAND_LINE_ARGS
|
||||||
|
int UnityParseOptions(int argc, char** argv);
|
||||||
|
int UnityTestMatches(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Basic Fail and Ignore
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)(line))
|
||||||
|
#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)(line))
|
||||||
|
|
||||||
|
/*-------------------------------------------------------
|
||||||
|
* Test Asserts
|
||||||
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}
|
||||||
|
#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)(line), (message))
|
||||||
|
#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)(line), (message))
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||||
|
#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((UNITY_INT)(mask), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||||
|
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||||
|
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||||
|
#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||||
|
#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||||
|
#define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||||
|
#define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||||
|
#define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||||
|
#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||||
|
#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||||
|
#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((UNITY_PTR_TO_INT)(expected), (UNITY_PTR_TO_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len, line, message) UnityAssertEqualStringLen((const char*)(expected), (const char*)(actual), (UNITY_UINT32)(len), (message), (UNITY_LINE_TYPE)(line))
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), 1, (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((UNITY_INTERNAL_PTR)(expected), (const char**)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||||
|
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), sizeof(int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), sizeof(unsigned int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT16)(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT32)(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_PTR_TO_INT) (expected), sizeof(int*)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_STRING(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((UNITY_INTERNAL_PTR)(expected), (const char**)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||||
|
|
||||||
|
#ifdef UNITY_SUPPORT_64
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||||
|
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||||
|
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||||
|
#else
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_INT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
|
||||||
|
#else
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((UNITY_FLOAT)(delta), (UNITY_FLOAT)(expected), (UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((UNITY_FLOAT)(expected) * (UNITY_FLOAT)UNITY_FLOAT_PRECISION, (UNITY_FLOAT)(expected), (UNITY_FLOAT)(actual), (UNITY_LINE_TYPE)(line), (message))
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((UNITY_FLOAT*)(expected), (UNITY_FLOAT*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_FLOAT(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray(UnityFloatToPtr(expected), (UNITY_FLOAT*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_DET)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NEG_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NAN)
|
||||||
|
#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message) UnityAssertFloatSpecial((UNITY_FLOAT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_DET)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||||
|
#else
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((UNITY_DOUBLE)(delta), (UNITY_DOUBLE)(expected), (UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((UNITY_DOUBLE)(expected) * (UNITY_DOUBLE)UNITY_DOUBLE_PRECISION, (UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual, (UNITY_LINE_TYPE)(line), message)
|
||||||
|
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((UNITY_DOUBLE*)(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_ARRAY_TO_ARRAY)
|
||||||
|
#define UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray(UnityDoubleToPtr(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_ARRAY_TO_VAL)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_DET)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NEG_INF)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NAN)
|
||||||
|
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_DET)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* End of UNITY_INTERNALS_H */
|
||||||
|
#endif
|
460
test/unity/src/ruby/generate_test_runner.rb
Normal file
460
test/unity/src/ruby/generate_test_runner.rb
Normal file
|
@ -0,0 +1,460 @@
|
||||||
|
# ==========================================
|
||||||
|
# Unity Project - A Test Framework for C
|
||||||
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||||
|
# [Released under MIT License. Please refer to license.txt for details]
|
||||||
|
# ==========================================
|
||||||
|
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), 'colour_prompt'))
|
||||||
|
|
||||||
|
class UnityTestRunnerGenerator
|
||||||
|
def initialize(options = nil)
|
||||||
|
@options = UnityTestRunnerGenerator.default_options
|
||||||
|
case options
|
||||||
|
when NilClass then @options
|
||||||
|
when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
||||||
|
when Hash then @options.merge!(options)
|
||||||
|
else raise 'If you specify arguments, it should be a filename or a hash of options'
|
||||||
|
end
|
||||||
|
require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer"
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.default_options
|
||||||
|
{
|
||||||
|
includes: [],
|
||||||
|
defines: [],
|
||||||
|
plugins: [],
|
||||||
|
framework: :unity,
|
||||||
|
test_prefix: 'test|spec|should',
|
||||||
|
mock_prefix: 'Mock',
|
||||||
|
mock_suffix: '',
|
||||||
|
setup_name: 'setUp',
|
||||||
|
teardown_name: 'tearDown',
|
||||||
|
main_name: 'main', # set to :auto to automatically generate each time
|
||||||
|
main_export_decl: '',
|
||||||
|
cmdline_args: false,
|
||||||
|
use_param_tests: false
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.grab_config(config_file)
|
||||||
|
options = default_options
|
||||||
|
unless config_file.nil? || config_file.empty?
|
||||||
|
require 'yaml'
|
||||||
|
yaml_guts = YAML.load_file(config_file)
|
||||||
|
options.merge!(yaml_guts[:unity] || yaml_guts[:cmock])
|
||||||
|
raise "No :unity or :cmock section found in #{config_file}" unless options
|
||||||
|
end
|
||||||
|
options
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(input_file, output_file, options = nil)
|
||||||
|
@options.merge!(options) unless options.nil?
|
||||||
|
|
||||||
|
# pull required data from source file
|
||||||
|
source = File.read(input_file)
|
||||||
|
source = source.force_encoding('ISO-8859-1').encode('utf-8', replace: nil)
|
||||||
|
tests = find_tests(source)
|
||||||
|
headers = find_includes(source)
|
||||||
|
testfile_includes = (headers[:local] + headers[:system])
|
||||||
|
used_mocks = find_mocks(testfile_includes)
|
||||||
|
testfile_includes = (testfile_includes - used_mocks)
|
||||||
|
testfile_includes.delete_if { |inc| inc =~ /(unity|cmock)/ }
|
||||||
|
|
||||||
|
# build runner file
|
||||||
|
generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
||||||
|
|
||||||
|
# determine which files were used to return them
|
||||||
|
all_files_used = [input_file, output_file]
|
||||||
|
all_files_used += testfile_includes.map { |filename| filename + '.c' } unless testfile_includes.empty?
|
||||||
|
all_files_used += @options[:includes] unless @options[:includes].empty?
|
||||||
|
all_files_used += headers[:linkonly] unless headers[:linkonly].empty?
|
||||||
|
all_files_used.uniq
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
||||||
|
File.open(output_file, 'w') do |output|
|
||||||
|
create_header(output, used_mocks, testfile_includes)
|
||||||
|
create_externs(output, tests, used_mocks)
|
||||||
|
create_mock_management(output, used_mocks)
|
||||||
|
create_suite_setup(output)
|
||||||
|
create_suite_teardown(output)
|
||||||
|
create_reset(output, used_mocks)
|
||||||
|
create_main(output, input_file, tests, used_mocks)
|
||||||
|
end
|
||||||
|
|
||||||
|
return unless @options[:header_file] && !@options[:header_file].empty?
|
||||||
|
|
||||||
|
File.open(@options[:header_file], 'w') do |output|
|
||||||
|
create_h_file(output, @options[:header_file], tests, testfile_includes, used_mocks)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_tests(source)
|
||||||
|
tests_and_line_numbers = []
|
||||||
|
|
||||||
|
source_scrubbed = source.clone
|
||||||
|
source_scrubbed = source_scrubbed.gsub(/"[^"\n]*"/, '') # remove things in strings
|
||||||
|
source_scrubbed = source_scrubbed.gsub(/\/\/.*$/, '') # remove line comments
|
||||||
|
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
||||||
|
lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
|
||||||
|
| (;|\{|\}) /x) # Match ;, {, and } as end of lines
|
||||||
|
|
||||||
|
lines.each_with_index do |line, _index|
|
||||||
|
# find tests
|
||||||
|
next unless line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/
|
||||||
|
arguments = Regexp.last_match(1)
|
||||||
|
name = Regexp.last_match(2)
|
||||||
|
call = Regexp.last_match(3)
|
||||||
|
params = Regexp.last_match(4)
|
||||||
|
args = nil
|
||||||
|
if @options[:use_param_tests] && !arguments.empty?
|
||||||
|
args = []
|
||||||
|
arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) { |a| args << a[0] }
|
||||||
|
end
|
||||||
|
tests_and_line_numbers << { test: name, args: args, call: call, params: params, line_number: 0 }
|
||||||
|
end
|
||||||
|
tests_and_line_numbers.uniq! { |v| v[:test] }
|
||||||
|
|
||||||
|
# determine line numbers and create tests to run
|
||||||
|
source_lines = source.split("\n")
|
||||||
|
source_index = 0
|
||||||
|
tests_and_line_numbers.size.times do |i|
|
||||||
|
source_lines[source_index..-1].each_with_index do |line, index|
|
||||||
|
next unless line =~ /\s+#{tests_and_line_numbers[i][:test]}(?:\s|\()/
|
||||||
|
source_index += index
|
||||||
|
tests_and_line_numbers[i][:line_number] = source_index + 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tests_and_line_numbers
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_includes(source)
|
||||||
|
# remove comments (block and line, in three steps to ensure correct precedence)
|
||||||
|
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
||||||
|
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
||||||
|
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
||||||
|
|
||||||
|
# parse out includes
|
||||||
|
includes = {
|
||||||
|
local: source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten,
|
||||||
|
system: source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" },
|
||||||
|
linkonly: source.scan(/^TEST_FILE\(\s*\"\s*(.+)\.[cC]\w*\s*\"/).flatten
|
||||||
|
}
|
||||||
|
includes
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_mocks(includes)
|
||||||
|
mock_headers = []
|
||||||
|
includes.each do |include_path|
|
||||||
|
include_file = File.basename(include_path)
|
||||||
|
mock_headers << include_path if include_file =~ /^#{@options[:mock_prefix]}.*#{@options[:mock_suffix]}$/i
|
||||||
|
end
|
||||||
|
mock_headers
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_header(output, mocks, testfile_includes = [])
|
||||||
|
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
||||||
|
create_runtest(output, mocks)
|
||||||
|
output.puts("\n/*=======Automagically Detected Files To Include=====*/")
|
||||||
|
output.puts('#ifdef __WIN32__')
|
||||||
|
output.puts('#define UNITY_INCLUDE_SETUP_STUBS')
|
||||||
|
output.puts('#endif')
|
||||||
|
output.puts("#include \"#{@options[:framework]}.h\"")
|
||||||
|
output.puts('#include "cmock.h"') unless mocks.empty?
|
||||||
|
output.puts('#ifndef UNITY_EXCLUDE_SETJMP_H')
|
||||||
|
output.puts('#include <setjmp.h>')
|
||||||
|
output.puts("#endif")
|
||||||
|
output.puts('#include <stdio.h>')
|
||||||
|
if @options[:defines] && !@options[:defines].empty?
|
||||||
|
@options[:defines].each { |d| output.puts("#define #{d}") }
|
||||||
|
end
|
||||||
|
if @options[:header_file] && !@options[:header_file].empty?
|
||||||
|
output.puts("#include \"#{File.basename(@options[:header_file])}\"")
|
||||||
|
else
|
||||||
|
@options[:includes].flatten.uniq.compact.each do |inc|
|
||||||
|
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
||||||
|
end
|
||||||
|
testfile_includes.each do |inc|
|
||||||
|
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
mocks.each do |mock|
|
||||||
|
output.puts("#include \"#{mock.gsub('.h', '')}.h\"")
|
||||||
|
end
|
||||||
|
output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
|
||||||
|
|
||||||
|
return unless @options[:enforce_strict_ordering]
|
||||||
|
|
||||||
|
output.puts('')
|
||||||
|
output.puts('int GlobalExpectCount;')
|
||||||
|
output.puts('int GlobalVerifyOrder;')
|
||||||
|
output.puts('char* GlobalOrderError;')
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_externs(output, tests, _mocks)
|
||||||
|
output.puts("\n/*=======External Functions This Runner Calls=====*/")
|
||||||
|
output.puts("extern void #{@options[:setup_name]}(void);")
|
||||||
|
output.puts("extern void #{@options[:teardown_name]}(void);")
|
||||||
|
output.puts("\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif") if @options[:externc]
|
||||||
|
tests.each do |test|
|
||||||
|
output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
|
||||||
|
end
|
||||||
|
output.puts("#ifdef __cplusplus\n}\n#endif") if @options[:externc]
|
||||||
|
output.puts('')
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_mock_management(output, mock_headers)
|
||||||
|
return if mock_headers.empty?
|
||||||
|
|
||||||
|
output.puts("\n/*=======Mock Management=====*/")
|
||||||
|
output.puts('static void CMock_Init(void)')
|
||||||
|
output.puts('{')
|
||||||
|
|
||||||
|
if @options[:enforce_strict_ordering]
|
||||||
|
output.puts(' GlobalExpectCount = 0;')
|
||||||
|
output.puts(' GlobalVerifyOrder = 0;')
|
||||||
|
output.puts(' GlobalOrderError = NULL;')
|
||||||
|
end
|
||||||
|
|
||||||
|
mocks = mock_headers.map { |mock| File.basename(mock) }
|
||||||
|
mocks.each do |mock|
|
||||||
|
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
||||||
|
output.puts(" #{mock_clean}_Init();")
|
||||||
|
end
|
||||||
|
output.puts("}\n")
|
||||||
|
|
||||||
|
output.puts('static void CMock_Verify(void)')
|
||||||
|
output.puts('{')
|
||||||
|
mocks.each do |mock|
|
||||||
|
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
||||||
|
output.puts(" #{mock_clean}_Verify();")
|
||||||
|
end
|
||||||
|
output.puts("}\n")
|
||||||
|
|
||||||
|
output.puts('static void CMock_Destroy(void)')
|
||||||
|
output.puts('{')
|
||||||
|
mocks.each do |mock|
|
||||||
|
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
||||||
|
output.puts(" #{mock_clean}_Destroy();")
|
||||||
|
end
|
||||||
|
output.puts("}\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_suite_setup(output)
|
||||||
|
output.puts("\n/*=======Suite Setup=====*/")
|
||||||
|
output.puts('static void suite_setup(void)')
|
||||||
|
output.puts('{')
|
||||||
|
if @options[:suite_setup].nil?
|
||||||
|
# New style, call suiteSetUp() if we can use weak symbols
|
||||||
|
output.puts('#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)')
|
||||||
|
output.puts(' suiteSetUp();')
|
||||||
|
output.puts('#endif')
|
||||||
|
else
|
||||||
|
# Old style, C code embedded in the :suite_setup option
|
||||||
|
output.puts(@options[:suite_setup])
|
||||||
|
end
|
||||||
|
output.puts('}')
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_suite_teardown(output)
|
||||||
|
output.puts("\n/*=======Suite Teardown=====*/")
|
||||||
|
output.puts('static int suite_teardown(int num_failures)')
|
||||||
|
output.puts('{')
|
||||||
|
if @options[:suite_teardown].nil?
|
||||||
|
# New style, call suiteTearDown() if we can use weak symbols
|
||||||
|
output.puts('#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)')
|
||||||
|
output.puts(' return suiteTearDown(num_failures);')
|
||||||
|
output.puts('#else')
|
||||||
|
output.puts(' return num_failures;')
|
||||||
|
output.puts('#endif')
|
||||||
|
else
|
||||||
|
# Old style, C code embedded in the :suite_teardown option
|
||||||
|
output.puts(@options[:suite_teardown])
|
||||||
|
end
|
||||||
|
output.puts('}')
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_runtest(output, used_mocks)
|
||||||
|
cexception = @options[:plugins].include? :cexception
|
||||||
|
va_args1 = @options[:use_param_tests] ? ', ...' : ''
|
||||||
|
va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : ''
|
||||||
|
output.puts("\n/*=======Test Runner Used To Run Each Test Below=====*/")
|
||||||
|
output.puts('#define RUN_TEST_NO_ARGS') if @options[:use_param_tests]
|
||||||
|
output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
|
||||||
|
output.puts('{ \\')
|
||||||
|
output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
|
||||||
|
output.puts(' Unity.CurrentTestLineNumber = TestLineNum; \\')
|
||||||
|
output.puts(' if (UnityTestMatches()) { \\') if @options[:cmdline_args]
|
||||||
|
output.puts(' Unity.NumberOfTests++; \\')
|
||||||
|
output.puts(' CMock_Init(); \\') unless used_mocks.empty?
|
||||||
|
output.puts(' UNITY_CLR_DETAILS(); \\') unless used_mocks.empty?
|
||||||
|
output.puts(' if (TEST_PROTECT()) \\')
|
||||||
|
output.puts(' { \\')
|
||||||
|
output.puts(' CEXCEPTION_T e; \\') if cexception
|
||||||
|
output.puts(' Try { \\') if cexception
|
||||||
|
output.puts(" #{@options[:setup_name]}(); \\")
|
||||||
|
output.puts(" TestFunc(#{va_args2}); \\")
|
||||||
|
output.puts(' } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \\') if cexception
|
||||||
|
output.puts(' } \\')
|
||||||
|
output.puts(' if (TEST_PROTECT()) \\')
|
||||||
|
output.puts(' { \\')
|
||||||
|
output.puts(" #{@options[:teardown_name]}(); \\")
|
||||||
|
output.puts(' CMock_Verify(); \\') unless used_mocks.empty?
|
||||||
|
output.puts(' } \\')
|
||||||
|
output.puts(' CMock_Destroy(); \\') unless used_mocks.empty?
|
||||||
|
output.puts(' UnityConcludeTest(); \\')
|
||||||
|
output.puts(' } \\') if @options[:cmdline_args]
|
||||||
|
output.puts("}\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_reset(output, used_mocks)
|
||||||
|
output.puts("\n/*=======Test Reset Option=====*/")
|
||||||
|
output.puts('void resetTest(void);')
|
||||||
|
output.puts('void resetTest(void)')
|
||||||
|
output.puts('{')
|
||||||
|
output.puts(' CMock_Verify();') unless used_mocks.empty?
|
||||||
|
output.puts(' CMock_Destroy();') unless used_mocks.empty?
|
||||||
|
output.puts(" #{@options[:teardown_name]}();")
|
||||||
|
output.puts(' CMock_Init();') unless used_mocks.empty?
|
||||||
|
output.puts(" #{@options[:setup_name]}();")
|
||||||
|
output.puts('}')
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_main(output, filename, tests, used_mocks)
|
||||||
|
output.puts("\n\n/*=======MAIN=====*/")
|
||||||
|
main_name = @options[:main_name].to_sym == :auto ? "main_#{filename.gsub('.c', '')}" : (@options[:main_name]).to_s
|
||||||
|
if @options[:cmdline_args]
|
||||||
|
if main_name != 'main'
|
||||||
|
output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv);")
|
||||||
|
end
|
||||||
|
output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv)")
|
||||||
|
output.puts('{')
|
||||||
|
output.puts(' int parse_status = UnityParseOptions(argc, argv);')
|
||||||
|
output.puts(' if (parse_status != 0)')
|
||||||
|
output.puts(' {')
|
||||||
|
output.puts(' if (parse_status < 0)')
|
||||||
|
output.puts(' {')
|
||||||
|
output.puts(" UnityPrint(\"#{filename.gsub('.c', '')}.\");")
|
||||||
|
output.puts(' UNITY_PRINT_EOL();')
|
||||||
|
if @options[:use_param_tests]
|
||||||
|
tests.each do |test|
|
||||||
|
if test[:args].nil? || test[:args].empty?
|
||||||
|
output.puts(" UnityPrint(\" #{test[:test]}(RUN_TEST_NO_ARGS)\");")
|
||||||
|
output.puts(' UNITY_PRINT_EOL();')
|
||||||
|
else
|
||||||
|
test[:args].each do |args|
|
||||||
|
output.puts(" UnityPrint(\" #{test[:test]}(#{args})\");")
|
||||||
|
output.puts(' UNITY_PRINT_EOL();')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tests.each { |test| output.puts(" UnityPrint(\" #{test[:test]}\");\n UNITY_PRINT_EOL();") }
|
||||||
|
end
|
||||||
|
output.puts(' return 0;')
|
||||||
|
output.puts(' }')
|
||||||
|
output.puts(' return parse_status;')
|
||||||
|
output.puts(' }')
|
||||||
|
else
|
||||||
|
if main_name != 'main'
|
||||||
|
output.puts("#{@options[:main_export_decl]} int #{main_name}(void);")
|
||||||
|
end
|
||||||
|
output.puts("int #{main_name}(void)")
|
||||||
|
output.puts('{')
|
||||||
|
end
|
||||||
|
output.puts(' suite_setup();')
|
||||||
|
output.puts(" UnityBegin(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
|
||||||
|
if @options[:use_param_tests]
|
||||||
|
tests.each do |test|
|
||||||
|
if test[:args].nil? || test[:args].empty?
|
||||||
|
output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);")
|
||||||
|
else
|
||||||
|
test[:args].each { |args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
|
||||||
|
end
|
||||||
|
output.puts
|
||||||
|
output.puts(' CMock_Guts_MemFreeFinal();') unless used_mocks.empty?
|
||||||
|
output.puts(" return suite_teardown(UnityEnd());")
|
||||||
|
output.puts('}')
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_h_file(output, filename, tests, testfile_includes, used_mocks)
|
||||||
|
filename = File.basename(filename).gsub(/[-\/\\\.\,\s]/, '_').upcase
|
||||||
|
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
||||||
|
output.puts("#ifndef _#{filename}")
|
||||||
|
output.puts("#define _#{filename}\n\n")
|
||||||
|
output.puts("#include \"#{@options[:framework]}.h\"")
|
||||||
|
output.puts('#include "cmock.h"') unless used_mocks.empty?
|
||||||
|
@options[:includes].flatten.uniq.compact.each do |inc|
|
||||||
|
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
||||||
|
end
|
||||||
|
testfile_includes.each do |inc|
|
||||||
|
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
||||||
|
end
|
||||||
|
output.puts "\n"
|
||||||
|
tests.each do |test|
|
||||||
|
if test[:params].nil? || test[:params].empty?
|
||||||
|
output.puts("void #{test[:test]}(void);")
|
||||||
|
else
|
||||||
|
output.puts("void #{test[:test]}(#{test[:params]});")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
output.puts("#endif\n\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if $0 == __FILE__
|
||||||
|
options = { includes: [] }
|
||||||
|
|
||||||
|
# parse out all the options first (these will all be removed as we go)
|
||||||
|
ARGV.reject! do |arg|
|
||||||
|
case arg
|
||||||
|
when '-cexception'
|
||||||
|
options[:plugins] = [:cexception]
|
||||||
|
true
|
||||||
|
when /\.*\.ya?ml/
|
||||||
|
options = UnityTestRunnerGenerator.grab_config(arg)
|
||||||
|
true
|
||||||
|
when /--(\w+)=\"?(.*)\"?/
|
||||||
|
options[Regexp.last_match(1).to_sym] = Regexp.last_match(2)
|
||||||
|
true
|
||||||
|
when /\.*\.h/
|
||||||
|
options[:includes] << arg
|
||||||
|
true
|
||||||
|
else false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# make sure there is at least one parameter left (the input file)
|
||||||
|
unless ARGV[0]
|
||||||
|
puts ["\nusage: ruby #{__FILE__} (files) (options) input_test_file (output)",
|
||||||
|
"\n input_test_file - this is the C file you want to create a runner for",
|
||||||
|
' output - this is the name of the runner file to generate',
|
||||||
|
' defaults to (input_test_file)_Runner',
|
||||||
|
' files:',
|
||||||
|
' *.yml / *.yaml - loads configuration from here in :unity or :cmock',
|
||||||
|
' *.h - header files are added as #includes in runner',
|
||||||
|
' options:',
|
||||||
|
' -cexception - include cexception support',
|
||||||
|
' -externc - add extern "C" for cpp support',
|
||||||
|
' --setup_name="" - redefine setUp func name to something else',
|
||||||
|
' --teardown_name="" - redefine tearDown func name to something else',
|
||||||
|
' --main_name="" - redefine main func name to something else',
|
||||||
|
' --test_prefix="" - redefine test prefix from default test|spec|should',
|
||||||
|
' --suite_setup="" - code to execute for setup of entire suite',
|
||||||
|
' --suite_teardown="" - code to execute for teardown of entire suite',
|
||||||
|
' --use_param_tests=1 - enable parameterized tests (disabled by default)',
|
||||||
|
' --header_file="" - path/name of test header file to generate too'].join("\n")
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# create the default test runner name if not specified
|
||||||
|
ARGV[1] = ARGV[0].gsub('.c', '_Runner.c') unless ARGV[1]
|
||||||
|
|
||||||
|
UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
|
||||||
|
end
|
6
test/unity/src/ruby/type_sanitizer.rb
Normal file
6
test/unity/src/ruby/type_sanitizer.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
module TypeSanitizer
|
||||||
|
def self.sanitize_c_identifier(unsanitized)
|
||||||
|
# convert filename to valid C identifier by replacing invalid chars with '_'
|
||||||
|
unsanitized.gsub(/[-\/\\\.\,\s]/, '_')
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue