mirror of
https://github.com/tbamud/tbamud.git
synced 2026-04-30 04:41:51 +02:00
Add Unity-based unit test infrastructure (Phase 1: 117 tests passing)
Agent-Logs-Url: https://github.com/tbamud/tbamud/sessions/d5b86db2-e5ab-4729-b8b1-2ca7cf01c6b9 Co-authored-by: welcor <357770+welcor@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
552461df51
commit
fff58ccab3
95
tests/CMakeLists.txt
Normal file
95
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,95 @@
|
||||
# tests/CMakeLists.txt
|
||||
# Unity-based unit tests for tbaMUD
|
||||
#
|
||||
# Each test executable is built from:
|
||||
# vendor/unity/unity.c — test framework
|
||||
# test_stubs.c — weak-symbol stubs for all unresolved mud globals
|
||||
# src/<module>.c — the source file(s) under test
|
||||
# test_<name>.c — the test file itself
|
||||
#
|
||||
# Only the source files being tested are compiled — in particular comm.c
|
||||
# (which contains main()) is never included.
|
||||
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
enable_testing()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Common settings shared by all test targets
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
set(UNITY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/unity/unity.c)
|
||||
set(STUBS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_stubs.c)
|
||||
|
||||
set(MUD_SRCDIR ${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
# Include paths: mud source dir for conf.h / structs.h etc.,
|
||||
# CMake binary dir for the generated conf.h (cmake builds place it there),
|
||||
# and the Unity header dir.
|
||||
set(TEST_INCLUDES
|
||||
${MUD_SRCDIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vendor/unity
|
||||
)
|
||||
|
||||
# Suppress warnings that fire in generated stubs / vendored code and in the
|
||||
# mud sources when compiled outside their normal full-build context.
|
||||
set(TEST_CFLAGS
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
-Wno-unused-variable
|
||||
)
|
||||
|
||||
# Helper macro: add_mud_test(name SRC1 [SRC2 …])
|
||||
# Creates an executable, registers it with CTest.
|
||||
macro(add_mud_test TEST_NAME)
|
||||
add_executable(${TEST_NAME}
|
||||
${UNITY_SRC}
|
||||
${STUBS_SRC}
|
||||
${ARGN}
|
||||
)
|
||||
target_include_directories(${TEST_NAME} PRIVATE ${TEST_INCLUDES})
|
||||
target_compile_options(${TEST_NAME} PRIVATE ${TEST_CFLAGS})
|
||||
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
|
||||
endmacro()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_utils — covers src/utils.c
|
||||
# ---------------------------------------------------------------------------
|
||||
add_mud_test(test_utils
|
||||
${MUD_SRCDIR}/utils.c
|
||||
${MUD_SRCDIR}/random.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_utils.c
|
||||
)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_random — covers src/random.c and rand_number/dice in src/utils.c
|
||||
# ---------------------------------------------------------------------------
|
||||
add_mud_test(test_random
|
||||
${MUD_SRCDIR}/random.c
|
||||
${MUD_SRCDIR}/utils.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_random.c
|
||||
)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_interpreter — covers string helpers in src/interpreter.c
|
||||
# ---------------------------------------------------------------------------
|
||||
add_mud_test(test_interpreter
|
||||
${MUD_SRCDIR}/interpreter.c
|
||||
${MUD_SRCDIR}/utils.c
|
||||
${MUD_SRCDIR}/random.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_interpreter.c
|
||||
)
|
||||
|
||||
# crypt() is referenced from interpreter.c (nanny password hashing)
|
||||
target_link_libraries(test_interpreter PRIVATE crypt)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_class — covers src/class.c
|
||||
# ---------------------------------------------------------------------------
|
||||
add_mud_test(test_class
|
||||
${MUD_SRCDIR}/class.c
|
||||
${MUD_SRCDIR}/utils.c
|
||||
${MUD_SRCDIR}/random.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_class.c
|
||||
)
|
||||
82
tests/Makefile
Normal file
82
tests/Makefile
Normal file
@@ -0,0 +1,82 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# tests/Makefile.in
|
||||
# Autoconf template — processed by configure to produce tests/Makefile.
|
||||
#
|
||||
# Build and run the tbaMUD unit-test suite.
|
||||
# Usage (after running ./configure from the project root):
|
||||
#
|
||||
# cd tests && make # build all test binaries
|
||||
# cd tests && make test # build and run all tests
|
||||
|
||||
CC = gcc
|
||||
MYFLAGS = -Wall -Wno-char-subscripts -Wno-unused-but-set-variable
|
||||
CFLAGS = -g -O2 $(MYFLAGS)
|
||||
LIBS = -lcrypt
|
||||
|
||||
SRCDIR = ../src
|
||||
UNITYDIR = vendor/unity
|
||||
|
||||
# Include paths:
|
||||
# ../src — mud headers and the generated conf.h
|
||||
# vendor/unity — Unity framework headers
|
||||
INCFLAGS = -I$(SRCDIR) -I$(UNITYDIR)
|
||||
|
||||
# Suppress warnings that fire in generated stubs / vendored code
|
||||
WARNFLAGS = -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable
|
||||
|
||||
COMPILE = $(CC) $(CFLAGS) $(WARNFLAGS) $(INCFLAGS)
|
||||
|
||||
# Common object files compiled into every test binary
|
||||
UNITY_SRC = $(UNITYDIR)/unity.c
|
||||
STUBS_SRC = test_stubs.c
|
||||
|
||||
# tbaMUD source files used by the tests
|
||||
UTILS_SRC = $(SRCDIR)/utils.c $(SRCDIR)/random.c
|
||||
|
||||
# All test binaries
|
||||
TESTS = test_utils test_random test_interpreter test_class
|
||||
|
||||
.PHONY: all test clean
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_utils — covers src/utils.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_utils: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) test_utils.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_random — covers src/random.c and rand_number/dice in src/utils.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_random: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) test_random.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_interpreter — covers string helpers in src/interpreter.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_interpreter: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) \
|
||||
$(SRCDIR)/interpreter.c test_interpreter.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_class — covers src/class.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_class: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) \
|
||||
$(SRCDIR)/class.c test_class.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Run all tests
|
||||
# ---------------------------------------------------------------------------
|
||||
test: $(TESTS)
|
||||
@echo "=========================================="
|
||||
@echo "Running tbaMUD unit tests"
|
||||
@echo "=========================================="
|
||||
@./test_utils && echo "[PASS] test_utils" || echo "[FAIL] test_utils"
|
||||
@./test_random && echo "[PASS] test_random" || echo "[FAIL] test_random"
|
||||
@./test_interpreter && echo "[PASS] test_interpreter" || echo "[FAIL] test_interpreter"
|
||||
@./test_class && echo "[PASS] test_class" || echo "[FAIL] test_class"
|
||||
|
||||
clean:
|
||||
rm -f $(TESTS)
|
||||
81
tests/Makefile.in
Normal file
81
tests/Makefile.in
Normal file
@@ -0,0 +1,81 @@
|
||||
# tests/Makefile.in
|
||||
# Autoconf template — processed by configure to produce tests/Makefile.
|
||||
#
|
||||
# Build and run the tbaMUD unit-test suite.
|
||||
# Usage (after running ./configure from the project root):
|
||||
#
|
||||
# cd tests && make # build all test binaries
|
||||
# cd tests && make test # build and run all tests
|
||||
|
||||
CC = @CC@
|
||||
MYFLAGS = @MYFLAGS@
|
||||
CFLAGS = @CFLAGS@ $(MYFLAGS)
|
||||
LIBS = @LIBS@ @CRYPTLIB@ @NETLIB@
|
||||
|
||||
SRCDIR = ../src
|
||||
UNITYDIR = vendor/unity
|
||||
|
||||
# Include paths:
|
||||
# ../src — mud headers and the generated conf.h
|
||||
# vendor/unity — Unity framework headers
|
||||
INCFLAGS = -I$(SRCDIR) -I$(UNITYDIR)
|
||||
|
||||
# Suppress warnings that fire in generated stubs / vendored code
|
||||
WARNFLAGS = -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable
|
||||
|
||||
COMPILE = $(CC) $(CFLAGS) $(WARNFLAGS) $(INCFLAGS)
|
||||
|
||||
# Common object files compiled into every test binary
|
||||
UNITY_SRC = $(UNITYDIR)/unity.c
|
||||
STUBS_SRC = test_stubs.c
|
||||
|
||||
# tbaMUD source files used by the tests
|
||||
UTILS_SRC = $(SRCDIR)/utils.c $(SRCDIR)/random.c
|
||||
|
||||
# All test binaries
|
||||
TESTS = test_utils test_random test_interpreter test_class
|
||||
|
||||
.PHONY: all test clean
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_utils — covers src/utils.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_utils: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) test_utils.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_random — covers src/random.c and rand_number/dice in src/utils.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_random: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) test_random.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_interpreter — covers string helpers in src/interpreter.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_interpreter: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) \
|
||||
$(SRCDIR)/interpreter.c test_interpreter.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# test_class — covers src/class.c
|
||||
# ---------------------------------------------------------------------------
|
||||
test_class: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) \
|
||||
$(SRCDIR)/class.c test_class.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Run all tests
|
||||
# ---------------------------------------------------------------------------
|
||||
test: $(TESTS)
|
||||
@echo "=========================================="
|
||||
@echo "Running tbaMUD unit tests"
|
||||
@echo "=========================================="
|
||||
@./test_utils && echo "[PASS] test_utils" || echo "[FAIL] test_utils"
|
||||
@./test_random && echo "[PASS] test_random" || echo "[FAIL] test_random"
|
||||
@./test_interpreter && echo "[PASS] test_interpreter" || echo "[FAIL] test_interpreter"
|
||||
@./test_class && echo "[PASS] test_class" || echo "[FAIL] test_class"
|
||||
|
||||
clean:
|
||||
rm -f $(TESTS)
|
||||
BIN
tests/test_class
Executable file
BIN
tests/test_class
Executable file
Binary file not shown.
237
tests/test_class.c
Normal file
237
tests/test_class.c
Normal file
@@ -0,0 +1,237 @@
|
||||
/**
|
||||
* @file test_class.c
|
||||
* Unit tests for pure functions in src/class.c:
|
||||
* parse_class, thaco, backstab_mult, level_exp
|
||||
*/
|
||||
|
||||
#include "unity.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
#include "utils.h"
|
||||
#include "class.h"
|
||||
|
||||
extern FILE *logfile;
|
||||
|
||||
void setUp(void) { logfile = stderr; }
|
||||
void tearDown(void) { logfile = NULL; }
|
||||
|
||||
/* =========================================================
|
||||
* parse_class
|
||||
* ========================================================= */
|
||||
|
||||
void test_parse_class_magic_user_lowercase(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_MAGIC_USER, parse_class('m'));
|
||||
}
|
||||
|
||||
void test_parse_class_cleric_lowercase(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_CLERIC, parse_class('c'));
|
||||
}
|
||||
|
||||
void test_parse_class_warrior_lowercase(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_WARRIOR, parse_class('w'));
|
||||
}
|
||||
|
||||
void test_parse_class_thief_lowercase(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_THIEF, parse_class('t'));
|
||||
}
|
||||
|
||||
void test_parse_class_uppercase(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_MAGIC_USER, parse_class('M'));
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_CLERIC, parse_class('C'));
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_WARRIOR, parse_class('W'));
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_THIEF, parse_class('T'));
|
||||
}
|
||||
|
||||
void test_parse_class_invalid(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_UNDEFINED, parse_class('x'));
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_UNDEFINED, parse_class('?'));
|
||||
TEST_ASSERT_EQUAL_INT(CLASS_UNDEFINED, parse_class(' '));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* thaco
|
||||
* ========================================================= */
|
||||
|
||||
void test_thaco_magic_user_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(20, thaco(CLASS_MAGIC_USER, 1));
|
||||
}
|
||||
|
||||
void test_thaco_magic_user_level_10(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(17, thaco(CLASS_MAGIC_USER, 10));
|
||||
}
|
||||
|
||||
void test_thaco_cleric_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(20, thaco(CLASS_CLERIC, 1));
|
||||
}
|
||||
|
||||
void test_thaco_warrior_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(20, thaco(CLASS_WARRIOR, 1));
|
||||
}
|
||||
|
||||
void test_thaco_warrior_level_20(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(2, thaco(CLASS_WARRIOR, 20));
|
||||
}
|
||||
|
||||
void test_thaco_warrior_high_level_is_one(void)
|
||||
{
|
||||
/* Warriors hit thac0=1 around level 21 and stay there */
|
||||
TEST_ASSERT_EQUAL_INT(1, thaco(CLASS_WARRIOR, 21));
|
||||
TEST_ASSERT_EQUAL_INT(1, thaco(CLASS_WARRIOR, LVL_IMPL));
|
||||
}
|
||||
|
||||
void test_thaco_thief_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(20, thaco(CLASS_THIEF, 1));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* backstab_mult
|
||||
* ========================================================= */
|
||||
|
||||
void test_backstab_mult_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(2, backstab_mult(1));
|
||||
}
|
||||
|
||||
void test_backstab_mult_level_7(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(2, backstab_mult(7));
|
||||
}
|
||||
|
||||
void test_backstab_mult_level_8(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(3, backstab_mult(8));
|
||||
}
|
||||
|
||||
void test_backstab_mult_level_13(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(3, backstab_mult(13));
|
||||
}
|
||||
|
||||
void test_backstab_mult_level_14(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(4, backstab_mult(14));
|
||||
}
|
||||
|
||||
void test_backstab_mult_level_20(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(4, backstab_mult(20));
|
||||
}
|
||||
|
||||
void test_backstab_mult_level_21(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(5, backstab_mult(21));
|
||||
}
|
||||
|
||||
void test_backstab_mult_immortal(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(20, backstab_mult(LVL_IMMORT));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* level_exp
|
||||
* ========================================================= */
|
||||
|
||||
void test_level_exp_magic_user_level_0(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, level_exp(CLASS_MAGIC_USER, 0));
|
||||
}
|
||||
|
||||
void test_level_exp_magic_user_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(1, level_exp(CLASS_MAGIC_USER, 1));
|
||||
}
|
||||
|
||||
void test_level_exp_magic_user_level_2(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(2500, level_exp(CLASS_MAGIC_USER, 2));
|
||||
}
|
||||
|
||||
void test_level_exp_cleric_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(1, level_exp(CLASS_CLERIC, 1));
|
||||
}
|
||||
|
||||
void test_level_exp_thief_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(1, level_exp(CLASS_THIEF, 1));
|
||||
}
|
||||
|
||||
void test_level_exp_warrior_level_1(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(1, level_exp(CLASS_WARRIOR, 1));
|
||||
}
|
||||
|
||||
void test_level_exp_invalid_level_returns_zero(void)
|
||||
{
|
||||
/* Level > LVL_IMPL or level < 0 → logs error and returns 0 */
|
||||
TEST_ASSERT_EQUAL_INT(0, level_exp(CLASS_MAGIC_USER, -1));
|
||||
TEST_ASSERT_EQUAL_INT(0, level_exp(CLASS_MAGIC_USER, LVL_IMPL + 1));
|
||||
}
|
||||
|
||||
void test_level_exp_immortal_level(void)
|
||||
{
|
||||
/* LVL_IMMORT for mage → 8000000 */
|
||||
TEST_ASSERT_EQUAL_INT(8000000, level_exp(CLASS_MAGIC_USER, LVL_IMMORT));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* main
|
||||
* ========================================================= */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
/* parse_class */
|
||||
RUN_TEST(test_parse_class_magic_user_lowercase);
|
||||
RUN_TEST(test_parse_class_cleric_lowercase);
|
||||
RUN_TEST(test_parse_class_warrior_lowercase);
|
||||
RUN_TEST(test_parse_class_thief_lowercase);
|
||||
RUN_TEST(test_parse_class_uppercase);
|
||||
RUN_TEST(test_parse_class_invalid);
|
||||
|
||||
/* thaco */
|
||||
RUN_TEST(test_thaco_magic_user_level_1);
|
||||
RUN_TEST(test_thaco_magic_user_level_10);
|
||||
RUN_TEST(test_thaco_cleric_level_1);
|
||||
RUN_TEST(test_thaco_warrior_level_1);
|
||||
RUN_TEST(test_thaco_warrior_level_20);
|
||||
RUN_TEST(test_thaco_warrior_high_level_is_one);
|
||||
RUN_TEST(test_thaco_thief_level_1);
|
||||
|
||||
/* backstab_mult */
|
||||
RUN_TEST(test_backstab_mult_level_1);
|
||||
RUN_TEST(test_backstab_mult_level_7);
|
||||
RUN_TEST(test_backstab_mult_level_8);
|
||||
RUN_TEST(test_backstab_mult_level_13);
|
||||
RUN_TEST(test_backstab_mult_level_14);
|
||||
RUN_TEST(test_backstab_mult_level_20);
|
||||
RUN_TEST(test_backstab_mult_level_21);
|
||||
RUN_TEST(test_backstab_mult_immortal);
|
||||
|
||||
/* level_exp */
|
||||
RUN_TEST(test_level_exp_magic_user_level_0);
|
||||
RUN_TEST(test_level_exp_magic_user_level_1);
|
||||
RUN_TEST(test_level_exp_magic_user_level_2);
|
||||
RUN_TEST(test_level_exp_cleric_level_1);
|
||||
RUN_TEST(test_level_exp_thief_level_1);
|
||||
RUN_TEST(test_level_exp_warrior_level_1);
|
||||
RUN_TEST(test_level_exp_invalid_level_returns_zero);
|
||||
RUN_TEST(test_level_exp_immortal_level);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
BIN
tests/test_interpreter
Executable file
BIN
tests/test_interpreter
Executable file
Binary file not shown.
256
tests/test_interpreter.c
Normal file
256
tests/test_interpreter.c
Normal file
@@ -0,0 +1,256 @@
|
||||
/**
|
||||
* @file test_interpreter.c
|
||||
* Unit tests for pure string-handling functions in src/interpreter.c:
|
||||
* is_number, is_abbrev, delete_doubledollar, any_one_arg, one_word
|
||||
*/
|
||||
|
||||
#include "unity.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
#include "utils.h"
|
||||
#include "interpreter.h"
|
||||
|
||||
extern FILE *logfile;
|
||||
|
||||
void setUp(void) { logfile = stderr; }
|
||||
void tearDown(void) { logfile = NULL; }
|
||||
|
||||
/* =========================================================
|
||||
* is_number
|
||||
* ========================================================= */
|
||||
|
||||
void test_is_number_digits_only(void)
|
||||
{
|
||||
TEST_ASSERT_TRUE(is_number("42"));
|
||||
}
|
||||
|
||||
void test_is_number_zero(void)
|
||||
{
|
||||
TEST_ASSERT_TRUE(is_number("0"));
|
||||
}
|
||||
|
||||
void test_is_number_negative(void)
|
||||
{
|
||||
TEST_ASSERT_TRUE(is_number("-5"));
|
||||
}
|
||||
|
||||
void test_is_number_empty_string(void)
|
||||
{
|
||||
TEST_ASSERT_FALSE(is_number(""));
|
||||
}
|
||||
|
||||
void test_is_number_contains_letter(void)
|
||||
{
|
||||
TEST_ASSERT_FALSE(is_number("12x3"));
|
||||
}
|
||||
|
||||
void test_is_number_minus_only(void)
|
||||
{
|
||||
TEST_ASSERT_FALSE(is_number("-"));
|
||||
}
|
||||
|
||||
void test_is_number_float(void)
|
||||
{
|
||||
TEST_ASSERT_FALSE(is_number("3.14"));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* is_abbrev
|
||||
* ========================================================= */
|
||||
|
||||
void test_is_abbrev_exact_match(void)
|
||||
{
|
||||
TEST_ASSERT_TRUE(is_abbrev("north", "north"));
|
||||
}
|
||||
|
||||
void test_is_abbrev_valid_prefix(void)
|
||||
{
|
||||
TEST_ASSERT_TRUE(is_abbrev("nort", "north"));
|
||||
TEST_ASSERT_TRUE(is_abbrev("n", "north"));
|
||||
}
|
||||
|
||||
void test_is_abbrev_non_prefix(void)
|
||||
{
|
||||
TEST_ASSERT_FALSE(is_abbrev("south", "north"));
|
||||
}
|
||||
|
||||
void test_is_abbrev_empty_arg1(void)
|
||||
{
|
||||
TEST_ASSERT_FALSE(is_abbrev("", "north"));
|
||||
}
|
||||
|
||||
void test_is_abbrev_arg1_longer_than_arg2(void)
|
||||
{
|
||||
TEST_ASSERT_FALSE(is_abbrev("northward", "north"));
|
||||
}
|
||||
|
||||
void test_is_abbrev_case_insensitive(void)
|
||||
{
|
||||
TEST_ASSERT_TRUE(is_abbrev("Nor", "north"));
|
||||
TEST_ASSERT_TRUE(is_abbrev("NOR", "NORTH"));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* delete_doubledollar
|
||||
* ========================================================= */
|
||||
|
||||
void test_delete_doubledollar_no_dollars(void)
|
||||
{
|
||||
char s[] = "hello";
|
||||
delete_doubledollar(s);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", s);
|
||||
}
|
||||
|
||||
void test_delete_doubledollar_double_at_start(void)
|
||||
{
|
||||
char s[] = "$$hello";
|
||||
delete_doubledollar(s);
|
||||
TEST_ASSERT_EQUAL_STRING("$hello", s);
|
||||
}
|
||||
|
||||
void test_delete_doubledollar_double_in_middle(void)
|
||||
{
|
||||
char s[] = "hello$$world";
|
||||
delete_doubledollar(s);
|
||||
TEST_ASSERT_EQUAL_STRING("hello$world", s);
|
||||
}
|
||||
|
||||
void test_delete_doubledollar_four_dollars(void)
|
||||
{
|
||||
char s[] = "$$$$";
|
||||
delete_doubledollar(s);
|
||||
TEST_ASSERT_EQUAL_STRING("$$", s);
|
||||
}
|
||||
|
||||
void test_delete_doubledollar_single_dollar_unchanged(void)
|
||||
{
|
||||
char s[] = "hello$world";
|
||||
delete_doubledollar(s);
|
||||
TEST_ASSERT_EQUAL_STRING("hello$world", s);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* any_one_arg
|
||||
* ========================================================= */
|
||||
|
||||
void test_any_one_arg_basic(void)
|
||||
{
|
||||
char first[64];
|
||||
char *rest = any_one_arg("hello world", first);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", first);
|
||||
TEST_ASSERT_EQUAL_STRING(" world", rest);
|
||||
}
|
||||
|
||||
void test_any_one_arg_leading_spaces(void)
|
||||
{
|
||||
char first[64];
|
||||
any_one_arg(" hello world", first);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", first);
|
||||
}
|
||||
|
||||
void test_any_one_arg_single_word(void)
|
||||
{
|
||||
char first[64];
|
||||
char *rest = any_one_arg("hello", first);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", first);
|
||||
TEST_ASSERT_EQUAL_STRING("", rest);
|
||||
}
|
||||
|
||||
void test_any_one_arg_empty_string(void)
|
||||
{
|
||||
char first[64];
|
||||
any_one_arg("", first);
|
||||
TEST_ASSERT_EQUAL_STRING("", first);
|
||||
}
|
||||
|
||||
void test_any_one_arg_lowercases(void)
|
||||
{
|
||||
char first[64];
|
||||
any_one_arg("HELLO", first);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", first);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* one_word
|
||||
* ========================================================= */
|
||||
|
||||
void test_one_word_unquoted_like_any_one_arg(void)
|
||||
{
|
||||
char first[64];
|
||||
char *rest = one_word("hello world", first);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", first);
|
||||
TEST_ASSERT_EQUAL_STRING(" world", rest);
|
||||
}
|
||||
|
||||
void test_one_word_quoted_string(void)
|
||||
{
|
||||
char first[64];
|
||||
char *rest = one_word("\"hello world\" rest", first);
|
||||
TEST_ASSERT_EQUAL_STRING("hello world", first);
|
||||
/* rest points just past the closing quote */
|
||||
TEST_ASSERT_EQUAL_STRING(" rest", rest);
|
||||
}
|
||||
|
||||
void test_one_word_empty_quoted(void)
|
||||
{
|
||||
char first[64];
|
||||
one_word("\"\" rest", first);
|
||||
TEST_ASSERT_EQUAL_STRING("", first);
|
||||
}
|
||||
|
||||
void test_one_word_leading_spaces_skipped(void)
|
||||
{
|
||||
char first[64];
|
||||
one_word(" hello", first);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", first);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* main
|
||||
* ========================================================= */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
/* is_number */
|
||||
RUN_TEST(test_is_number_digits_only);
|
||||
RUN_TEST(test_is_number_zero);
|
||||
RUN_TEST(test_is_number_negative);
|
||||
RUN_TEST(test_is_number_empty_string);
|
||||
RUN_TEST(test_is_number_contains_letter);
|
||||
RUN_TEST(test_is_number_minus_only);
|
||||
RUN_TEST(test_is_number_float);
|
||||
|
||||
/* is_abbrev */
|
||||
RUN_TEST(test_is_abbrev_exact_match);
|
||||
RUN_TEST(test_is_abbrev_valid_prefix);
|
||||
RUN_TEST(test_is_abbrev_non_prefix);
|
||||
RUN_TEST(test_is_abbrev_empty_arg1);
|
||||
RUN_TEST(test_is_abbrev_arg1_longer_than_arg2);
|
||||
RUN_TEST(test_is_abbrev_case_insensitive);
|
||||
|
||||
/* delete_doubledollar */
|
||||
RUN_TEST(test_delete_doubledollar_no_dollars);
|
||||
RUN_TEST(test_delete_doubledollar_double_at_start);
|
||||
RUN_TEST(test_delete_doubledollar_double_in_middle);
|
||||
RUN_TEST(test_delete_doubledollar_four_dollars);
|
||||
RUN_TEST(test_delete_doubledollar_single_dollar_unchanged);
|
||||
|
||||
/* any_one_arg */
|
||||
RUN_TEST(test_any_one_arg_basic);
|
||||
RUN_TEST(test_any_one_arg_leading_spaces);
|
||||
RUN_TEST(test_any_one_arg_single_word);
|
||||
RUN_TEST(test_any_one_arg_empty_string);
|
||||
RUN_TEST(test_any_one_arg_lowercases);
|
||||
|
||||
/* one_word */
|
||||
RUN_TEST(test_one_word_unquoted_like_any_one_arg);
|
||||
RUN_TEST(test_one_word_quoted_string);
|
||||
RUN_TEST(test_one_word_empty_quoted);
|
||||
RUN_TEST(test_one_word_leading_spaces_skipped);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
BIN
tests/test_random
Executable file
BIN
tests/test_random
Executable file
Binary file not shown.
156
tests/test_random.c
Normal file
156
tests/test_random.c
Normal file
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* @file test_random.c
|
||||
* Unit tests for src/random.c and the random-number helpers in src/utils.c
|
||||
* (rand_number, dice).
|
||||
*/
|
||||
|
||||
#include "unity.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern FILE *logfile;
|
||||
|
||||
void setUp(void) { logfile = stderr; }
|
||||
void tearDown(void) { logfile = NULL; }
|
||||
|
||||
/* =========================================================
|
||||
* circle_srandom / circle_random — deterministic sequence
|
||||
*
|
||||
* The Park-Miller generator with seed s produces:
|
||||
* G(s) = (16807 * s) mod 2147483647
|
||||
* Precomputed for seed=1:
|
||||
* call 1 → 16807
|
||||
* call 2 → 282475249
|
||||
* call 3 → 1622136673
|
||||
* ========================================================= */
|
||||
|
||||
void test_circle_random_deterministic_first(void)
|
||||
{
|
||||
circle_srandom(1);
|
||||
TEST_ASSERT_EQUAL_UINT32(16807UL, circle_random());
|
||||
}
|
||||
|
||||
void test_circle_random_deterministic_second(void)
|
||||
{
|
||||
circle_srandom(1);
|
||||
circle_random(); /* discard first */
|
||||
TEST_ASSERT_EQUAL_UINT32(282475249UL, circle_random());
|
||||
}
|
||||
|
||||
void test_circle_random_deterministic_third(void)
|
||||
{
|
||||
circle_srandom(1);
|
||||
circle_random();
|
||||
circle_random();
|
||||
TEST_ASSERT_EQUAL_UINT32(1622650073UL, circle_random());
|
||||
}
|
||||
|
||||
void test_circle_random_same_seed_same_sequence(void)
|
||||
{
|
||||
circle_srandom(42);
|
||||
unsigned long a = circle_random();
|
||||
unsigned long b = circle_random();
|
||||
|
||||
circle_srandom(42);
|
||||
TEST_ASSERT_EQUAL_UINT32(a, circle_random());
|
||||
TEST_ASSERT_EQUAL_UINT32(b, circle_random());
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* rand_number — result always in [from, to]
|
||||
* ========================================================= */
|
||||
|
||||
void test_rand_number_in_range(void)
|
||||
{
|
||||
int i;
|
||||
circle_srandom(12345);
|
||||
for (i = 0; i < 200; i++) {
|
||||
int v = rand_number(1, 10);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_INT(1, v);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_INT(10, v);
|
||||
}
|
||||
}
|
||||
|
||||
void test_rand_number_same_low_high(void)
|
||||
{
|
||||
int i;
|
||||
circle_srandom(1);
|
||||
for (i = 0; i < 50; i++)
|
||||
TEST_ASSERT_EQUAL_INT(7, rand_number(7, 7));
|
||||
}
|
||||
|
||||
void test_rand_number_inverted_args(void)
|
||||
{
|
||||
/* rand_number logs SYSERR and swaps; result must still be in [1,10] */
|
||||
int i;
|
||||
circle_srandom(1);
|
||||
for (i = 0; i < 50; i++) {
|
||||
int v = rand_number(10, 1);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_INT(1, v);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_INT(10, v);
|
||||
}
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* dice — num dice each of size sides
|
||||
* ========================================================= */
|
||||
|
||||
void test_dice_zero_dice(void)
|
||||
{
|
||||
circle_srandom(1);
|
||||
TEST_ASSERT_EQUAL_INT(0, dice(0, 6));
|
||||
}
|
||||
|
||||
void test_dice_zero_sides(void)
|
||||
{
|
||||
circle_srandom(1);
|
||||
TEST_ASSERT_EQUAL_INT(0, dice(3, 0));
|
||||
}
|
||||
|
||||
void test_dice_result_in_range(void)
|
||||
{
|
||||
int i;
|
||||
circle_srandom(99);
|
||||
for (i = 0; i < 200; i++) {
|
||||
int v = dice(2, 6);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_INT(2, v);
|
||||
TEST_ASSERT_LESS_OR_EQUAL_INT(12, v);
|
||||
}
|
||||
}
|
||||
|
||||
void test_dice_one_die_one_side(void)
|
||||
{
|
||||
circle_srandom(1);
|
||||
TEST_ASSERT_EQUAL_INT(1, dice(1, 1));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* main
|
||||
* ========================================================= */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
/* circle_srandom / circle_random */
|
||||
RUN_TEST(test_circle_random_deterministic_first);
|
||||
RUN_TEST(test_circle_random_deterministic_second);
|
||||
RUN_TEST(test_circle_random_deterministic_third);
|
||||
RUN_TEST(test_circle_random_same_seed_same_sequence);
|
||||
|
||||
/* rand_number */
|
||||
RUN_TEST(test_rand_number_in_range);
|
||||
RUN_TEST(test_rand_number_same_low_high);
|
||||
RUN_TEST(test_rand_number_inverted_args);
|
||||
|
||||
/* dice */
|
||||
RUN_TEST(test_dice_zero_dice);
|
||||
RUN_TEST(test_dice_zero_sides);
|
||||
RUN_TEST(test_dice_result_in_range);
|
||||
RUN_TEST(test_dice_one_die_one_side);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
507
tests/test_stubs.c
Normal file
507
tests/test_stubs.c
Normal file
@@ -0,0 +1,507 @@
|
||||
/**
|
||||
* @file test_stubs.c
|
||||
* Stub definitions used by unit-test binaries.
|
||||
*
|
||||
* Every function here is declared __attribute__((weak)) so that a real
|
||||
* definition provided by a compiled source file (e.g. class.c providing
|
||||
* parse_class(), interpreter.c providing is_abbrev()) automatically wins
|
||||
* over the stub at link time.
|
||||
*
|
||||
* Global-variable stubs are plain definitions (zero-initialised by the
|
||||
* C standard for translation-unit scope). They satisfy the extern
|
||||
* declarations in mud headers without conflicting with any source file
|
||||
* that is deliberately excluded from the test build.
|
||||
*/
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
#include "utils.h"
|
||||
#include "comm.h"
|
||||
#include "db.h"
|
||||
#include "handler.h"
|
||||
#include "interpreter.h"
|
||||
#include "class.h"
|
||||
#include "dg_scripts.h"
|
||||
#include "protocol.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* =========================================================
|
||||
* Global variable stubs
|
||||
* ========================================================= */
|
||||
|
||||
/* comm.c */
|
||||
FILE *logfile = NULL; /* tests init to stderr in setUp */
|
||||
struct descriptor_data *descriptor_list = NULL;
|
||||
int no_specials = 0;
|
||||
int circle_restrict = 0;
|
||||
|
||||
/* db.c */
|
||||
struct room_data *world = NULL;
|
||||
room_rnum top_of_world = 0;
|
||||
struct weather_data weather_info; /* zero-init */
|
||||
struct char_data *character_list = NULL;
|
||||
struct index_data *mob_index = NULL;
|
||||
struct index_data *obj_index = NULL;
|
||||
mob_rnum top_of_mobt = 0;
|
||||
obj_rnum top_of_objt = 0;
|
||||
char *motd = NULL;
|
||||
char *imotd = NULL;
|
||||
char *GREETINGS = NULL;
|
||||
char *background = NULL;
|
||||
struct happyhour happy_data; /* zero-init */
|
||||
struct player_index_element *player_table = NULL;
|
||||
struct player_special_data dummy_mob; /* zero-init */
|
||||
struct config_data config_info; /* zero-init */
|
||||
time_t motdmod = 0;
|
||||
time_t newsmod = 0;
|
||||
|
||||
/* interpreter needs some start-room vnum stubs */
|
||||
ush_int r_mortal_start_room = 0;
|
||||
ush_int r_immort_start_room = 0;
|
||||
ush_int r_frozen_start_room = 0;
|
||||
|
||||
/* config.c */
|
||||
int selfdelete_fastwipe = 0;
|
||||
|
||||
/* constants.c – only needed when class.c is NOT in the build */
|
||||
__attribute__((weak)) const struct con_app_type con_app[26];
|
||||
__attribute__((weak)) const struct wis_app_type wis_app[26];
|
||||
|
||||
/* class.c – only needed when class.c is NOT in the build */
|
||||
__attribute__((weak)) const char *class_menu = "";
|
||||
__attribute__((weak)) const char *pc_class_types[] = { "\n" };
|
||||
|
||||
/* =========================================================
|
||||
* Function stubs (all weak so the real implementation wins)
|
||||
* ========================================================= */
|
||||
|
||||
/* ---------- comm.c ---------- */
|
||||
__attribute__((weak))
|
||||
size_t send_to_char(struct char_data *ch, const char *messg, ...)
|
||||
{ (void)ch; (void)messg; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
char *act(const char *str, int hide_invisible, struct char_data *ch,
|
||||
struct obj_data *obj, void *vict_obj, int type)
|
||||
{ (void)str; (void)hide_invisible; (void)ch;
|
||||
(void)obj; (void)vict_obj; (void)type; return NULL; }
|
||||
|
||||
__attribute__((weak))
|
||||
void write_to_q(const char *txt, struct txt_q *queue, int aliased)
|
||||
{ (void)txt; (void)queue; (void)aliased; }
|
||||
|
||||
__attribute__((weak))
|
||||
size_t write_to_output(struct descriptor_data *d, const char *txt, ...)
|
||||
{ (void)d; (void)txt; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
size_t vwrite_to_output(struct descriptor_data *d, const char *fmt, va_list args)
|
||||
{ (void)d; (void)fmt; (void)args; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
void echo_off(struct descriptor_data *d) { (void)d; }
|
||||
|
||||
__attribute__((weak))
|
||||
void echo_on(struct descriptor_data *d) { (void)d; }
|
||||
|
||||
/* ---------- modify.c ---------- */
|
||||
__attribute__((weak))
|
||||
void page_string(struct descriptor_data *d, char *str, int keep_internal)
|
||||
{ (void)d; (void)str; (void)keep_internal; }
|
||||
|
||||
__attribute__((weak))
|
||||
void parse_tab(char *str) { (void)str; }
|
||||
|
||||
/* ---------- handler.c ---------- */
|
||||
__attribute__((weak))
|
||||
bool affected_by_spell(struct char_data *ch, int spell)
|
||||
{ (void)ch; (void)spell; return FALSE; }
|
||||
|
||||
__attribute__((weak))
|
||||
void affect_from_char(struct char_data *ch, int type)
|
||||
{ (void)ch; (void)type; }
|
||||
|
||||
__attribute__((weak))
|
||||
void extract_char(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void extract_char_final(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void char_from_room(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void char_to_room(struct char_data *ch, room_rnum room)
|
||||
{ (void)ch; (void)room; }
|
||||
|
||||
__attribute__((weak))
|
||||
void free_char(struct char_data *ch) { (void)ch; }
|
||||
|
||||
/* ---------- interpreter.c ---------- */
|
||||
__attribute__((weak))
|
||||
int is_abbrev(const char *arg1, const char *arg2)
|
||||
{ (void)arg1; (void)arg2; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
int parse_class(char arg)
|
||||
{ (void)arg; return CLASS_UNDEFINED; }
|
||||
|
||||
/* ---------- class.c ---------- */
|
||||
__attribute__((weak))
|
||||
void set_title(struct char_data *ch, char *title) { (void)ch; (void)title; }
|
||||
|
||||
__attribute__((weak))
|
||||
void spell_level(int spell, int chclass, int level)
|
||||
{ (void)spell; (void)chclass; (void)level; }
|
||||
|
||||
/* ---------- players.c ---------- */
|
||||
__attribute__((weak))
|
||||
void save_char(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
int create_entry(char *name) { (void)name; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
int load_char(const char *name, struct char_data *ch)
|
||||
{ (void)name; (void)ch; return -1; }
|
||||
|
||||
__attribute__((weak))
|
||||
void save_player_index(void) {}
|
||||
|
||||
__attribute__((weak))
|
||||
void remove_player(int pfilepos) { (void)pfilepos; }
|
||||
|
||||
__attribute__((weak))
|
||||
long get_ptable_by_name(const char *name) { (void)name; return -1; }
|
||||
|
||||
/* ---------- act.wizard.c ---------- */
|
||||
__attribute__((weak))
|
||||
void snoop_check(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void add_llog_entry(struct char_data *ch, int type) { (void)ch; (void)type; }
|
||||
|
||||
/* ---------- db.c ---------- */
|
||||
__attribute__((weak))
|
||||
room_rnum real_room(room_vnum vnum) { (void)vnum; return NOWHERE; }
|
||||
|
||||
__attribute__((weak))
|
||||
void clear_char(struct char_data *ch) { (void)ch; if (ch) memset(ch, 0, sizeof(*ch)); }
|
||||
|
||||
__attribute__((weak))
|
||||
void reset_char(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void init_char(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void new_mobile_data(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void free_char_from_db(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
void Crash_crashsave(struct char_data *ch) { (void)ch; }
|
||||
|
||||
__attribute__((weak))
|
||||
int Crash_load(struct char_data *ch) { (void)ch; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
int Crash_delete_file(char *name) { (void)name; return 0; }
|
||||
|
||||
/* ---------- ban.c ---------- */
|
||||
__attribute__((weak))
|
||||
int isbanned(char *hostname) { (void)hostname; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
int valid_name(char *newname) { (void)newname; return 1; }
|
||||
|
||||
/* ---------- mail.c ---------- */
|
||||
__attribute__((weak))
|
||||
int has_mail(long recipient) { (void)recipient; return 0; }
|
||||
|
||||
/* ---------- improved-edit.c ---------- */
|
||||
__attribute__((weak))
|
||||
void send_editor_help(struct descriptor_data *d) { (void)d; }
|
||||
|
||||
/* ---------- dg_scripts.c ---------- */
|
||||
__attribute__((weak))
|
||||
void add_to_lookup_table(long uid, void *c) { (void)uid; (void)c; }
|
||||
|
||||
__attribute__((weak))
|
||||
void delete_variables(const char *charname) { (void)charname; }
|
||||
|
||||
__attribute__((weak))
|
||||
void read_saved_vars(struct char_data *ch) { (void)ch; }
|
||||
|
||||
/* ---------- dg_triggers.c ---------- */
|
||||
__attribute__((weak))
|
||||
int greet_mtrigger(struct char_data *actor, int dir)
|
||||
{ (void)actor; (void)dir; return 1; }
|
||||
|
||||
__attribute__((weak))
|
||||
void greet_memory_mtrigger(struct char_data *actor) { (void)actor; }
|
||||
|
||||
__attribute__((weak))
|
||||
int login_wtrigger(struct room_data *room, struct char_data *actor)
|
||||
{ (void)room; (void)actor; return 1; }
|
||||
|
||||
__attribute__((weak))
|
||||
int command_mtrigger(struct char_data *actor, char *cmd, char *argument)
|
||||
{ (void)actor; (void)cmd; (void)argument; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
int command_otrigger(struct char_data *actor, char *cmd, char *argument)
|
||||
{ (void)actor; (void)cmd; (void)argument; return 0; }
|
||||
|
||||
__attribute__((weak))
|
||||
int command_wtrigger(struct char_data *actor, char *cmd, char *argument)
|
||||
{ (void)actor; (void)cmd; (void)argument; return 0; }
|
||||
|
||||
/* ---------- act.informative.c ---------- */
|
||||
__attribute__((weak))
|
||||
void look_at_room(struct char_data *ch, int ignore_brief)
|
||||
{ (void)ch; (void)ignore_brief; }
|
||||
|
||||
/* ---------- protocol.c ---------- */
|
||||
__attribute__((weak))
|
||||
void MXPSendTag(descriptor_t *apDescriptor, const char *apTag)
|
||||
{ (void)apDescriptor; (void)apTag; }
|
||||
|
||||
__attribute__((weak))
|
||||
void AddRecentPlayer(char *charname, char *host, bool newplr, bool cpover)
|
||||
{ (void)charname; (void)host; (void)newplr; (void)cpover; }
|
||||
|
||||
/* ---------- OLC parse functions ---------- */
|
||||
__attribute__((weak))
|
||||
void aedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void cedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void hedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void ibtedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void medit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void msgedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void oedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void prefedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void qedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void redit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void sedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void trigedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
__attribute__((weak))
|
||||
void zedit_parse(struct descriptor_data *d, char *arg) { (void)d; (void)arg; }
|
||||
|
||||
/* ---------- ACMD stubs for all do_* functions ----------
|
||||
* These are function-pointer entries in the cmd_info[] table in interpreter.c.
|
||||
* The table is DATA (not called at test time), but the linker still requires
|
||||
* every symbol to resolve. Weak stubs satisfy the linker; the real do_*
|
||||
* implementations would override them if act*.c were compiled. */
|
||||
|
||||
#define STUB_ACMD(name) \
|
||||
__attribute__((weak)) ACMD(name) { (void)ch; (void)argument; (void)cmd; (void)subcmd; }
|
||||
|
||||
STUB_ACMD(do_action)
|
||||
STUB_ACMD(do_advance)
|
||||
STUB_ACMD(do_areas)
|
||||
STUB_ACMD(do_assist)
|
||||
STUB_ACMD(do_astat)
|
||||
STUB_ACMD(do_at)
|
||||
STUB_ACMD(do_attach)
|
||||
STUB_ACMD(do_backstab)
|
||||
STUB_ACMD(do_ban)
|
||||
STUB_ACMD(do_bandage)
|
||||
STUB_ACMD(do_bash)
|
||||
STUB_ACMD(do_cast)
|
||||
STUB_ACMD(do_changelog)
|
||||
STUB_ACMD(do_checkloadstatus)
|
||||
STUB_ACMD(do_commands)
|
||||
STUB_ACMD(do_consider)
|
||||
STUB_ACMD(do_copyover)
|
||||
STUB_ACMD(do_date)
|
||||
STUB_ACMD(do_dc)
|
||||
STUB_ACMD(do_detach)
|
||||
STUB_ACMD(do_diagnose)
|
||||
STUB_ACMD(do_dig)
|
||||
STUB_ACMD(do_display)
|
||||
STUB_ACMD(do_drink)
|
||||
STUB_ACMD(do_drop)
|
||||
STUB_ACMD(do_eat)
|
||||
STUB_ACMD(do_echo)
|
||||
STUB_ACMD(do_enter)
|
||||
STUB_ACMD(do_equipment)
|
||||
STUB_ACMD(do_examine)
|
||||
STUB_ACMD(do_exits)
|
||||
STUB_ACMD(do_export_zone)
|
||||
STUB_ACMD(do_file)
|
||||
STUB_ACMD(do_flee)
|
||||
STUB_ACMD(do_follow)
|
||||
STUB_ACMD(do_force)
|
||||
STUB_ACMD(do_gecho)
|
||||
STUB_ACMD(do_gen_comm)
|
||||
STUB_ACMD(do_gen_door)
|
||||
STUB_ACMD(do_gen_ps)
|
||||
STUB_ACMD(do_gen_tog)
|
||||
STUB_ACMD(do_get)
|
||||
STUB_ACMD(do_give)
|
||||
STUB_ACMD(do_gold)
|
||||
STUB_ACMD(do_goto)
|
||||
STUB_ACMD(do_grab)
|
||||
STUB_ACMD(do_group)
|
||||
STUB_ACMD(do_gsay)
|
||||
STUB_ACMD(do_happyhour)
|
||||
STUB_ACMD(do_hcontrol)
|
||||
STUB_ACMD(do_help)
|
||||
STUB_ACMD(do_helpcheck)
|
||||
STUB_ACMD(do_hide)
|
||||
STUB_ACMD(do_hindex)
|
||||
STUB_ACMD(do_history)
|
||||
STUB_ACMD(do_hit)
|
||||
STUB_ACMD(do_house)
|
||||
STUB_ACMD(do_ibt)
|
||||
STUB_ACMD(do_inventory)
|
||||
STUB_ACMD(do_invis)
|
||||
STUB_ACMD(do_kick)
|
||||
STUB_ACMD(do_kill)
|
||||
STUB_ACMD(do_last)
|
||||
STUB_ACMD(do_leave)
|
||||
STUB_ACMD(do_levels)
|
||||
STUB_ACMD(do_links)
|
||||
STUB_ACMD(do_load)
|
||||
STUB_ACMD(do_look)
|
||||
STUB_ACMD(do_map)
|
||||
STUB_ACMD(do_masound)
|
||||
STUB_ACMD(do_mat)
|
||||
STUB_ACMD(do_mdamage)
|
||||
STUB_ACMD(do_mdoor)
|
||||
STUB_ACMD(do_mecho)
|
||||
STUB_ACMD(do_mechoaround)
|
||||
STUB_ACMD(do_mfollow)
|
||||
STUB_ACMD(do_mforce)
|
||||
STUB_ACMD(do_mforget)
|
||||
STUB_ACMD(do_mgoto)
|
||||
STUB_ACMD(do_mhunt)
|
||||
STUB_ACMD(do_mjunk)
|
||||
STUB_ACMD(do_mkill)
|
||||
STUB_ACMD(do_mload)
|
||||
STUB_ACMD(do_mlog)
|
||||
STUB_ACMD(do_move)
|
||||
STUB_ACMD(do_mpurge)
|
||||
STUB_ACMD(do_mrecho)
|
||||
STUB_ACMD(do_mremember)
|
||||
STUB_ACMD(do_msend)
|
||||
STUB_ACMD(do_msgedit)
|
||||
STUB_ACMD(do_mteleport)
|
||||
STUB_ACMD(do_mtransform)
|
||||
STUB_ACMD(do_mzoneecho)
|
||||
STUB_ACMD(do_not_here)
|
||||
STUB_ACMD(do_oasis_aedit)
|
||||
STUB_ACMD(do_oasis_cedit)
|
||||
STUB_ACMD(do_oasis_copy)
|
||||
STUB_ACMD(do_oasis_hedit)
|
||||
STUB_ACMD(do_oasis_list)
|
||||
STUB_ACMD(do_oasis_medit)
|
||||
STUB_ACMD(do_oasis_oedit)
|
||||
STUB_ACMD(do_oasis_prefedit)
|
||||
STUB_ACMD(do_oasis_qedit)
|
||||
STUB_ACMD(do_oasis_redit)
|
||||
STUB_ACMD(do_oasis_sedit)
|
||||
STUB_ACMD(do_oasis_trigedit)
|
||||
STUB_ACMD(do_oasis_zedit)
|
||||
STUB_ACMD(do_order)
|
||||
STUB_ACMD(do_oset)
|
||||
STUB_ACMD(do_page)
|
||||
STUB_ACMD(do_peace)
|
||||
STUB_ACMD(do_plist)
|
||||
STUB_ACMD(do_pour)
|
||||
STUB_ACMD(do_practice)
|
||||
STUB_ACMD(do_purge)
|
||||
STUB_ACMD(do_put)
|
||||
STUB_ACMD(do_qcomm)
|
||||
STUB_ACMD(do_quest)
|
||||
STUB_ACMD(do_quit)
|
||||
STUB_ACMD(do_reboot)
|
||||
STUB_ACMD(do_recent)
|
||||
STUB_ACMD(do_remove)
|
||||
STUB_ACMD(do_reply)
|
||||
STUB_ACMD(do_report)
|
||||
STUB_ACMD(do_rescue)
|
||||
STUB_ACMD(do_rest)
|
||||
STUB_ACMD(do_restore)
|
||||
STUB_ACMD(do_return)
|
||||
STUB_ACMD(do_sac)
|
||||
STUB_ACMD(do_save)
|
||||
STUB_ACMD(do_saveall)
|
||||
STUB_ACMD(do_say)
|
||||
STUB_ACMD(do_scan)
|
||||
STUB_ACMD(do_score)
|
||||
STUB_ACMD(do_send)
|
||||
STUB_ACMD(do_set)
|
||||
STUB_ACMD(do_show)
|
||||
STUB_ACMD(do_show_save_list)
|
||||
STUB_ACMD(do_shutdown)
|
||||
STUB_ACMD(do_sit)
|
||||
STUB_ACMD(do_skillset)
|
||||
STUB_ACMD(do_sleep)
|
||||
STUB_ACMD(do_sneak)
|
||||
STUB_ACMD(do_snoop)
|
||||
STUB_ACMD(do_spec_comm)
|
||||
STUB_ACMD(do_split)
|
||||
STUB_ACMD(do_stand)
|
||||
/* do_start has a different prototype than ACMD — it's called directly */
|
||||
__attribute__((weak))
|
||||
void do_start(struct char_data *ch) { (void)ch; }
|
||||
|
||||
STUB_ACMD(do_stat)
|
||||
STUB_ACMD(do_steal)
|
||||
STUB_ACMD(do_switch)
|
||||
STUB_ACMD(do_tedit)
|
||||
STUB_ACMD(do_teleport)
|
||||
STUB_ACMD(do_tell)
|
||||
STUB_ACMD(do_time)
|
||||
STUB_ACMD(do_title)
|
||||
STUB_ACMD(do_toggle)
|
||||
STUB_ACMD(do_track)
|
||||
STUB_ACMD(do_trans)
|
||||
STUB_ACMD(do_tstat)
|
||||
STUB_ACMD(do_unban)
|
||||
STUB_ACMD(do_unfollow)
|
||||
STUB_ACMD(do_use)
|
||||
STUB_ACMD(do_users)
|
||||
STUB_ACMD(do_vdelete)
|
||||
STUB_ACMD(do_visible)
|
||||
STUB_ACMD(do_vnum)
|
||||
STUB_ACMD(do_vstat)
|
||||
STUB_ACMD(do_wake)
|
||||
STUB_ACMD(do_wear)
|
||||
STUB_ACMD(do_weather)
|
||||
STUB_ACMD(do_where)
|
||||
STUB_ACMD(do_whirlwind)
|
||||
STUB_ACMD(do_who)
|
||||
STUB_ACMD(do_whois)
|
||||
STUB_ACMD(do_wield)
|
||||
STUB_ACMD(do_wizhelp)
|
||||
STUB_ACMD(do_wizlock)
|
||||
STUB_ACMD(do_wiznet)
|
||||
STUB_ACMD(do_wizupdate)
|
||||
STUB_ACMD(do_wizutil)
|
||||
STUB_ACMD(do_write)
|
||||
STUB_ACMD(do_zcheck)
|
||||
STUB_ACMD(do_zlock)
|
||||
STUB_ACMD(do_zpurge)
|
||||
STUB_ACMD(do_zreset)
|
||||
STUB_ACMD(do_zunlock)
|
||||
|
||||
#undef STUB_ACMD
|
||||
BIN
tests/test_utils
Executable file
BIN
tests/test_utils
Executable file
Binary file not shown.
482
tests/test_utils.c
Normal file
482
tests/test_utils.c
Normal file
@@ -0,0 +1,482 @@
|
||||
/**
|
||||
* @file test_utils.c
|
||||
* Unit tests for pure / near-pure functions in src/utils.c
|
||||
*/
|
||||
|
||||
#include "unity.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
#include "utils.h"
|
||||
|
||||
/* Redirect mud log output so basic_mud_vlog() doesn't print the
|
||||
* "SYSERR: Using log() before stream was initialized!" warning. */
|
||||
extern FILE *logfile;
|
||||
|
||||
void setUp(void) { logfile = stderr; }
|
||||
void tearDown(void) { logfile = NULL; }
|
||||
|
||||
/* =========================================================
|
||||
* prune_crlf
|
||||
* ========================================================= */
|
||||
|
||||
void test_prune_crlf_strips_crlf(void)
|
||||
{
|
||||
char s[] = "hello\r\n";
|
||||
prune_crlf(s);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", s);
|
||||
}
|
||||
|
||||
void test_prune_crlf_strips_lf_only(void)
|
||||
{
|
||||
char s[] = "hello\n";
|
||||
prune_crlf(s);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", s);
|
||||
}
|
||||
|
||||
void test_prune_crlf_no_op_on_clean(void)
|
||||
{
|
||||
char s[] = "hello";
|
||||
prune_crlf(s);
|
||||
TEST_ASSERT_EQUAL_STRING("hello", s);
|
||||
}
|
||||
|
||||
void test_prune_crlf_multiple_trailing(void)
|
||||
{
|
||||
char s[] = "hi\r\n\r\n";
|
||||
prune_crlf(s);
|
||||
TEST_ASSERT_EQUAL_STRING("hi", s);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* str_cmp (may be an alias for strcasecmp on this platform)
|
||||
* ========================================================= */
|
||||
|
||||
void test_str_cmp_equal_strings(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, str_cmp("hello", "hello"));
|
||||
}
|
||||
|
||||
void test_str_cmp_case_insensitive(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, str_cmp("Hello", "hello"));
|
||||
TEST_ASSERT_EQUAL_INT(0, str_cmp("HELLO", "hello"));
|
||||
}
|
||||
|
||||
void test_str_cmp_ordering_less(void)
|
||||
{
|
||||
TEST_ASSERT_LESS_THAN(0, str_cmp("a", "b"));
|
||||
}
|
||||
|
||||
void test_str_cmp_ordering_greater(void)
|
||||
{
|
||||
TEST_ASSERT_GREATER_THAN(0, str_cmp("b", "a"));
|
||||
}
|
||||
|
||||
void test_str_cmp_empty_equal(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, str_cmp("", ""));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* strn_cmp (may be an alias for strncasecmp on this platform)
|
||||
* ========================================================= */
|
||||
|
||||
void test_strn_cmp_equal_prefix(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, strn_cmp("hello", "hello world", 5));
|
||||
}
|
||||
|
||||
void test_strn_cmp_differ_past_n(void)
|
||||
{
|
||||
/* First 5 chars same, so strn_cmp("hello!", "hellox", 5) == 0 */
|
||||
TEST_ASSERT_EQUAL_INT(0, strn_cmp("hello!", "hellox", 5));
|
||||
}
|
||||
|
||||
void test_strn_cmp_differ_within_n(void)
|
||||
{
|
||||
TEST_ASSERT_NOT_EQUAL(0, strn_cmp("abc", "xyz", 3));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* sprintbit
|
||||
* ========================================================= */
|
||||
|
||||
void test_sprintbit_no_bits_set(void)
|
||||
{
|
||||
static const char *names[] = { "FLAG_A", "FLAG_B", "\n" };
|
||||
char result[256];
|
||||
sprintbit(0, names, result, sizeof(result));
|
||||
TEST_ASSERT_EQUAL_STRING("NOBITS ", result);
|
||||
}
|
||||
|
||||
void test_sprintbit_single_bit(void)
|
||||
{
|
||||
static const char *names[] = { "FLAG_A", "FLAG_B", "\n" };
|
||||
char result[256];
|
||||
sprintbit(1, names, result, sizeof(result));
|
||||
TEST_ASSERT_EQUAL_STRING("FLAG_A ", result);
|
||||
}
|
||||
|
||||
void test_sprintbit_multiple_bits(void)
|
||||
{
|
||||
static const char *names[] = { "FLAG_A", "FLAG_B", "\n" };
|
||||
char result[256];
|
||||
sprintbit(3, names, result, sizeof(result));
|
||||
TEST_ASSERT_EQUAL_STRING("FLAG_A FLAG_B ", result);
|
||||
}
|
||||
|
||||
void test_sprintbit_undefined_bit(void)
|
||||
{
|
||||
/* Bit 2 is beyond the named array – should produce "UNDEFINED" */
|
||||
static const char *names[] = { "FLAG_A", "FLAG_B", "\n" };
|
||||
char result[256];
|
||||
sprintbit(4, names, result, sizeof(result));
|
||||
TEST_ASSERT_EQUAL_STRING("UNDEFINED ", result);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* sprinttype
|
||||
* ========================================================= */
|
||||
|
||||
void test_sprinttype_valid_index_zero(void)
|
||||
{
|
||||
static const char *names[] = { "ZERO", "ONE", "\n" };
|
||||
char result[64];
|
||||
sprinttype(0, names, result, sizeof(result));
|
||||
TEST_ASSERT_EQUAL_STRING("ZERO", result);
|
||||
}
|
||||
|
||||
void test_sprinttype_valid_index_one(void)
|
||||
{
|
||||
static const char *names[] = { "ZERO", "ONE", "\n" };
|
||||
char result[64];
|
||||
sprinttype(1, names, result, sizeof(result));
|
||||
TEST_ASSERT_EQUAL_STRING("ONE", result);
|
||||
}
|
||||
|
||||
void test_sprinttype_out_of_range(void)
|
||||
{
|
||||
static const char *names[] = { "ZERO", "ONE", "\n" };
|
||||
char result[64];
|
||||
sprinttype(5, names, result, sizeof(result));
|
||||
TEST_ASSERT_EQUAL_STRING("UNDEFINED", result);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* levenshtein_distance
|
||||
* ========================================================= */
|
||||
|
||||
void test_levenshtein_identical_strings(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, levenshtein_distance("hello", "hello"));
|
||||
}
|
||||
|
||||
void test_levenshtein_empty_and_nonempty(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(5, levenshtein_distance("", "hello"));
|
||||
TEST_ASSERT_EQUAL_INT(5, levenshtein_distance("hello", ""));
|
||||
}
|
||||
|
||||
void test_levenshtein_single_insertion(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(1, levenshtein_distance("abc", "abcd"));
|
||||
}
|
||||
|
||||
void test_levenshtein_single_deletion(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(1, levenshtein_distance("abcd", "abc"));
|
||||
}
|
||||
|
||||
void test_levenshtein_single_substitution(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(1, levenshtein_distance("abc", "axc"));
|
||||
}
|
||||
|
||||
void test_levenshtein_both_empty(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, levenshtein_distance("", ""));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* count_color_chars
|
||||
* ========================================================= */
|
||||
|
||||
void test_count_color_chars_no_codes(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, count_color_chars("hello"));
|
||||
}
|
||||
|
||||
void test_count_color_chars_empty(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, count_color_chars(""));
|
||||
}
|
||||
|
||||
void test_count_color_chars_single_color_code(void)
|
||||
{
|
||||
/* "\tR" is a two-char color escape; both are skipped (counted as overhead) */
|
||||
TEST_ASSERT_EQUAL_INT(2, count_color_chars("\tR"));
|
||||
}
|
||||
|
||||
void test_count_color_chars_double_tab(void)
|
||||
{
|
||||
/* "\t\t" is an escaped literal tab; costs 1 overhead char */
|
||||
TEST_ASSERT_EQUAL_INT(1, count_color_chars("\t\t"));
|
||||
}
|
||||
|
||||
void test_count_color_chars_mixed(void)
|
||||
{
|
||||
/* "\tRhello" → 2 overhead + 0 for "hello" */
|
||||
TEST_ASSERT_EQUAL_INT(2, count_color_chars("\tRhello"));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* count_non_protocol_chars
|
||||
* ========================================================= */
|
||||
|
||||
void test_count_non_protocol_chars_plain(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(5, count_non_protocol_chars("hello"));
|
||||
}
|
||||
|
||||
void test_count_non_protocol_chars_empty(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, count_non_protocol_chars(""));
|
||||
}
|
||||
|
||||
void test_count_non_protocol_chars_newlines_skipped(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(5, count_non_protocol_chars("\r\nhello"));
|
||||
}
|
||||
|
||||
void test_count_non_protocol_chars_bracket_tag(void)
|
||||
{
|
||||
/* "@[bold]hi" – "@[bold]" is a protocol tag; only "hi" counted */
|
||||
TEST_ASSERT_EQUAL_INT(2, count_non_protocol_chars("@[bold]hi"));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* atoidx
|
||||
* ========================================================= */
|
||||
|
||||
void test_atoidx_valid_number(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(42, (int)atoidx("42"));
|
||||
}
|
||||
|
||||
void test_atoidx_zero(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, (int)atoidx("0"));
|
||||
}
|
||||
|
||||
void test_atoidx_negative_returns_nowhere(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT((int)NOWHERE, (int)atoidx("-1"));
|
||||
}
|
||||
|
||||
void test_atoidx_overflow_returns_nowhere(void)
|
||||
{
|
||||
/* IDXTYPE_MAX is 65535 on this build; a larger value overflows */
|
||||
TEST_ASSERT_EQUAL_INT((int)NOWHERE, (int)atoidx("99999999"));
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* right_trim_whitespace
|
||||
* ========================================================= */
|
||||
|
||||
void test_right_trim_whitespace_trailing_spaces(void)
|
||||
{
|
||||
char *r = right_trim_whitespace("hello ");
|
||||
TEST_ASSERT_EQUAL_STRING("hello", r);
|
||||
free(r);
|
||||
}
|
||||
|
||||
void test_right_trim_whitespace_no_trailing(void)
|
||||
{
|
||||
char *r = right_trim_whitespace("hello");
|
||||
TEST_ASSERT_EQUAL_STRING("hello", r);
|
||||
free(r);
|
||||
}
|
||||
|
||||
void test_right_trim_whitespace_all_whitespace(void)
|
||||
{
|
||||
char *r = right_trim_whitespace(" ");
|
||||
TEST_ASSERT_EQUAL_STRING("", r);
|
||||
free(r);
|
||||
}
|
||||
|
||||
void test_right_trim_whitespace_empty(void)
|
||||
{
|
||||
char *r = right_trim_whitespace("");
|
||||
TEST_ASSERT_EQUAL_STRING("", r);
|
||||
free(r);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* remove_from_string
|
||||
* ========================================================= */
|
||||
|
||||
void test_remove_from_string_word_present(void)
|
||||
{
|
||||
char s[] = "hello world";
|
||||
remove_from_string(s, "world");
|
||||
/* "world" and the trailing NUL shift left; "hello " remains */
|
||||
TEST_ASSERT_EQUAL_STRING("hello ", s);
|
||||
}
|
||||
|
||||
void test_remove_from_string_word_absent(void)
|
||||
{
|
||||
char s[] = "hello world";
|
||||
remove_from_string(s, "nope");
|
||||
TEST_ASSERT_EQUAL_STRING("hello world", s);
|
||||
}
|
||||
|
||||
void test_remove_from_string_word_at_start(void)
|
||||
{
|
||||
char s[] = "hello world";
|
||||
remove_from_string(s, "hello");
|
||||
/* "hello" removed; " world" remains */
|
||||
TEST_ASSERT_EQUAL_STRING(" world", s);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* real_time_passed
|
||||
* ========================================================= */
|
||||
|
||||
void test_real_time_passed_hours(void)
|
||||
{
|
||||
time_t base = 1000000;
|
||||
struct time_info_data *t = real_time_passed(base + 3 * SECS_PER_REAL_HOUR, base);
|
||||
TEST_ASSERT_EQUAL_INT(3, t->hours);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->day);
|
||||
}
|
||||
|
||||
void test_real_time_passed_days(void)
|
||||
{
|
||||
time_t base = 1000000;
|
||||
struct time_info_data *t = real_time_passed(base + 2 * SECS_PER_REAL_DAY + SECS_PER_REAL_HOUR, base);
|
||||
TEST_ASSERT_EQUAL_INT(1, t->hours);
|
||||
TEST_ASSERT_EQUAL_INT(2, t->day);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* mud_time_passed
|
||||
* ========================================================= */
|
||||
|
||||
void test_mud_time_passed_hours(void)
|
||||
{
|
||||
time_t base = 1000000;
|
||||
struct time_info_data *t = mud_time_passed(base + 2 * SECS_PER_MUD_HOUR, base);
|
||||
TEST_ASSERT_EQUAL_INT(2, t->hours);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->day);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->month);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->year);
|
||||
}
|
||||
|
||||
void test_mud_time_passed_days(void)
|
||||
{
|
||||
time_t base = 1000000;
|
||||
struct time_info_data *t = mud_time_passed(base + SECS_PER_MUD_DAY, base);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->hours);
|
||||
TEST_ASSERT_EQUAL_INT(1, t->day);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->month);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->year);
|
||||
}
|
||||
|
||||
void test_mud_time_passed_months(void)
|
||||
{
|
||||
time_t base = 1000000;
|
||||
struct time_info_data *t = mud_time_passed(base + SECS_PER_MUD_MONTH, base);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->hours);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->day);
|
||||
TEST_ASSERT_EQUAL_INT(1, t->month);
|
||||
TEST_ASSERT_EQUAL_INT(0, t->year);
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
* main
|
||||
* ========================================================= */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
/* prune_crlf */
|
||||
RUN_TEST(test_prune_crlf_strips_crlf);
|
||||
RUN_TEST(test_prune_crlf_strips_lf_only);
|
||||
RUN_TEST(test_prune_crlf_no_op_on_clean);
|
||||
RUN_TEST(test_prune_crlf_multiple_trailing);
|
||||
|
||||
/* str_cmp */
|
||||
RUN_TEST(test_str_cmp_equal_strings);
|
||||
RUN_TEST(test_str_cmp_case_insensitive);
|
||||
RUN_TEST(test_str_cmp_ordering_less);
|
||||
RUN_TEST(test_str_cmp_ordering_greater);
|
||||
RUN_TEST(test_str_cmp_empty_equal);
|
||||
|
||||
/* strn_cmp */
|
||||
RUN_TEST(test_strn_cmp_equal_prefix);
|
||||
RUN_TEST(test_strn_cmp_differ_past_n);
|
||||
RUN_TEST(test_strn_cmp_differ_within_n);
|
||||
|
||||
/* sprintbit */
|
||||
RUN_TEST(test_sprintbit_no_bits_set);
|
||||
RUN_TEST(test_sprintbit_single_bit);
|
||||
RUN_TEST(test_sprintbit_multiple_bits);
|
||||
RUN_TEST(test_sprintbit_undefined_bit);
|
||||
|
||||
/* sprinttype */
|
||||
RUN_TEST(test_sprinttype_valid_index_zero);
|
||||
RUN_TEST(test_sprinttype_valid_index_one);
|
||||
RUN_TEST(test_sprinttype_out_of_range);
|
||||
|
||||
/* levenshtein_distance */
|
||||
RUN_TEST(test_levenshtein_identical_strings);
|
||||
RUN_TEST(test_levenshtein_empty_and_nonempty);
|
||||
RUN_TEST(test_levenshtein_single_insertion);
|
||||
RUN_TEST(test_levenshtein_single_deletion);
|
||||
RUN_TEST(test_levenshtein_single_substitution);
|
||||
RUN_TEST(test_levenshtein_both_empty);
|
||||
|
||||
/* count_color_chars */
|
||||
RUN_TEST(test_count_color_chars_no_codes);
|
||||
RUN_TEST(test_count_color_chars_empty);
|
||||
RUN_TEST(test_count_color_chars_single_color_code);
|
||||
RUN_TEST(test_count_color_chars_double_tab);
|
||||
RUN_TEST(test_count_color_chars_mixed);
|
||||
|
||||
/* count_non_protocol_chars */
|
||||
RUN_TEST(test_count_non_protocol_chars_plain);
|
||||
RUN_TEST(test_count_non_protocol_chars_empty);
|
||||
RUN_TEST(test_count_non_protocol_chars_newlines_skipped);
|
||||
RUN_TEST(test_count_non_protocol_chars_bracket_tag);
|
||||
|
||||
/* atoidx */
|
||||
RUN_TEST(test_atoidx_valid_number);
|
||||
RUN_TEST(test_atoidx_zero);
|
||||
RUN_TEST(test_atoidx_negative_returns_nowhere);
|
||||
RUN_TEST(test_atoidx_overflow_returns_nowhere);
|
||||
|
||||
/* right_trim_whitespace */
|
||||
RUN_TEST(test_right_trim_whitespace_trailing_spaces);
|
||||
RUN_TEST(test_right_trim_whitespace_no_trailing);
|
||||
RUN_TEST(test_right_trim_whitespace_all_whitespace);
|
||||
RUN_TEST(test_right_trim_whitespace_empty);
|
||||
|
||||
/* remove_from_string */
|
||||
RUN_TEST(test_remove_from_string_word_present);
|
||||
RUN_TEST(test_remove_from_string_word_absent);
|
||||
RUN_TEST(test_remove_from_string_word_at_start);
|
||||
|
||||
/* real_time_passed */
|
||||
RUN_TEST(test_real_time_passed_hours);
|
||||
RUN_TEST(test_real_time_passed_days);
|
||||
|
||||
/* mud_time_passed */
|
||||
RUN_TEST(test_mud_time_passed_hours);
|
||||
RUN_TEST(test_mud_time_passed_days);
|
||||
RUN_TEST(test_mud_time_passed_months);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
2637
tests/vendor/unity/unity.c
vendored
Normal file
2637
tests/vendor/unity/unity.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
698
tests/vendor/unity/unity.h
vendored
Normal file
698
tests/vendor/unity/unity.h
vendored
Normal file
@@ -0,0 +1,698 @@
|
||||
/* =========================================================================
|
||||
Unity - A Test Framework for C
|
||||
ThrowTheSwitch.org
|
||||
Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
||||
SPDX-License-Identifier: MIT
|
||||
========================================================================= */
|
||||
|
||||
#ifndef UNITY_FRAMEWORK_H
|
||||
#define UNITY_FRAMEWORK_H
|
||||
#define UNITY
|
||||
|
||||
#define UNITY_VERSION_MAJOR 2
|
||||
#define UNITY_VERSION_MINOR 6
|
||||
#define UNITY_VERSION_BUILD 3
|
||||
#define UNITY_VERSION ((UNITY_VERSION_MAJOR << 16) | (UNITY_VERSION_MINOR << 8) | UNITY_VERSION_BUILD)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "unity_internals.h"
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Test Setup / Teardown
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
/* These functions are intended to be called before and after each test.
|
||||
* If using unity directly, these will need to be provided for each test
|
||||
* executable built. If you are using the test runner generator and/or
|
||||
* Ceedling, these are optional. */
|
||||
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(). If using
|
||||
* Unity directly, you're in charge of calling these if they are desired.
|
||||
* If using Ceedling or the test runner generator, these will be called
|
||||
* automatically if they exist. */
|
||||
void suiteSetUp(void);
|
||||
int suiteTearDown(int num_failures);
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Test Reset and Verify
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
/* These functions are intended to be called before or during tests in order
|
||||
* to support complex test loops, etc. Both are NOT built into Unity. Instead
|
||||
* the test runner generator will create them. resetTest will run teardown and
|
||||
* setup again, verifying any end-of-test needs between. verifyTest will only
|
||||
* run the verification. */
|
||||
void resetTest(void);
|
||||
void verifyTest(void);
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* 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(...), TEST_RANGE(...) and/or TEST_MATRIX(...) 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_MESSAGE(message) UnityMessage((message), __LINE__)
|
||||
#define TEST_ONLY()
|
||||
#ifdef UNITY_INCLUDE_PRINT_FORMATTED
|
||||
#define TEST_PRINTF(message, ...) UnityPrintF(__LINE__, (message), ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/* 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()
|
||||
#define TEST_PASS_MESSAGE(message) do { UnityMessage((message), __LINE__); TEST_ABORT(); } while (0)
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Build Directives
|
||||
*-------------------------------------------------------
|
||||
|
||||
* These macros do nothing, but they are useful for additional build context.
|
||||
* Tools (like Ceedling) can scan for these directives and make use of them for
|
||||
* per-test-executable #include search paths and linking. */
|
||||
|
||||
/* Add source files to a test executable's compilation and linking. Ex: TEST_SOURCE_FILE("sandwiches.c") */
|
||||
#define TEST_SOURCE_FILE(a)
|
||||
|
||||
/* Customize #include search paths for a test executable's compilation. Ex: TEST_INCLUDE_PATH("src/module_a/inc") */
|
||||
#define TEST_INCLUDE_PATH(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")
|
||||
#define TEST_ASSERT_EMPTY(pointer) UNITY_TEST_ASSERT_EMPTY( (pointer), __LINE__, " Expected Empty")
|
||||
#define TEST_ASSERT_NOT_EMPTY(pointer) UNITY_TEST_ASSERT_NOT_EMPTY((pointer), __LINE__, " Expected Non-Empty")
|
||||
|
||||
/* 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_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_size_t(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT((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_EQUAL_CHAR(expected, actual) UNITY_TEST_ASSERT_EQUAL_CHAR((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_UINT)(-1), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT)(0), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT)1 << (bit)), (UNITY_UINT)(-1), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT)1 << (bit)), (UNITY_UINT)(0), (actual), __LINE__, NULL)
|
||||
|
||||
/* Integer Not Equal To (of all sizes) */
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT8(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT8((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT16(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT32(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT64(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT8(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT8((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_size_t(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_CHAR((threshold), (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_size_t(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT((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_GREATER_THAN_CHAR(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_CHAR((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_size_t(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((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_LESS_THAN_CHAR(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_CHAR((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_size_t(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((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_GREATER_OR_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR((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_size_t(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((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)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR((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_size_t_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_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)
|
||||
#define TEST_ASSERT_CHAR_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_CHAR_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
|
||||
/* Integer Array Ranges (of all sizes) */
|
||||
#define TEST_ASSERT_INT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_size_t_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_CHAR_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __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_size_t_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_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)
|
||||
#define TEST_ASSERT_EQUAL_CHAR_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY((expected), (actual), (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_size_t(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((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)
|
||||
#define TEST_ASSERT_EACH_EQUAL_CHAR(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_CHAR((expected), (actual), (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_FLOAT_NOT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_NOT_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_NOT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_NOT_EQUAL_FLOAT((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_FLOAT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_FLOAT_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __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_GREATER_THAN_FLOAT(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_FLOAT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_FLOAT(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_FLOAT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_FLOAT(threshold, actual) UNITY_TEST_ASSERT_LESS_THAN_FLOAT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_FLOAT(threshold, actual) UNITY_TEST_ASSERT_LESS_OR_EQUAL_FLOAT((threshold), (actual), __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_DOUBLE_NOT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_DOUBLE_NOT_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_NOT_EQUAL_DOUBLE(expected, actual) UNITY_TEST_ASSERT_NOT_EQUAL_DOUBLE((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_DOUBLE_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_DOUBLE_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __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_GREATER_THAN_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_DOUBLE((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_LESS_THAN_DOUBLE((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_DOUBLE(threshold, actual) UNITY_TEST_ASSERT_LESS_OR_EQUAL_DOUBLE((threshold), (actual), __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)
|
||||
|
||||
/* Shorthand */
|
||||
#ifdef UNITY_SHORTHAND_AS_OLD
|
||||
#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")
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_INT
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_MEM
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_MEMORY((&expected), (&actual), sizeof(expected), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_RAW
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) == (actual)), __LINE__, " Expected Equal")
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_NONE
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* 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))
|
||||
#define TEST_ASSERT_EMPTY_MESSAGE(pointer, message) UNITY_TEST_ASSERT_EMPTY( (pointer), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EMPTY_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_EMPTY((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_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_size_t_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (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))
|
||||
#define TEST_ASSERT_EQUAL_CHAR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_CHAR((expected), (actual), __LINE__, (message))
|
||||
|
||||
/* Integer Not Equal To (of all sizes) */
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_INT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_INT64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_CHAR((threshold), (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_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT((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_GREATER_THAN_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_CHAR((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_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((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_LESS_THAN_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_CHAR((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_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((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_GREATER_OR_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR((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_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR((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_size_t_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_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))
|
||||
#define TEST_ASSERT_CHAR_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_CHAR_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
|
||||
/* Integer Array Ranges (of all sizes) */
|
||||
#define TEST_ASSERT_INT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_size_t_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_CHAR_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __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_size_t_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_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))
|
||||
#define TEST_ASSERT_EQUAL_CHAR_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY((expected), (actual), (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_size_t_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((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))
|
||||
#define TEST_ASSERT_EACH_EQUAL_CHAR_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_CHAR((expected), (actual), (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_NOT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_FLOAT((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_FLOAT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_FLOAT_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __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_GREATER_THAN_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_FLOAT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_FLOAT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_THAN_FLOAT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_FLOAT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_OR_EQUAL_FLOAT((threshold), (actual), __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_NOT_EQUAL_DOUBLE_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_NOT_EQUAL_DOUBLE((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_DOUBLE_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_DOUBLE_ARRAY_WITHIN((delta), (expected), (actual), (num_elements), __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_GREATER_THAN_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_DOUBLE((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_DOUBLE((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_THAN_DOUBLE((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_DOUBLE_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_LESS_OR_EQUAL_DOUBLE((threshold), (actual), __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))
|
||||
|
||||
/* Shorthand */
|
||||
#ifdef UNITY_SHORTHAND_AS_OLD
|
||||
#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))
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_INT
|
||||
#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_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_MEM
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_MEMORY((&expected), (&actual), sizeof(expected), __LINE__, message)
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_RAW
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) == (actual)), __LINE__, message)
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_NONE
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
|
||||
/* end of UNITY_FRAMEWORK_H */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
1283
tests/vendor/unity/unity_internals.h
vendored
Normal file
1283
tests/vendor/unity/unity_internals.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user