mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-31 14:39:55 +01:00
Merge pull request #2935 from ZMQers/unity-base
Problem: no test framework, no unit tests
This commit is contained in:
commit
a30133d8f5
@ -948,6 +948,11 @@ set (ZMQ_BUILD_TESTS ON CACHE BOOL "Build the tests for ZeroMQ")
|
||||
if (ZMQ_BUILD_TESTS)
|
||||
enable_testing () # Enable testing only works in root scope
|
||||
ADD_SUBDIRECTORY (tests)
|
||||
if (BUILD_STATIC)
|
||||
add_subdirectory (unittests)
|
||||
else ()
|
||||
message (WARNING "Not building unit tests, since BUILD_STATIC is not enabled")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
35
Makefile.am
35
Makefile.am
@ -426,6 +426,13 @@ test_apps = \
|
||||
tests/test_reconnect_ivl \
|
||||
tests/test_socket_null
|
||||
|
||||
UNITY_CPPFLAGS = -I$(top_srcdir)/external/unity
|
||||
UNITY_LIBS = $(top_builddir)/external/unity/libunity.a
|
||||
noinst_LIBRARIES = external/unity/libunity.a
|
||||
external_unity_libunity_a_SOURCES = external/unity/unity.c \
|
||||
external/unity/unity.h \
|
||||
external/unity/unity_internals.h
|
||||
|
||||
tests_test_ancillaries_SOURCES = tests/test_ancillaries.cpp
|
||||
tests_test_ancillaries_LDADD = src/libzmq.la
|
||||
|
||||
@ -642,7 +649,8 @@ tests_test_sodium_SOURCES = tests/test_sodium.cpp
|
||||
tests_test_sodium_LDADD = src/libzmq.la
|
||||
|
||||
tests_test_socket_null_SOURCES = tests/test_socket_null.cpp
|
||||
tests_test_socket_null_LDADD = src/libzmq.la
|
||||
tests_test_socket_null_LDADD = src/libzmq.la ${UNITY_LIBS}
|
||||
tests_test_socket_null_CPPFLAGS = ${UNITY_CPPFLAGS}
|
||||
|
||||
tests_test_reconnect_ivl_SOURCES = tests/test_reconnect_ivl.cpp
|
||||
tests_test_reconnect_ivl_LDADD = src/libzmq.la
|
||||
@ -670,8 +678,9 @@ tests_test_security_curve_SOURCES += \
|
||||
endif
|
||||
|
||||
tests_test_security_curve_LDADD = \
|
||||
src/libzmq.la $(LIBUNWIND_LIBS)
|
||||
src/libzmq.la ${UNITY_LIBS} $(LIBUNWIND_LIBS)
|
||||
tests_test_security_curve_CPPFLAGS = \
|
||||
${UNITY_CPPFLAGS} \
|
||||
${LIBUNWIND_CFLAGS}
|
||||
|
||||
if USE_LIBSODIUM
|
||||
@ -851,6 +860,25 @@ tests_test_dgram_SOURCES = tests/test_dgram.cpp
|
||||
tests_test_dgram_LDADD = src/libzmq.la
|
||||
endif
|
||||
|
||||
if ENABLE_STATIC
|
||||
# unit tests - these include individual source files and test the internal functions
|
||||
test_apps += \
|
||||
unittests/unittest_poller \
|
||||
unittests/unittest_ypipe
|
||||
|
||||
unittests_unittest_poller_SOURCES = unittests/unittest_poller.cpp
|
||||
unittests_unittest_poller_CPPFLAGS = -I$(top_srcdir)/src ${UNITY_CPPFLAGS}
|
||||
unittests_unittest_poller_LDADD = $(top_builddir)/src/.libs/libzmq.a \
|
||||
${src_libzmq_la_LIBADD} \
|
||||
${UNITY_LIBS}
|
||||
|
||||
unittests_unittest_ypipe_SOURCES = unittests/unittest_ypipe.cpp
|
||||
unittests_unittest_ypipe_CPPFLAGS = -I$(top_srcdir)/src ${UNITY_CPPFLAGS}
|
||||
unittests_unittest_ypipe_LDADD = $(top_builddir)/src/.libs/libzmq.a \
|
||||
${src_libzmq_la_LIBADD} \
|
||||
${UNITY_LIBS}
|
||||
endif
|
||||
|
||||
check_PROGRAMS = ${test_apps}
|
||||
|
||||
# Run the test cases
|
||||
@ -867,6 +895,8 @@ XFAIL_TESTS += test_ipc_wildcard \
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
external/unity/license.txt \
|
||||
external/unity/version.txt \
|
||||
CMakeLists.txt \
|
||||
autogen.sh \
|
||||
version.sh \
|
||||
@ -874,6 +904,7 @@ EXTRA_DIST = \
|
||||
src/libzmq.vers \
|
||||
src/version.rc.in \
|
||||
tests/CMakeLists.txt \
|
||||
unittests/CMakeLists.txt \
|
||||
tools/curve_keygen.cpp
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
|
@ -813,6 +813,9 @@ AS_IF([test "$WITH_CLANG_FORMAT" = fail],
|
||||
[AC_MSG_ERROR([Caller explicitly referenced CLANG_FORMAT=$CLANG_FORMAT which was not found])])
|
||||
AM_CONDITIONAL([WITH_CLANG_FORMAT], [$WITH_CLANG_FORMAT])
|
||||
|
||||
# unittests will not build without the static libzmq.a
|
||||
AM_CONDITIONAL(ENABLE_STATIC, test "x$enable_static" = "xyes")
|
||||
|
||||
# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
|
||||
AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
|
||||
AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)
|
||||
|
21
external/unity/license.txt
vendored
Normal file
21
external/unity/license.txt
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) <year> 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
1570
external/unity/unity.c
vendored
Normal file
1570
external/unity/unity.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
503
external/unity/unity.h
vendored
Normal file
503
external/unity/unity.h
vendored
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_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_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
|
872
external/unity/unity_internals.h
vendored
Normal file
872
external/unity/unity_internals.h
vendored
Normal file
@ -0,0 +1,872 @@
|
||||
/* ==========================================
|
||||
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
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* 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
|
||||
/* We've defined flush as something else, so make sure we declare it here so it's ready for use */
|
||||
#ifdef UNITY_OUTPUT_FLUSH_HEADER_DECLARATION
|
||||
extern void UNITY_OMIT_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
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* 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;
|
||||
#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);
|
||||
void UnityPrintNumberUnsigned(const UNITY_UINT number);
|
||||
void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles);
|
||||
|
||||
#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* message, const UNITY_LINE_TYPE line);
|
||||
|
||||
void UnityIgnore(const char* message, 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
|
||||
|
||||
/* 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
|
1
external/unity/version.txt
vendored
Normal file
1
external/unity/version.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
https://github.com/ThrowTheSwitch/Unity/commit/b4aca70fd9e0ddf0afbdafb1b826f5edcfc1049b
|
@ -44,6 +44,29 @@ Copyright: 2009-2011, 250bpm s.r.o
|
||||
2007-2011, Other contributors as noted in the AUTHORS file
|
||||
License: LGPL-3.0+
|
||||
|
||||
Files: external/unity/*
|
||||
Copyright: 2007-2014 Mike Karlesky
|
||||
2007-2014 Mark VanderVoord
|
||||
2007-2014 Greg Williams
|
||||
License: MIT
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2014- , Laszlo Boszormenyi (GCS) <gcs@debian.org>
|
||||
2012-2014, Alessandro Ghedini <ghedo@debian.org>
|
||||
|
75
src/ctx.cpp
75
src/ctx.cpp
@ -76,9 +76,7 @@ zmq::ctx_t::ctx_t () :
|
||||
max_msgsz (INT_MAX),
|
||||
io_thread_count (ZMQ_IO_THREADS_DFLT),
|
||||
blocky (true),
|
||||
ipv6 (false),
|
||||
thread_priority (ZMQ_THREAD_PRIORITY_DFLT),
|
||||
thread_sched_policy (ZMQ_THREAD_SCHED_POLICY_DFLT)
|
||||
ipv6 (false)
|
||||
{
|
||||
#ifdef HAVE_FORK
|
||||
pid = getpid ();
|
||||
@ -241,29 +239,6 @@ int zmq::ctx_t::set (int option_, int optval_)
|
||||
} else if (option_ == ZMQ_IPV6 && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
ipv6 = (optval_ != 0);
|
||||
} else if (option_ == ZMQ_THREAD_PRIORITY && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_priority = optval_;
|
||||
} else if (option_ == ZMQ_THREAD_SCHED_POLICY && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_sched_policy = optval_;
|
||||
} else if (option_ == ZMQ_THREAD_AFFINITY_CPU_ADD && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_affinity_cpus.insert (optval_);
|
||||
} else if (option_ == ZMQ_THREAD_AFFINITY_CPU_REMOVE && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
std::set<int>::iterator it = thread_affinity_cpus.find (optval_);
|
||||
if (it != thread_affinity_cpus.end ()) {
|
||||
thread_affinity_cpus.erase (it);
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
rc = -1;
|
||||
}
|
||||
} else if (option_ == ZMQ_THREAD_NAME_PREFIX && optval_ >= 0) {
|
||||
std::ostringstream s;
|
||||
s << optval_;
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_name_prefix = s.str ();
|
||||
} else if (option_ == ZMQ_BLOCKY && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
blocky = (optval_ != 0);
|
||||
@ -271,8 +246,7 @@ int zmq::ctx_t::set (int option_, int optval_)
|
||||
scoped_lock_t locker (opt_sync);
|
||||
max_msgsz = optval_ < INT_MAX ? optval_ : INT_MAX;
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
rc = -1;
|
||||
rc = thread_ctx_t::set (option_, optval_);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -434,9 +408,15 @@ zmq::object_t *zmq::ctx_t::get_reaper ()
|
||||
return reaper;
|
||||
}
|
||||
|
||||
void zmq::ctx_t::start_thread (thread_t &thread_,
|
||||
thread_fn *tfn_,
|
||||
void *arg_) const
|
||||
zmq::thread_ctx_t::thread_ctx_t () :
|
||||
thread_priority (ZMQ_THREAD_PRIORITY_DFLT),
|
||||
thread_sched_policy (ZMQ_THREAD_SCHED_POLICY_DFLT)
|
||||
{
|
||||
}
|
||||
|
||||
void zmq::thread_ctx_t::start_thread (thread_t &thread_,
|
||||
thread_fn *tfn_,
|
||||
void *arg_) const
|
||||
{
|
||||
static unsigned int nthreads_started = 0;
|
||||
|
||||
@ -453,6 +433,39 @@ void zmq::ctx_t::start_thread (thread_t &thread_,
|
||||
nthreads_started++;
|
||||
}
|
||||
|
||||
int zmq::thread_ctx_t::set (int option_, int optval_)
|
||||
{
|
||||
int rc = 0;
|
||||
if (option_ == ZMQ_THREAD_SCHED_POLICY && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_sched_policy = optval_;
|
||||
} else if (option_ == ZMQ_THREAD_AFFINITY_CPU_ADD && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_affinity_cpus.insert (optval_);
|
||||
} else if (option_ == ZMQ_THREAD_AFFINITY_CPU_REMOVE && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
std::set<int>::iterator it = thread_affinity_cpus.find (optval_);
|
||||
if (it != thread_affinity_cpus.end ()) {
|
||||
thread_affinity_cpus.erase (it);
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
rc = -1;
|
||||
}
|
||||
} else if (option_ == ZMQ_THREAD_NAME_PREFIX && optval_ >= 0) {
|
||||
std::ostringstream s;
|
||||
s << optval_;
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_name_prefix = s.str ();
|
||||
} else if (option_ == ZMQ_THREAD_PRIORITY && optval_ >= 0) {
|
||||
scoped_lock_t locker (opt_sync);
|
||||
thread_priority = optval_;
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
rc = -1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void zmq::ctx_t::send_command (uint32_t tid_, const command_t &command_)
|
||||
{
|
||||
slots[tid_]->send (command_);
|
||||
|
36
src/ctx.hpp
36
src/ctx.hpp
@ -61,10 +61,32 @@ struct endpoint_t
|
||||
options_t options;
|
||||
};
|
||||
|
||||
class thread_ctx_t
|
||||
{
|
||||
public:
|
||||
thread_ctx_t ();
|
||||
|
||||
// Start a new thread with proper scheduling parameters.
|
||||
void start_thread (thread_t &thread_, thread_fn *tfn_, void *arg_) const;
|
||||
|
||||
int set (int option_, int optval_);
|
||||
|
||||
protected:
|
||||
// Synchronisation of access to context options.
|
||||
mutex_t opt_sync;
|
||||
|
||||
private:
|
||||
// Thread parameters.
|
||||
int thread_priority;
|
||||
int thread_sched_policy;
|
||||
std::set<int> thread_affinity_cpus;
|
||||
std::string thread_name_prefix;
|
||||
};
|
||||
|
||||
// Context object encapsulates all the global state associated with
|
||||
// the library.
|
||||
|
||||
class ctx_t
|
||||
class ctx_t : public thread_ctx_t
|
||||
{
|
||||
public:
|
||||
// Create the context object.
|
||||
@ -96,9 +118,6 @@ class ctx_t
|
||||
zmq::socket_base_t *create_socket (int type_);
|
||||
void destroy_socket (zmq::socket_base_t *socket_);
|
||||
|
||||
// Start a new thread with proper scheduling parameters.
|
||||
void start_thread (thread_t &thread_, thread_fn *tfn_, void *arg_) const;
|
||||
|
||||
// Send command to the destination thread.
|
||||
void send_command (uint32_t tid_, const command_t &command_);
|
||||
|
||||
@ -215,15 +234,6 @@ class ctx_t
|
||||
// Is IPv6 enabled on this context?
|
||||
bool ipv6;
|
||||
|
||||
// Thread parameters.
|
||||
int thread_priority;
|
||||
int thread_sched_policy;
|
||||
std::set<int> thread_affinity_cpus;
|
||||
std::string thread_name_prefix;
|
||||
|
||||
// Synchronisation of access to context options.
|
||||
mutex_t opt_sync;
|
||||
|
||||
ctx_t (const ctx_t &);
|
||||
const ctx_t &operator= (const ctx_t &);
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "config.hpp"
|
||||
#include "i_poll_events.hpp"
|
||||
|
||||
zmq::devpoll_t::devpoll_t (const zmq::ctx_t &ctx_) :
|
||||
zmq::devpoll_t::devpoll_t (const zmq::thread_ctx_t &ctx_) :
|
||||
ctx (ctx_),
|
||||
stopping (false)
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ class devpoll_t : public poller_base_t
|
||||
public:
|
||||
typedef fd_t handle_t;
|
||||
|
||||
devpoll_t (const ctx_t &ctx_);
|
||||
devpoll_t (const thread_ctx_t &ctx_);
|
||||
~devpoll_t ();
|
||||
|
||||
// "poller" concept.
|
||||
@ -75,7 +75,7 @@ class devpoll_t : public poller_base_t
|
||||
void loop ();
|
||||
|
||||
// Reference to ZMQ context.
|
||||
const ctx_t &ctx;
|
||||
const thread_ctx_t &ctx;
|
||||
|
||||
// File descriptor referring to "/dev/poll" pseudo-device.
|
||||
fd_t devpoll_fd;
|
||||
|
@ -44,7 +44,9 @@
|
||||
#include "config.hpp"
|
||||
#include "i_poll_events.hpp"
|
||||
|
||||
zmq::epoll_t::epoll_t (const zmq::ctx_t &ctx_) : ctx (ctx_), stopping (false)
|
||||
zmq::epoll_t::epoll_t (const zmq::thread_ctx_t &ctx_) :
|
||||
ctx (ctx_),
|
||||
stopping (false)
|
||||
{
|
||||
#ifdef ZMQ_USE_EPOLL_CLOEXEC
|
||||
// Setting this option result in sane behaviour when exec() functions
|
||||
|
@ -55,7 +55,7 @@ class epoll_t : public poller_base_t
|
||||
public:
|
||||
typedef void *handle_t;
|
||||
|
||||
epoll_t (const ctx_t &ctx_);
|
||||
epoll_t (const thread_ctx_t &ctx_);
|
||||
~epoll_t ();
|
||||
|
||||
// "poller" concept.
|
||||
@ -78,7 +78,7 @@ class epoll_t : public poller_base_t
|
||||
void loop ();
|
||||
|
||||
// Reference to ZMQ context.
|
||||
const ctx_t &ctx;
|
||||
const thread_ctx_t &ctx;
|
||||
|
||||
// Main epoll file descriptor
|
||||
fd_t epoll_fd;
|
||||
|
@ -54,7 +54,9 @@
|
||||
#define kevent_udata_t void *
|
||||
#endif
|
||||
|
||||
zmq::kqueue_t::kqueue_t (const zmq::ctx_t &ctx_) : ctx (ctx_), stopping (false)
|
||||
zmq::kqueue_t::kqueue_t (const zmq::thread_ctx_t &ctx_) :
|
||||
ctx (ctx_),
|
||||
stopping (false)
|
||||
{
|
||||
// Create event queue
|
||||
kqueue_fd = kqueue ();
|
||||
|
@ -54,7 +54,7 @@ class kqueue_t : public poller_base_t
|
||||
public:
|
||||
typedef void *handle_t;
|
||||
|
||||
kqueue_t (const ctx_t &ctx_);
|
||||
kqueue_t (const thread_ctx_t &ctx_);
|
||||
~kqueue_t ();
|
||||
|
||||
// "poller" concept.
|
||||
@ -77,7 +77,7 @@ class kqueue_t : public poller_base_t
|
||||
void loop ();
|
||||
|
||||
// Reference to ZMQ context.
|
||||
const ctx_t &ctx;
|
||||
const thread_ctx_t &ctx;
|
||||
|
||||
// File descriptor referring to the kernel event queue.
|
||||
fd_t kqueue_fd;
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "config.hpp"
|
||||
#include "i_poll_events.hpp"
|
||||
|
||||
zmq::poll_t::poll_t (const zmq::ctx_t &ctx_) :
|
||||
zmq::poll_t::poll_t (const zmq::thread_ctx_t &ctx_) :
|
||||
ctx (ctx_),
|
||||
retired (false),
|
||||
stopping (false)
|
||||
|
@ -57,7 +57,7 @@ class poll_t : public poller_base_t
|
||||
public:
|
||||
typedef fd_t handle_t;
|
||||
|
||||
poll_t (const ctx_t &ctx_);
|
||||
poll_t (const thread_ctx_t &ctx_);
|
||||
~poll_t ();
|
||||
|
||||
// "poller" concept.
|
||||
@ -82,7 +82,7 @@ class poll_t : public poller_base_t
|
||||
void cleanup_retired();
|
||||
|
||||
// Reference to ZMQ context.
|
||||
const ctx_t &ctx;
|
||||
const thread_ctx_t &ctx;
|
||||
|
||||
struct fd_entry_t
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "config.hpp"
|
||||
#include "i_poll_events.hpp"
|
||||
|
||||
zmq::pollset_t::pollset_t (const zmq::ctx_t &ctx_) :
|
||||
zmq::pollset_t::pollset_t (const zmq::thread_ctx_t &ctx_) :
|
||||
ctx (ctx_),
|
||||
stopping (false)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ class pollset_t : public poller_base_t
|
||||
public:
|
||||
typedef void *handle_t;
|
||||
|
||||
pollset_t (const ctx_t &ctx_);
|
||||
pollset_t (const thread_ctx_t &ctx_);
|
||||
~pollset_t ();
|
||||
|
||||
// "poller" concept.
|
||||
@ -78,7 +78,7 @@ class pollset_t : public poller_base_t
|
||||
void loop ();
|
||||
|
||||
// Reference to ZMQ context.
|
||||
const ctx_t &ctx;
|
||||
const thread_ctx_t &ctx;
|
||||
|
||||
// Main pollset file descriptor
|
||||
::pollset_t pollset_fd;
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <limits>
|
||||
#include <climits>
|
||||
|
||||
zmq::select_t::select_t (const zmq::ctx_t &ctx_) :
|
||||
zmq::select_t::select_t (const zmq::thread_ctx_t &ctx_) :
|
||||
ctx (ctx_),
|
||||
#if defined ZMQ_HAVE_WINDOWS
|
||||
// Fine as long as map is not cleared.
|
||||
|
@ -63,7 +63,7 @@ class select_t : public poller_base_t
|
||||
public:
|
||||
typedef fd_t handle_t;
|
||||
|
||||
select_t (const ctx_t &ctx_);
|
||||
select_t (const thread_ctx_t &ctx_);
|
||||
~select_t ();
|
||||
|
||||
// "poller" concept.
|
||||
@ -86,7 +86,7 @@ class select_t : public poller_base_t
|
||||
void loop ();
|
||||
|
||||
// Reference to ZMQ context.
|
||||
const ctx_t &ctx;
|
||||
const thread_ctx_t &ctx;
|
||||
|
||||
// Internal state.
|
||||
struct fds_set_t
|
||||
|
@ -59,14 +59,17 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
|
||||
(HANDLE) _beginthreadex (NULL, 0, &::thread_routine, this, 0, NULL);
|
||||
#endif
|
||||
win_assert (descriptor != NULL);
|
||||
started = true;
|
||||
}
|
||||
|
||||
void zmq::thread_t::stop ()
|
||||
{
|
||||
DWORD rc = WaitForSingleObject (descriptor, INFINITE);
|
||||
win_assert (rc != WAIT_FAILED);
|
||||
BOOL rc2 = CloseHandle (descriptor);
|
||||
win_assert (rc2 != 0);
|
||||
if (started) {
|
||||
DWORD rc = WaitForSingleObject (descriptor, INFINITE);
|
||||
win_assert (rc != WAIT_FAILED);
|
||||
BOOL rc2 = CloseHandle (descriptor);
|
||||
win_assert (rc2 != 0);
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::thread_t::setSchedulingParameters (
|
||||
@ -116,12 +119,15 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
|
||||
arg = arg_;
|
||||
int rc = pthread_create (&descriptor, NULL, thread_routine, this);
|
||||
posix_assert (rc);
|
||||
started = true;
|
||||
}
|
||||
|
||||
void zmq::thread_t::stop ()
|
||||
{
|
||||
int rc = pthread_join (descriptor, NULL);
|
||||
posix_assert (rc);
|
||||
if (started) {
|
||||
int rc = pthread_join (descriptor, NULL);
|
||||
posix_assert (rc);
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::thread_t::setSchedulingParameters (
|
||||
|
@ -52,6 +52,7 @@ class thread_t
|
||||
inline thread_t () :
|
||||
tfn (NULL),
|
||||
arg (NULL),
|
||||
started (false),
|
||||
thread_priority (ZMQ_THREAD_PRIORITY_DFLT),
|
||||
thread_sched_policy (ZMQ_THREAD_SCHED_POLICY_DFLT)
|
||||
{
|
||||
@ -81,6 +82,8 @@ class thread_t
|
||||
void *arg;
|
||||
|
||||
private:
|
||||
bool started;
|
||||
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
HANDLE descriptor;
|
||||
#else
|
||||
|
@ -144,11 +144,21 @@ if(WIN32)
|
||||
link_libraries(ws2_32.lib)
|
||||
endif()
|
||||
|
||||
add_library (unity
|
||||
STATIC
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity_internals.h")
|
||||
set_target_properties (unity PROPERTIES
|
||||
PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
|
||||
target_include_directories (unity
|
||||
PUBLIC "${CMAKE_CURRENT_LIST_DIR}/../external/unity")
|
||||
|
||||
# add library and include dirs for all targets
|
||||
if (BUILD_SHARED)
|
||||
link_libraries(libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
link_libraries(libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
||||
else ()
|
||||
link_libraries(libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
link_libraries(libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
||||
endif ()
|
||||
include_directories("${CMAKE_SOURCE_DIR}/../include" "${CMAKE_BINARY_DIR}")
|
||||
|
||||
|
@ -40,11 +40,49 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <unity.h>
|
||||
|
||||
#include "../src/tweetnacl.h"
|
||||
#include "../src/curve_client_tools.hpp"
|
||||
#include "../src/random.hpp"
|
||||
|
||||
char error_message_buffer[256];
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
const char *zmq_errno_message ()
|
||||
{
|
||||
snprintf (error_message_buffer, sizeof (error_message_buffer),
|
||||
"errno=%i (%s)", zmq_errno (), zmq_strerror (zmq_errno ()));
|
||||
return error_message_buffer;
|
||||
}
|
||||
|
||||
#define TEST_ASSERT_ZMQ_ERRNO(condition) \
|
||||
TEST_ASSERT_MESSAGE ((condition), zmq_errno_message ())
|
||||
|
||||
void *ctx;
|
||||
void *handler;
|
||||
void *zap_thread;
|
||||
void *server;
|
||||
void *server_mon;
|
||||
char my_endpoint[MAX_SOCKET_STRING];
|
||||
|
||||
void setUp ()
|
||||
{
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
}
|
||||
|
||||
void tearDown ()
|
||||
{
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
}
|
||||
|
||||
const int timeout = 250;
|
||||
|
||||
const char large_routing_id[] = "0123456789012345678901234567890123456789"
|
||||
"0123456789012345678901234567890123456789"
|
||||
"0123456789012345678901234567890123456789"
|
||||
@ -106,8 +144,7 @@ void test_null_key (void *ctx,
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_curve_security_with_valid_credentials (
|
||||
void *ctx, char *my_endpoint, void *server, void *server_mon, int timeout)
|
||||
void test_curve_security_with_valid_credentials ()
|
||||
{
|
||||
curve_client_data_t curve_client_data = {
|
||||
valid_server_public, valid_client_public, valid_client_secret};
|
||||
@ -117,7 +154,7 @@ void test_curve_security_with_valid_credentials (
|
||||
&curve_client_data, &client_mon);
|
||||
bounce (server, client);
|
||||
int rc = zmq_close (client);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
int event = get_monitor_event_with_timeout (server_mon, NULL, NULL, -1);
|
||||
@ -131,15 +168,12 @@ void test_curve_security_with_valid_credentials (
|
||||
assert_no_more_monitor_events_with_timeout (client_mon, timeout);
|
||||
|
||||
rc = zmq_close (client_mon);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_curve_security_with_bogus_client_credentials (
|
||||
void *ctx, char *my_endpoint, void *server, void *server_mon, int timeout)
|
||||
void test_curve_security_with_bogus_client_credentials ()
|
||||
{
|
||||
LIBZMQ_UNUSED (timeout);
|
||||
|
||||
// This must be caught by the ZAP handler
|
||||
char bogus_public[41];
|
||||
char bogus_secret[41];
|
||||
@ -159,12 +193,12 @@ void test_curve_security_with_bogus_client_credentials (
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
server_event_count = expect_monitor_event_multiple (
|
||||
server_mon, ZMQ_EVENT_HANDSHAKE_FAILED_AUTH, 400);
|
||||
assert (server_event_count <= 1);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_INT (1, server_event_count);
|
||||
#endif
|
||||
|
||||
// there may be more than one ZAP request due to repeated attempts by the client
|
||||
assert (0 == server_event_count
|
||||
|| 1 <= zmq_atomic_counter_value (zap_requests_handled));
|
||||
TEST_ASSERT (0 == server_event_count
|
||||
|| 1 <= zmq_atomic_counter_value (zap_requests_handled));
|
||||
}
|
||||
|
||||
void expect_zmtp_mechanism_mismatch (void *client,
|
||||
@ -174,7 +208,7 @@ void expect_zmtp_mechanism_mismatch (void *client,
|
||||
{
|
||||
// This must be caught by the curve_server class, not passed to ZAP
|
||||
int rc = zmq_connect (client, my_endpoint);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
expect_bounce_fail (server, client);
|
||||
close_zero_linger (client);
|
||||
|
||||
@ -184,31 +218,25 @@ void expect_zmtp_mechanism_mismatch (void *client,
|
||||
ZMQ_PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH);
|
||||
#endif
|
||||
|
||||
assert (0 == zmq_atomic_counter_value (zap_requests_handled));
|
||||
TEST_ASSERT_EQUAL_INT (0, zmq_atomic_counter_value (zap_requests_handled));
|
||||
}
|
||||
|
||||
void test_curve_security_with_null_client_credentials (void *ctx,
|
||||
char *my_endpoint,
|
||||
void *server,
|
||||
void *server_mon)
|
||||
void test_curve_security_with_null_client_credentials ()
|
||||
{
|
||||
void *client = zmq_socket (ctx, ZMQ_DEALER);
|
||||
assert (client);
|
||||
TEST_ASSERT_NOT_NULL (client);
|
||||
|
||||
expect_zmtp_mechanism_mismatch (client, my_endpoint, server, server_mon);
|
||||
}
|
||||
|
||||
void test_curve_security_with_plain_client_credentials (void *ctx,
|
||||
char *my_endpoint,
|
||||
void *server,
|
||||
void *server_mon)
|
||||
void test_curve_security_with_plain_client_credentials ()
|
||||
{
|
||||
void *client = zmq_socket (ctx, ZMQ_DEALER);
|
||||
assert (client);
|
||||
TEST_ASSERT_NOT_NULL (client);
|
||||
int rc = zmq_setsockopt (client, ZMQ_PLAIN_USERNAME, "admin", 5);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
rc = zmq_setsockopt (client, ZMQ_PLAIN_PASSWORD, "password", 8);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
|
||||
expect_zmtp_mechanism_mismatch (client, my_endpoint, server, server_mon);
|
||||
}
|
||||
@ -220,7 +248,7 @@ int connect_vanilla_socket (char *my_endpoint)
|
||||
|
||||
unsigned short int port;
|
||||
int rc = sscanf (my_endpoint, "tcp://127.0.0.1:%hu", &port);
|
||||
assert (rc == 1);
|
||||
TEST_ASSERT_EQUAL_INT (1, rc);
|
||||
|
||||
ip4addr.sin_family = AF_INET;
|
||||
ip4addr.sin_port = htons (port);
|
||||
@ -232,13 +260,11 @@ int connect_vanilla_socket (char *my_endpoint)
|
||||
|
||||
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
rc = connect (s, (struct sockaddr *) &ip4addr, sizeof (ip4addr));
|
||||
assert (rc > -1);
|
||||
TEST_ASSERT_GREATER_THAN_INT (-1, rc);
|
||||
return s;
|
||||
}
|
||||
|
||||
void test_curve_security_unauthenticated_message (char *my_endpoint,
|
||||
void *server,
|
||||
int timeout)
|
||||
void test_curve_security_unauthenticated_message ()
|
||||
{
|
||||
// Unauthenticated messages from a vanilla socket shouldn't be received
|
||||
int s = connect_vanilla_socket (my_endpoint);
|
||||
@ -249,10 +275,7 @@ void test_curve_security_unauthenticated_message (char *my_endpoint,
|
||||
|
||||
zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout));
|
||||
char *buf = s_recv (server);
|
||||
if (buf != NULL) {
|
||||
printf ("Received unauthenticated message: %s\n", buf);
|
||||
assert (buf == NULL);
|
||||
}
|
||||
TEST_ASSERT_NULL_MESSAGE (buf, "Received unauthenticated message");
|
||||
close (s);
|
||||
}
|
||||
|
||||
@ -260,7 +283,7 @@ void send_all (int fd, const char *data, size_t size)
|
||||
{
|
||||
while (size > 0) {
|
||||
int res = send (fd, data, size, 0);
|
||||
assert (res > 0);
|
||||
TEST_ASSERT_GREATER_THAN_INT (0, res);
|
||||
size -= res;
|
||||
data += res;
|
||||
}
|
||||
@ -280,14 +303,8 @@ void send_greeting (int s)
|
||||
send (s, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
|
||||
}
|
||||
|
||||
void test_curve_security_invalid_hello_wrong_length (char *my_endpoint,
|
||||
void *server,
|
||||
void *server_mon,
|
||||
int timeout)
|
||||
void test_curve_security_invalid_hello_wrong_length ()
|
||||
{
|
||||
LIBZMQ_UNUSED (server);
|
||||
LIBZMQ_UNUSED (timeout);
|
||||
|
||||
int s = connect_vanilla_socket (my_endpoint);
|
||||
|
||||
// send GREETING
|
||||
@ -357,14 +374,8 @@ template <size_t N> void send_command (int s, char (&command)[N])
|
||||
send_all (s, command, N);
|
||||
}
|
||||
|
||||
void test_curve_security_invalid_hello_command_name (char *my_endpoint,
|
||||
void *server,
|
||||
void *server_mon,
|
||||
int timeout)
|
||||
void test_curve_security_invalid_hello_command_name ()
|
||||
{
|
||||
LIBZMQ_UNUSED (server);
|
||||
LIBZMQ_UNUSED (timeout);
|
||||
|
||||
int s = connect_vanilla_socket (my_endpoint);
|
||||
|
||||
send_greeting (s);
|
||||
@ -374,7 +385,7 @@ void test_curve_security_invalid_hello_command_name (char *my_endpoint,
|
||||
// send CURVE HELLO with a misspelled command name (but otherwise correct)
|
||||
char hello[hello_length];
|
||||
int rc = tools.produce_hello (hello, 0);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
hello[5] = 'X';
|
||||
|
||||
send_command (s, hello);
|
||||
@ -388,14 +399,8 @@ void test_curve_security_invalid_hello_command_name (char *my_endpoint,
|
||||
close (s);
|
||||
}
|
||||
|
||||
void test_curve_security_invalid_hello_version (char *my_endpoint,
|
||||
void *server,
|
||||
void *server_mon,
|
||||
int timeout)
|
||||
void test_curve_security_invalid_hello_version ()
|
||||
{
|
||||
LIBZMQ_UNUSED (server);
|
||||
LIBZMQ_UNUSED (timeout);
|
||||
|
||||
int s = connect_vanilla_socket (my_endpoint);
|
||||
|
||||
send_greeting (s);
|
||||
@ -405,7 +410,7 @@ void test_curve_security_invalid_hello_version (char *my_endpoint,
|
||||
// send CURVE HELLO with a wrong version number (but otherwise correct)
|
||||
char hello[hello_length];
|
||||
int rc = tools.produce_hello (hello, 0);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
hello[6] = 2;
|
||||
|
||||
send_command (s, hello);
|
||||
@ -426,7 +431,7 @@ void flush_read (int fd)
|
||||
|
||||
while ((res = recv (fd, buf, 256, 0)) == 256) {
|
||||
}
|
||||
assert (res != -1);
|
||||
TEST_ASSERT_NOT_EQUAL (-1, res);
|
||||
}
|
||||
|
||||
void recv_all (int fd, uint8_t *data, size_t len)
|
||||
@ -434,7 +439,7 @@ void recv_all (int fd, uint8_t *data, size_t len)
|
||||
size_t received = 0;
|
||||
while (received < len) {
|
||||
int res = recv (fd, (char *) data, len, 0);
|
||||
assert (res > 0);
|
||||
TEST_ASSERT_GREATER_THAN_INT (0, res);
|
||||
|
||||
data += res;
|
||||
received += res;
|
||||
@ -459,19 +464,14 @@ int connect_exchange_greeting_and_send_hello (char *my_endpoint,
|
||||
// send valid CURVE HELLO
|
||||
char hello[hello_length];
|
||||
int rc = tools.produce_hello (hello, 0);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
|
||||
send_command (s, hello);
|
||||
return s;
|
||||
}
|
||||
|
||||
void test_curve_security_invalid_initiate_length (char *my_endpoint,
|
||||
void *server,
|
||||
void *server_mon,
|
||||
int timeout)
|
||||
void test_curve_security_invalid_initiate_wrong_length ()
|
||||
{
|
||||
LIBZMQ_UNUSED (server);
|
||||
|
||||
zmq::curve_client_tools_t tools = make_curve_client_tools ();
|
||||
|
||||
int s = connect_exchange_greeting_and_send_hello (my_endpoint, tools);
|
||||
@ -481,7 +481,7 @@ void test_curve_security_invalid_initiate_length (char *my_endpoint,
|
||||
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
int res = get_monitor_event_with_timeout (server_mon, NULL, NULL, timeout);
|
||||
assert (res == -1);
|
||||
TEST_ASSERT_EQUAL_INT (-1, res);
|
||||
#else
|
||||
LIBZMQ_UNUSED (timeout);
|
||||
#endif
|
||||
@ -511,23 +511,18 @@ int connect_exchange_greeting_and_hello_welcome (
|
||||
|
||||
uint8_t cn_precom[crypto_box_BEFORENMBYTES];
|
||||
int res = tools.process_welcome (welcome + 2, welcome_length, cn_precom);
|
||||
assert (res == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (res == 0);
|
||||
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
res = get_monitor_event_with_timeout (server_mon, NULL, NULL, timeout);
|
||||
assert (res == -1);
|
||||
TEST_ASSERT_EQUAL_INT (-1, res);
|
||||
#endif
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void test_curve_security_invalid_initiate_command_name (char *my_endpoint,
|
||||
void *server,
|
||||
void *server_mon,
|
||||
int timeout)
|
||||
void test_curve_security_invalid_initiate_command_name ()
|
||||
{
|
||||
LIBZMQ_UNUSED (server);
|
||||
|
||||
zmq::curve_client_tools_t tools = make_curve_client_tools ();
|
||||
int s = connect_exchange_greeting_and_hello_welcome (
|
||||
my_endpoint, server_mon, timeout, tools);
|
||||
@ -548,11 +543,8 @@ void test_curve_security_invalid_initiate_command_name (char *my_endpoint,
|
||||
close (s);
|
||||
}
|
||||
|
||||
void test_curve_security_invalid_initiate_command_encrypted_cookie (
|
||||
char *my_endpoint, void *server, void *server_mon, int timeout)
|
||||
void test_curve_security_invalid_initiate_command_encrypted_cookie ()
|
||||
{
|
||||
LIBZMQ_UNUSED (server);
|
||||
|
||||
zmq::curve_client_tools_t tools = make_curve_client_tools ();
|
||||
int s = connect_exchange_greeting_and_hello_welcome (
|
||||
my_endpoint, server_mon, timeout, tools);
|
||||
@ -573,11 +565,8 @@ void test_curve_security_invalid_initiate_command_encrypted_cookie (
|
||||
close (s);
|
||||
}
|
||||
|
||||
void test_curve_security_invalid_initiate_command_encrypted_content (
|
||||
char *my_endpoint, void *server, void *server_mon, int timeout)
|
||||
void test_curve_security_invalid_initiate_command_encrypted_content ()
|
||||
{
|
||||
LIBZMQ_UNUSED (server);
|
||||
|
||||
zmq::curve_client_tools_t tools = make_curve_client_tools ();
|
||||
int s = connect_exchange_greeting_and_hello_welcome (
|
||||
my_endpoint, server_mon, timeout, tools);
|
||||
@ -602,7 +591,7 @@ void test_curve_security_invalid_keysize (void *ctx)
|
||||
{
|
||||
// Check return codes for invalid buffer sizes
|
||||
void *client = zmq_socket (ctx, ZMQ_DEALER);
|
||||
assert (client);
|
||||
TEST_ASSERT_NOT_NULL (client);
|
||||
errno = 0;
|
||||
int rc =
|
||||
zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, valid_server_public, 123);
|
||||
@ -614,9 +603,37 @@ void test_curve_security_invalid_keysize (void *ctx)
|
||||
rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, valid_client_secret, 123);
|
||||
assert (rc == -1 && errno == EINVAL);
|
||||
rc = zmq_close (client);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
}
|
||||
|
||||
// TODO why isn't this const?
|
||||
char null_key[] = "0000000000000000000000000000000000000000";
|
||||
|
||||
void test_null_server_key ()
|
||||
{
|
||||
// Check CURVE security with a null server key
|
||||
// This will be caught by the curve_server class, not passed to ZAP
|
||||
test_null_key (ctx, server, server_mon, my_endpoint, null_key,
|
||||
valid_client_public, valid_client_secret);
|
||||
}
|
||||
|
||||
void test_null_client_public_key ()
|
||||
{
|
||||
// Check CURVE security with a null client public key
|
||||
// This will be caught by the curve_server class, not passed to ZAP
|
||||
test_null_key (ctx, server, server_mon, my_endpoint, valid_server_public,
|
||||
null_key, valid_client_secret);
|
||||
}
|
||||
|
||||
void test_null_client_secret_key ()
|
||||
{
|
||||
// Check CURVE security with a null client public key
|
||||
// This will be caught by the curve_server class, not passed to ZAP
|
||||
test_null_key (ctx, server, server_mon, my_endpoint, valid_server_public,
|
||||
valid_client_public, null_key);
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
if (!zmq_has ("curve")) {
|
||||
@ -628,146 +645,29 @@ int main (void)
|
||||
|
||||
setup_testutil_security_curve ();
|
||||
|
||||
int timeout = 250;
|
||||
|
||||
setup_test_environment ();
|
||||
|
||||
void *ctx;
|
||||
void *handler;
|
||||
void *zap_thread;
|
||||
void *server;
|
||||
void *server_mon;
|
||||
char my_endpoint[MAX_SOCKET_STRING];
|
||||
|
||||
fprintf (stderr, "test_curve_security_with_valid_credentials\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_with_valid_credentials (ctx, my_endpoint, server,
|
||||
server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
char null_key[] = "0000000000000000000000000000000000000000";
|
||||
|
||||
// Check CURVE security with a null server key
|
||||
// This will be caught by the curve_server class, not passed to ZAP
|
||||
fprintf (stderr, "test_null_key (server)\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_null_key (ctx, server, server_mon, my_endpoint, null_key,
|
||||
valid_client_public, valid_client_secret);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
// Check CURVE security with a null client public key
|
||||
// This will be caught by the curve_server class, not passed to ZAP
|
||||
fprintf (stderr, "test_null_key (client public)\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_null_key (ctx, server, server_mon, my_endpoint, valid_server_public,
|
||||
null_key, valid_client_secret);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
// Check CURVE security with a null client secret key
|
||||
// This will be caught by the curve_server class, not passed to ZAP
|
||||
fprintf (stderr, "test_null_key (client secret)\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_null_key (ctx, server, server_mon, my_endpoint, valid_server_public,
|
||||
valid_client_public, null_key);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (stderr, "test_curve_security_with_bogus_client_credentials\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_with_bogus_client_credentials (ctx, my_endpoint, server,
|
||||
server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (stderr, "test_curve_security_with_null_client_credentials\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_with_null_client_credentials (ctx, my_endpoint, server,
|
||||
server_mon);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (stderr, "test_curve_security_with_plain_client_credentials\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_with_plain_client_credentials (ctx, my_endpoint, server,
|
||||
server_mon);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
fprintf (stderr, "test_curve_security_unauthenticated_message\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_unauthenticated_message (my_endpoint, server, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
UNITY_BEGIN ();
|
||||
RUN_TEST (test_curve_security_with_valid_credentials);
|
||||
RUN_TEST (test_null_server_key);
|
||||
RUN_TEST (test_null_client_public_key);
|
||||
RUN_TEST (test_null_client_secret_key);
|
||||
RUN_TEST (test_curve_security_with_bogus_client_credentials);
|
||||
RUN_TEST (test_curve_security_with_null_client_credentials);
|
||||
RUN_TEST (test_curve_security_with_plain_client_credentials);
|
||||
RUN_TEST (test_curve_security_unauthenticated_message);
|
||||
|
||||
// tests with misbehaving CURVE client
|
||||
fprintf (stderr, "test_curve_security_invalid_hello_wrong_length\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_invalid_hello_wrong_length (my_endpoint, server,
|
||||
server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
fprintf (stderr, "test_curve_security_invalid_hello_command_name\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_invalid_hello_command_name (my_endpoint, server,
|
||||
server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (stderr, "test_curve_security_invalid_hello_command_version\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_invalid_hello_version (my_endpoint, server, server_mon,
|
||||
timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (stderr, "test_curve_security_invalid_initiate_command_length\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_invalid_initiate_length (my_endpoint, server,
|
||||
server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (stderr, "test_curve_security_invalid_initiate_command_name\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_invalid_initiate_command_name (my_endpoint, server,
|
||||
server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (stderr,
|
||||
"test_curve_security_invalid_initiate_command_encrypted_cookie\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_invalid_initiate_command_encrypted_cookie (
|
||||
my_endpoint, server, server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
fprintf (
|
||||
stderr,
|
||||
"test_curve_security_invalid_initiate_command_encrypted_content\n");
|
||||
setup_context_and_server_side (&ctx, &handler, &zap_thread, &server,
|
||||
&server_mon, my_endpoint);
|
||||
test_curve_security_invalid_initiate_command_encrypted_content (
|
||||
my_endpoint, server, server_mon, timeout);
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
RUN_TEST (test_curve_security_invalid_hello_wrong_length);
|
||||
RUN_TEST (test_curve_security_invalid_hello_command_name);
|
||||
RUN_TEST (test_curve_security_invalid_hello_version);
|
||||
RUN_TEST (test_curve_security_invalid_initiate_wrong_length);
|
||||
RUN_TEST (test_curve_security_invalid_initiate_command_name);
|
||||
RUN_TEST (test_curve_security_invalid_initiate_command_encrypted_cookie);
|
||||
RUN_TEST (test_curve_security_invalid_initiate_command_encrypted_content);
|
||||
|
||||
// TODO this requires a deviating test setup, must be moved to a separate executable/fixture
|
||||
// test with a large routing id (resulting in large metadata)
|
||||
fprintf (stderr,
|
||||
"test_curve_security_with_valid_credentials (large routing id)\n");
|
||||
@ -775,17 +675,16 @@ int main (void)
|
||||
&ctx, &handler, &zap_thread, &server, &server_mon, my_endpoint,
|
||||
&zap_handler_large_routing_id, &socket_config_curve_server,
|
||||
&valid_server_secret, large_routing_id);
|
||||
test_curve_security_with_valid_credentials (ctx, my_endpoint, server,
|
||||
server_mon, timeout);
|
||||
test_curve_security_with_valid_credentials ();
|
||||
shutdown_context_and_server_side (ctx, zap_thread, server, server_mon,
|
||||
handler);
|
||||
|
||||
ctx = zmq_ctx_new ();
|
||||
test_curve_security_invalid_keysize (ctx);
|
||||
int rc = zmq_ctx_term (ctx);
|
||||
assert (rc == 0);
|
||||
TEST_ASSERT_ZMQ_ERRNO (rc == 0);
|
||||
|
||||
zmq::random_close ();
|
||||
|
||||
return 0;
|
||||
return UNITY_END ();
|
||||
}
|
||||
|
@ -29,54 +29,118 @@
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
#include <unity.h>
|
||||
|
||||
void setUp ()
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown ()
|
||||
{
|
||||
}
|
||||
|
||||
// tests all socket-related functions with a NULL socket argument
|
||||
int main (void)
|
||||
void test_zmq_socket_null_context ()
|
||||
{
|
||||
void *s = zmq_socket (NULL, ZMQ_PAIR);
|
||||
assert (s == NULL);
|
||||
assert (errno == EFAULT); // TODO use EINVAL instead?
|
||||
TEST_ASSERT_NULL (s);
|
||||
TEST_ASSERT_EQUAL_INT (EFAULT, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
void test_zmq_close_null_socket ()
|
||||
{
|
||||
int rc = zmq_close (NULL);
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
void test_zmq_setsockopt_null_socket ()
|
||||
{
|
||||
int hwm = 100;
|
||||
size_t hwm_size = sizeof hwm;
|
||||
rc = zmq_setsockopt (NULL, ZMQ_SNDHWM, &hwm, hwm_size);
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
int rc = zmq_setsockopt (NULL, ZMQ_SNDHWM, &hwm, hwm_size);
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
rc = zmq_getsockopt (NULL, ZMQ_SNDHWM, &hwm, &hwm_size);
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
void test_zmq_getsockopt_null_socket ()
|
||||
{
|
||||
int hwm;
|
||||
size_t hwm_size = sizeof hwm;
|
||||
int rc = zmq_getsockopt (NULL, ZMQ_SNDHWM, &hwm, &hwm_size);
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
rc = zmq_socket_monitor (NULL, "inproc://monitor", ZMQ_EVENT_ALL);
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
void test_zmq_socket_monitor_null_socket ()
|
||||
{
|
||||
int rc = zmq_socket_monitor (NULL, "inproc://monitor", ZMQ_EVENT_ALL);
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
rc = zmq_join (NULL, "group");
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
void test_zmq_join_null_socket ()
|
||||
{
|
||||
int rc = zmq_join (NULL, "group");
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
rc = zmq_leave (NULL, "group");
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
void test_zmq_leave_null_socket ()
|
||||
{
|
||||
int rc = zmq_leave (NULL, "group");
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
#endif
|
||||
|
||||
rc = zmq_bind (NULL, "inproc://socket");
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
|
||||
rc = zmq_connect (NULL, "inproc://socket");
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
|
||||
rc = zmq_unbind (NULL, "inproc://socket");
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
|
||||
rc = zmq_disconnect (NULL, "inproc://socket");
|
||||
assert (rc == -1);
|
||||
assert (errno == ENOTSOCK); // TODO use EINVAL instead?
|
||||
void test_zmq_bind_null_socket ()
|
||||
{
|
||||
int rc = zmq_bind (NULL, "inproc://socket");
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
void test_zmq_connect_null_socket ()
|
||||
{
|
||||
int rc = zmq_connect (NULL, "inproc://socket");
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
void test_zmq_unbind_null_socket ()
|
||||
{
|
||||
int rc = zmq_unbind (NULL, "inproc://socket");
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
void test_zmq_disconnect_null_socket ()
|
||||
{
|
||||
int rc = zmq_disconnect (NULL, "inproc://socket");
|
||||
TEST_ASSERT_EQUAL_INT (-1, rc);
|
||||
TEST_ASSERT_EQUAL_INT (ENOTSOCK, errno); // TODO use EINVAL instead?
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
UNITY_BEGIN ();
|
||||
RUN_TEST (test_zmq_socket_null_context);
|
||||
RUN_TEST (test_zmq_close_null_socket);
|
||||
RUN_TEST (test_zmq_setsockopt_null_socket);
|
||||
RUN_TEST (test_zmq_getsockopt_null_socket);
|
||||
RUN_TEST (test_zmq_socket_monitor_null_socket);
|
||||
RUN_TEST (test_zmq_bind_null_socket);
|
||||
RUN_TEST (test_zmq_connect_null_socket);
|
||||
RUN_TEST (test_zmq_unbind_null_socket);
|
||||
RUN_TEST (test_zmq_disconnect_null_socket);
|
||||
|
||||
#ifdef ZMQ_BUILD_DRAFT_API
|
||||
RUN_TEST (test_zmq_join_null_socket);
|
||||
RUN_TEST (test_zmq_leave_null_socket);
|
||||
#endif
|
||||
|
||||
return UNITY_END ();
|
||||
}
|
||||
|
64
unittests/CMakeLists.txt
Normal file
64
unittests/CMakeLists.txt
Normal file
@ -0,0 +1,64 @@
|
||||
# CMake build script for ZeroMQ unit tests
|
||||
cmake_minimum_required(VERSION "2.8.1")
|
||||
|
||||
set(unittests
|
||||
unittest_ypipe
|
||||
unittest_poller
|
||||
)
|
||||
|
||||
#IF (ENABLE_DRAFTS)
|
||||
# list(APPEND tests
|
||||
# )
|
||||
#ENDIF (ENABLE_DRAFTS)
|
||||
|
||||
# add location of platform.hpp for Windows builds
|
||||
if(WIN32)
|
||||
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
||||
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
# Same name on 64bit systems
|
||||
link_libraries(ws2_32.lib)
|
||||
endif()
|
||||
|
||||
include_directories("${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/src" "${CMAKE_BINARY_DIR}")
|
||||
|
||||
foreach(test ${unittests})
|
||||
# target_sources not supported before CMake 3.1
|
||||
add_executable(${test} ${test}.cpp)
|
||||
|
||||
# per-test directories not generated on OS X / Darwin
|
||||
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*")
|
||||
link_directories(${test} PRIVATE "${CMAKE_SOURCE_DIR}/../lib")
|
||||
endif()
|
||||
|
||||
target_link_libraries(${test} libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
||||
|
||||
if(RT_LIBRARY)
|
||||
target_link_libraries(${test} ${RT_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
|
||||
else()
|
||||
add_test(NAME ${test} COMMAND ${test})
|
||||
endif()
|
||||
|
||||
set_tests_properties(${test} PROPERTIES TIMEOUT 10)
|
||||
|
||||
# TODO prevent libzmq (non-static) being in the list of link libraries at all
|
||||
get_target_property(LIBS ${test} LINK_LIBRARIES)
|
||||
list(REMOVE_ITEM LIBS libzmq)
|
||||
message("Link libraries of ${test}: ${LIBS}")
|
||||
set_target_properties(${test} PROPERTIES LINK_LIBRARIES "${LIBS}")
|
||||
endforeach()
|
||||
|
||||
#Check whether all tests in the current folder are present
|
||||
#TODO duplicated with tests/CMakeLists.txt, define as a function?
|
||||
file(READ "${CMAKE_CURRENT_LIST_FILE}" CURRENT_LIST_FILE_CONTENT)
|
||||
file(GLOB ALL_TEST_SOURCES "test_*.cpp")
|
||||
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
|
||||
get_filename_component(TESTNAME "${TEST_SOURCE}" NAME_WE)
|
||||
string(REGEX MATCH "${TESTNAME}" MATCH_TESTNAME "${CURRENT_LIST_FILE_CONTENT}")
|
||||
if (NOT MATCH_TESTNAME)
|
||||
message(AUTHOR_WARNING "Test '${TESTNAME}' is not known to CTest.")
|
||||
endif()
|
||||
endforeach()
|
47
unittests/unittest_poller.cpp
Normal file
47
unittests/unittest_poller.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (c) 2018 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
0MQ is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
0MQ is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../tests/testutil.hpp"
|
||||
|
||||
#include <poller.hpp>
|
||||
|
||||
#include <unity.h>
|
||||
|
||||
void setUp ()
|
||||
{
|
||||
}
|
||||
void tearDown ()
|
||||
{
|
||||
}
|
||||
|
||||
void test_create ()
|
||||
{
|
||||
zmq::thread_ctx_t thread_ctx;
|
||||
zmq::poller_t poller (thread_ctx);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
setup_test_environment ();
|
||||
|
||||
UNITY_BEGIN ();
|
||||
RUN_TEST (test_create);
|
||||
|
||||
return UNITY_END ();
|
||||
}
|
46
unittests/unittest_ypipe.cpp
Normal file
46
unittests/unittest_ypipe.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (c) 2018 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
0MQ is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
0MQ is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../tests/testutil.hpp"
|
||||
|
||||
#include <ypipe.hpp>
|
||||
|
||||
#include <unity.h>
|
||||
|
||||
void setUp ()
|
||||
{
|
||||
}
|
||||
void tearDown ()
|
||||
{
|
||||
}
|
||||
|
||||
void test_create ()
|
||||
{
|
||||
zmq::ypipe_t<int, 1> ypipe;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
setup_test_environment ();
|
||||
|
||||
UNITY_BEGIN ();
|
||||
RUN_TEST (test_create);
|
||||
|
||||
return UNITY_END ();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user