mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-10-19 05:13:05 +08:00
Added support for 16-bit processors via BUS_WIDTH=16 preprocessor define. Defaults to 32-bit if unspecified.
Updated iar_msp430.yml to use full IAR MSP430 edition and use new BUS-WIDTH define. git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@40 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 Evaluation\'
|
||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\'
|
||||
core_root: &core_root [*tools_root, '430\']
|
||||
core_bin: &core_bin [*core_root, 'bin\']
|
||||
core_config: &core_config [*core_root, 'config\']
|
||||
@ -21,6 +21,7 @@ compiler:
|
||||
- --no_tbaa
|
||||
- --debug
|
||||
- -D__MSP430F149__
|
||||
- -DBUS_WIDTH=16
|
||||
- -DUNITY_FLOAT_SUPPORT_DISABLED
|
||||
- -e
|
||||
- -Ol
|
||||
|
119
src/unity.c
119
src/unity.c
@ -204,7 +204,7 @@ void UnityAssertBits(const long mask,
|
||||
}
|
||||
}
|
||||
|
||||
void UnityAssertEqualInt(const long expected,
|
||||
void UnityAssertEqualNumber(const long expected,
|
||||
const long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
@ -229,16 +229,92 @@ void UnityAssertEqualInt(const long expected,
|
||||
}
|
||||
}
|
||||
|
||||
void UnityAssertEqualIntArray(const long* expected,
|
||||
const long* actual,
|
||||
void UnityAssertEqualNumberUnsigned(const unsigned long expected,
|
||||
const unsigned long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style)
|
||||
{
|
||||
if (expected != actual)
|
||||
{
|
||||
Unity.CurrentTestFailed = 1;
|
||||
|
||||
UnityTestResultsBegin(lineNumber);
|
||||
UnityPrint("Expected ");
|
||||
UnityPrintNumberByStyle(expected, style);
|
||||
UnityPrint(" was ");
|
||||
UnityPrintNumberByStyle(actual, style);
|
||||
UnityPrintChar('.');
|
||||
if (msg)
|
||||
{
|
||||
UnityPrintChar(' ');
|
||||
UnityPrint(msg);
|
||||
}
|
||||
UnityPrintChar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
void UnityAssertEqualIntArray(const int* expected,
|
||||
const int* actual,
|
||||
const unsigned long num_elements,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style)
|
||||
{
|
||||
unsigned long elements = num_elements;
|
||||
const long* ptr_expected = expected;
|
||||
const long* ptr_actual = actual;
|
||||
const int* ptr_expected = expected;
|
||||
const int* ptr_actual = actual;
|
||||
|
||||
if (elements == 0)
|
||||
{
|
||||
Unity.CurrentTestFailed = 1;
|
||||
|
||||
UnityTestResultsBegin(lineNumber);
|
||||
UnityPrint("You asked me to compare 0 elements of an array, which was pointless.");
|
||||
if (msg)
|
||||
{
|
||||
UnityPrintChar(' ');
|
||||
UnityPrint(msg);
|
||||
}
|
||||
UnityPrintChar('\n');
|
||||
return;
|
||||
}
|
||||
|
||||
while (elements--)
|
||||
{
|
||||
if (*ptr_expected++ != *ptr_actual++)
|
||||
{
|
||||
Unity.CurrentTestFailed = 1;
|
||||
|
||||
UnityTestResultsBegin(lineNumber);
|
||||
UnityPrint("Element ");
|
||||
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
||||
UnityPrint(" Expected ");
|
||||
UnityPrintNumberByStyle(*--ptr_expected, style);
|
||||
UnityPrint(" was ");
|
||||
UnityPrintNumberByStyle(*--ptr_actual, style);
|
||||
UnityPrintChar('.');
|
||||
if (msg)
|
||||
{
|
||||
UnityPrintChar(' ');
|
||||
UnityPrint(msg);
|
||||
}
|
||||
UnityPrintChar('\n');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UnityAssertEqualUnsignedIntArray(const unsigned int* expected,
|
||||
const unsigned int* actual,
|
||||
const unsigned long num_elements,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style)
|
||||
{
|
||||
unsigned long elements = num_elements;
|
||||
const unsigned int* ptr_expected = expected;
|
||||
const unsigned int* ptr_actual = actual;
|
||||
|
||||
if (elements == 0)
|
||||
{
|
||||
@ -307,13 +383,13 @@ void UnityAssertFloatsWithin(const float delta,
|
||||
}
|
||||
}
|
||||
|
||||
void UnityAssertIntsWithin(const long delta,
|
||||
void UnityAssertNumbersWithin(const long delta,
|
||||
const long expected,
|
||||
const long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber)
|
||||
{
|
||||
long diff = actual - expected;
|
||||
int diff = actual - expected;
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
@ -324,7 +400,29 @@ void UnityAssertIntsWithin(const long delta,
|
||||
{
|
||||
Unity.CurrentTestFailed = 1;
|
||||
UnityTestResultsBegin(lineNumber);
|
||||
UnityPrint("Ints not within delta.");
|
||||
UnityPrint("Values not within delta.");
|
||||
if (msg)
|
||||
{
|
||||
UnityPrintChar(' ');
|
||||
UnityPrint(msg);
|
||||
}
|
||||
UnityPrintChar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
void UnityAssertNumbersUnsignedWithin(const unsigned long delta,
|
||||
const unsigned long expected,
|
||||
const unsigned long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber)
|
||||
{
|
||||
unsigned int diff = actual - expected;
|
||||
|
||||
if (delta < diff)
|
||||
{
|
||||
Unity.CurrentTestFailed = 1;
|
||||
UnityTestResultsBegin(lineNumber);
|
||||
UnityPrint("Values not within delta.");
|
||||
if (msg)
|
||||
{
|
||||
UnityPrintChar(' ');
|
||||
@ -455,8 +553,3 @@ void UnityEnd(void)
|
||||
UnityPrint("FAIL\n");
|
||||
}
|
||||
}
|
||||
|
||||
long UnityGetNumFailures(void)
|
||||
{
|
||||
return Unity.TestFailures;
|
||||
}
|
||||
|
94
src/unity.h
94
src/unity.h
@ -6,6 +6,30 @@
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Bus Width Management
|
||||
//-------------------------------------------------------
|
||||
|
||||
#if defined(BUS_WIDTH) && (BUS_WIDTH != 32)
|
||||
#if (BUS_WIDTH == 16)
|
||||
typedef unsigned char U8;
|
||||
typedef unsigned int U16;
|
||||
typedef unsigned long U32;
|
||||
typedef signed char S8;
|
||||
typedef signed int S16;
|
||||
typedef signed long S32;
|
||||
#endif
|
||||
#else
|
||||
typedef unsigned char U8;
|
||||
typedef unsigned short U16;
|
||||
typedef unsigned int U32;
|
||||
typedef signed char S8;
|
||||
typedef signed short S16;
|
||||
typedef signed int S32;
|
||||
#endif
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Internal Functions and Structs Needed For Unity To Run
|
||||
//
|
||||
@ -41,11 +65,19 @@ struct _Unity
|
||||
|
||||
extern struct _Unity Unity;
|
||||
|
||||
void CreateResults(void);
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Test Suite Management
|
||||
//-------------------------------------------------------
|
||||
|
||||
void UnityBegin(void);
|
||||
void UnityEnd(void);
|
||||
long UnityGetNumFailures(void);
|
||||
void UnityConcludeTest(void);
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Test Output
|
||||
//-------------------------------------------------------
|
||||
|
||||
void UnityPrintChar(const char ch);
|
||||
void UnityPrint(const char* string);
|
||||
@ -54,16 +86,33 @@ void UnityPrintNumberByStyle(const long number, const UNITY_DISPLAY_STYLE_T styl
|
||||
void UnityPrintNumber(const long number);
|
||||
void UnityPrintNumberUnsigned(const unsigned long number);
|
||||
void UnityPrintNumberHex(const unsigned long number, const char nibbles);
|
||||
void UnityConcludeTest(void);
|
||||
|
||||
void UnityAssertEqualInt(const long expected,
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Test Assertion Fuctions
|
||||
//-------------------------------------------------------
|
||||
|
||||
void UnityAssertEqualNumber(const long expected,
|
||||
const long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style);
|
||||
|
||||
void UnityAssertEqualIntArray(const long* expected,
|
||||
const long* actual,
|
||||
void UnityAssertEqualNumberUnsigned(const unsigned long expected,
|
||||
const unsigned long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style);
|
||||
|
||||
void UnityAssertEqualIntArray(const int* expected,
|
||||
const int* actual,
|
||||
const unsigned long num_elements,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style);
|
||||
|
||||
void UnityAssertEqualUnsignedIntArray(const unsigned int* expected,
|
||||
const unsigned int* actual,
|
||||
const unsigned long num_elements,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber,
|
||||
@ -92,16 +141,23 @@ void UnityAssertFloatsWithin(const float delta,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber);
|
||||
|
||||
void UnityAssertIntsWithin(const long delta,
|
||||
void UnityAssertNumbersWithin(const long delta,
|
||||
const long expected,
|
||||
const long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber);
|
||||
|
||||
void UnityAssertNumbersUnsignedWithin(const unsigned long delta,
|
||||
const unsigned long expected,
|
||||
const unsigned long actual,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber);
|
||||
|
||||
void UnityFail(const char* message, const long line);
|
||||
|
||||
void UnityIgnore(const char* message, const long line);
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Test Running Macros
|
||||
//-------------------------------------------------------
|
||||
@ -119,6 +175,7 @@ void UnityIgnore(const char* message, const long line);
|
||||
runTest(func); \
|
||||
UnityConcludeTest();
|
||||
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Test Asserts
|
||||
//
|
||||
@ -142,13 +199,13 @@ void UnityIgnore(const char* message, const long line);
|
||||
|
||||
#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualInt((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_INT); \
|
||||
UnityAssertEqualNumber((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_INT); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_INT(expected, actual) TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, NULL)
|
||||
|
||||
#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualIntArray((long*)(expected), (long*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_INT); \
|
||||
UnityAssertEqualIntArray((int*)(expected), (int*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_INT); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, NULL)
|
||||
|
||||
@ -157,37 +214,37 @@ void UnityIgnore(const char* message, const long line);
|
||||
|
||||
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertIntsWithin((delta), (expected), (actual), NULL, (unsigned short)__LINE__); \
|
||||
UnityAssertNumbersWithin((long)(delta), (long)(expected), (long)(actual), NULL, (unsigned short)__LINE__); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, NULL)
|
||||
|
||||
#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualInt((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_UINT); \
|
||||
UnityAssertEqualNumberUnsigned((unsigned long)(expected), (unsigned long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_UINT); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_UINT(expected, actual) TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, NULL)
|
||||
|
||||
#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualIntArray((long*)(expected), (long*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_UINT); \
|
||||
UnityAssertEqualUnsignedIntArray((unsigned int*)(expected), (unsigned int*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_UINT); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, NULL)
|
||||
|
||||
#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualInt((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX8); \
|
||||
UnityAssertEqualNumberUnsigned((unsigned long)(expected), (unsigned long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX8); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_HEX8(expected, actual) TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, NULL)
|
||||
|
||||
#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualInt((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX16); \
|
||||
UnityAssertEqualNumberUnsigned((unsigned long)(expected), (unsigned long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX16); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_HEX16(expected, actual) TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, NULL)
|
||||
|
||||
#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualInt((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX32); \
|
||||
UnityAssertEqualNumber((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX32); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_HEX32(expected, actual) TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, NULL)
|
||||
|
||||
@ -202,7 +259,7 @@ void UnityIgnore(const char* message, const long line);
|
||||
|
||||
#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertEqualIntArray((long*)(expected), (long*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX32); \
|
||||
UnityAssertEqualIntArray((int*)(expected), (int*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX32); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, NULL)
|
||||
|
||||
@ -226,13 +283,13 @@ void UnityIgnore(const char* message, const long line);
|
||||
|
||||
#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertBits((1 << bit), (-1), (actual), (message), (unsigned short)__LINE__); \
|
||||
UnityAssertBits(((U32)1 << bit), (-1), (actual), (message), (unsigned short)__LINE__); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_BIT_HIGH(bit, actual) TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, NULL)
|
||||
|
||||
#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
UnityAssertBits((1 << bit), (0), (actual), (message), (unsigned short)__LINE__); \
|
||||
UnityAssertBits(((U32)1 << bit), (0), (actual), (message), (unsigned short)__LINE__); \
|
||||
ABORT_IF_NECESSARY();
|
||||
#define TEST_ASSERT_BIT_LOW(bit, actual) TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, NULL)
|
||||
|
||||
@ -259,4 +316,3 @@ void UnityIgnore(const char* message, const long line);
|
||||
#define TEST_IGNORE() TEST_IGNORE_MESSAGE(NULL)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -181,9 +181,13 @@ void testNotEqualBits(void)
|
||||
void testNotEqualUInts(void)
|
||||
{
|
||||
int failed;
|
||||
U16 v0, v1;
|
||||
|
||||
v0 = 9000;
|
||||
v1 = 9001;
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_UINT(900000, 900001);
|
||||
TEST_ASSERT_EQUAL_UINT(v0, v1);
|
||||
EXPECT_ABORT_END
|
||||
|
||||
failed = Unity.CurrentTestFailed;
|
||||
@ -195,9 +199,13 @@ void testNotEqualUInts(void)
|
||||
void testNotEqualHex8s(void)
|
||||
{
|
||||
int failed;
|
||||
U8 v0, v1;
|
||||
|
||||
v0 = 0x23;
|
||||
v1 = 0x22;
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_HEX8(0x23,0x22);
|
||||
TEST_ASSERT_EQUAL_HEX8(v0, v1);
|
||||
EXPECT_ABORT_END
|
||||
|
||||
failed = Unity.CurrentTestFailed;
|
||||
@ -209,9 +217,13 @@ void testNotEqualHex8s(void)
|
||||
void testNotEqualHex16s(void)
|
||||
{
|
||||
int failed;
|
||||
U16 v0, v1;
|
||||
|
||||
v0 = 0x1234;
|
||||
v1 = 0x1235;
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_HEX16(0x1234, 0x1235);
|
||||
TEST_ASSERT_EQUAL_HEX16(v0, v1);
|
||||
EXPECT_ABORT_END
|
||||
|
||||
failed = Unity.CurrentTestFailed;
|
||||
@ -223,9 +235,13 @@ void testNotEqualHex16s(void)
|
||||
void testNotEqualHex32s(void)
|
||||
{
|
||||
int failed;
|
||||
U32 v0, v1;
|
||||
|
||||
v0 = 900000;
|
||||
v1 = 900001;
|
||||
|
||||
EXPECT_ABORT_BEGIN
|
||||
TEST_ASSERT_EQUAL_HEX32(900000, 900001);
|
||||
TEST_ASSERT_EQUAL_HEX32(v0, v1);
|
||||
EXPECT_ABORT_END
|
||||
|
||||
failed = Unity.CurrentTestFailed;
|
||||
@ -238,6 +254,7 @@ void testEqualInts(void)
|
||||
{
|
||||
int v0, v1;
|
||||
int *p0, *p1;
|
||||
|
||||
v0 = 19467;
|
||||
v1 = 19467;
|
||||
p0 = &v0;
|
||||
@ -257,6 +274,7 @@ void testEqualUints(void)
|
||||
{
|
||||
unsigned int v0, v1;
|
||||
unsigned int *p0, *p1;
|
||||
|
||||
v0 = 19467;
|
||||
v1 = 19467;
|
||||
p0 = &v0;
|
||||
@ -269,13 +287,14 @@ void testEqualUints(void)
|
||||
TEST_ASSERT_EQUAL_UINT(*p0, v1);
|
||||
TEST_ASSERT_EQUAL_UINT(*p0, *p1);
|
||||
TEST_ASSERT_EQUAL_UINT(*p0, 19467);
|
||||
TEST_ASSERT_EQUAL_UINT(4294967295ul, 4294967295ul);
|
||||
TEST_ASSERT_EQUAL_UINT(60872u, 60872u);
|
||||
}
|
||||
|
||||
void testEqualHex8s(void)
|
||||
{
|
||||
unsigned int v0, v1;
|
||||
unsigned int *p0, *p1;
|
||||
U8 v0, v1;
|
||||
U8 *p0, *p1;
|
||||
|
||||
v0 = 0x22;
|
||||
v1 = 0x22;
|
||||
p0 = &v0;
|
||||
@ -292,8 +311,9 @@ void testEqualHex8s(void)
|
||||
|
||||
void testEqualHex16s(void)
|
||||
{
|
||||
unsigned int v0, v1;
|
||||
unsigned int *p0, *p1;
|
||||
U16 v0, v1;
|
||||
U16 *p0, *p1;
|
||||
|
||||
v0 = 0x9876;
|
||||
v1 = 0x9876;
|
||||
p0 = &v0;
|
||||
@ -310,26 +330,27 @@ void testEqualHex16s(void)
|
||||
|
||||
void testEqualHex32s(void)
|
||||
{
|
||||
unsigned int v0, v1;
|
||||
unsigned int *p0, *p1;
|
||||
v0 = 0x98765432;
|
||||
v1 = 0x98765432;
|
||||
U32 v0, v1;
|
||||
U32 *p0, *p1;
|
||||
|
||||
v0 = 0x98765432ul;
|
||||
v1 = 0x98765432ul;
|
||||
p0 = &v0;
|
||||
p1 = &v1;
|
||||
|
||||
TEST_ASSERT_EQUAL_HEX32(0x98765432, 0x98765432);
|
||||
TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul);
|
||||
TEST_ASSERT_EQUAL_HEX32(v0, v1);
|
||||
TEST_ASSERT_EQUAL_HEX32(0x98765432, v1);
|
||||
TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432);
|
||||
TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1);
|
||||
TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul);
|
||||
TEST_ASSERT_EQUAL_HEX32(*p0, v1);
|
||||
TEST_ASSERT_EQUAL_HEX32(*p0, *p1);
|
||||
TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432);
|
||||
TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul);
|
||||
}
|
||||
|
||||
void testEqualBits(void)
|
||||
{
|
||||
unsigned int v0 = 0xFF55AA00;
|
||||
unsigned int v1 = 0x55550000;
|
||||
U32 v0 = 0xFF55AA00;
|
||||
U32 v1 = 0x55550000;
|
||||
|
||||
TEST_ASSERT_BITS(v1, v0, 0x55550000);
|
||||
TEST_ASSERT_BITS(v1, v0, 0xFF55CC00);
|
||||
@ -346,6 +367,7 @@ void testEqualShorts(void)
|
||||
{
|
||||
short v0, v1;
|
||||
short *p0, *p1;
|
||||
|
||||
v0 = 19467;
|
||||
v1 = 19467;
|
||||
p0 = &v0;
|
||||
@ -365,25 +387,27 @@ void testEqualUShorts(void)
|
||||
{
|
||||
unsigned short v0, v1;
|
||||
unsigned short *p0, *p1;
|
||||
|
||||
v0 = 19467;
|
||||
v1 = 19467;
|
||||
p0 = &v0;
|
||||
p1 = &v1;
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(1837, 1837);
|
||||
TEST_ASSERT_EQUAL_INT(-2987, -2987);
|
||||
TEST_ASSERT_EQUAL_INT(v0, v1);
|
||||
TEST_ASSERT_EQUAL_INT(19467, v1);
|
||||
TEST_ASSERT_EQUAL_INT(v0, 19467);
|
||||
TEST_ASSERT_EQUAL_INT(*p0, v1);
|
||||
TEST_ASSERT_EQUAL_INT(*p0, *p1);
|
||||
TEST_ASSERT_EQUAL_INT(*p0, 19467);
|
||||
TEST_ASSERT_EQUAL_UINT(1837, 1837);
|
||||
TEST_ASSERT_EQUAL_UINT(2987, 2987);
|
||||
TEST_ASSERT_EQUAL_UINT(v0, v1);
|
||||
TEST_ASSERT_EQUAL_UINT(19467, v1);
|
||||
TEST_ASSERT_EQUAL_UINT(v0, 19467);
|
||||
TEST_ASSERT_EQUAL_UINT(*p0, v1);
|
||||
TEST_ASSERT_EQUAL_UINT(*p0, *p1);
|
||||
TEST_ASSERT_EQUAL_UINT(*p0, 19467);
|
||||
}
|
||||
|
||||
void testEqualChars(void)
|
||||
{
|
||||
signed char v0, v1;
|
||||
signed char *p0, *p1;
|
||||
|
||||
v0 = 109;
|
||||
v1 = 109;
|
||||
p0 = &v0;
|
||||
@ -403,6 +427,7 @@ void testEqualUChars(void)
|
||||
{
|
||||
unsigned char v0, v1;
|
||||
unsigned char *p0, *p1;
|
||||
|
||||
v0 = 251;
|
||||
v1 = 251;
|
||||
p0 = &v0;
|
||||
@ -421,8 +446,9 @@ void testEqualPointers(void)
|
||||
{
|
||||
int v0, v1;
|
||||
int *p0, *p1, *p2;
|
||||
|
||||
v0 = 19467;
|
||||
v1 = 80080;
|
||||
v1 = 18271;
|
||||
p0 = &v0;
|
||||
p1 = &v1;
|
||||
p2 = &v1;
|
||||
@ -695,8 +721,8 @@ void testNotEqualIntArrays3(void)
|
||||
|
||||
void testEqualUIntArrays(void)
|
||||
{
|
||||
unsigned int p0[] = {1, 8, 987, 4294967295ul};
|
||||
unsigned int p1[] = {1, 8, 987, 4294967295ul};
|
||||
unsigned int p0[] = {1, 8, 987, 65132u};
|
||||
unsigned int p1[] = {1, 8, 987, 65132u};
|
||||
unsigned int p2[] = {1, 8, 987, 2};
|
||||
unsigned int p3[] = {1, 500, 600, 700};
|
||||
|
||||
@ -709,8 +735,8 @@ void testEqualUIntArrays(void)
|
||||
|
||||
void testNotEqualUIntArrays1(void)
|
||||
{
|
||||
unsigned int p0[] = {1, 8, 987, 4294967295ul};
|
||||
unsigned int p1[] = {1, 8, 987, 4294967294ul};
|
||||
unsigned int p0[] = {1, 8, 987, 65132u};
|
||||
unsigned int p1[] = {1, 8, 987, 65131u};
|
||||
|
||||
int failed;
|
||||
|
||||
@ -726,8 +752,8 @@ void testNotEqualUIntArrays1(void)
|
||||
|
||||
void testNotEqualUIntArrays2(void)
|
||||
{
|
||||
unsigned int p0[] = {1, 8, 987, 4294967295ul};
|
||||
unsigned int p1[] = {2, 8, 987, 4294967295ul};
|
||||
unsigned int p0[] = {1, 8, 987, 65132u};
|
||||
unsigned int p1[] = {2, 8, 987, 65132u};
|
||||
|
||||
int failed;
|
||||
|
||||
@ -743,8 +769,8 @@ void testNotEqualUIntArrays2(void)
|
||||
|
||||
void testNotEqualUIntArrays3(void)
|
||||
{
|
||||
unsigned int p0[] = {1, 8, 987, 4294967295ul};
|
||||
unsigned int p1[] = {1, 8, 986, 4294967295ul};
|
||||
unsigned int p0[] = {1, 8, 987, 65132u};
|
||||
unsigned int p1[] = {1, 8, 986, 65132u};
|
||||
|
||||
int failed;
|
||||
|
||||
|
Reference in New Issue
Block a user