mirror of
https://github.com/tbamud/tbamud.git
synced 2026-04-30 04:41:51 +02:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bf9105aa4a | |||
| fd81fadaed | |||
| 87c75da59c | |||
| ac94839eb5 | |||
| 552461df51 | |||
| 10251814f6 | |||
| d4089c58e8 | |||
| a465860553 | |||
| b9f49478a3 | |||
| 171381f0ea | |||
| dbd6bfc103 | |||
| 1dfbe0fa83 | |||
| 039e45c5ef | |||
| 862c887b54 | |||
| 8548bbea99 | |||
| 28622d9fe2 | |||
| ce423e919f | |||
| 6b2d800c53 | |||
| 0d5d2bc435 | |||
| 4e1680db1a |
@@ -3,9 +3,14 @@ name: C/C++ CI
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
branches: [ "master" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
checks: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -16,4 +21,15 @@ jobs:
|
||||
- name: configure
|
||||
run: ./configure
|
||||
- name: build
|
||||
run: cd src && touch .accepted && make
|
||||
working-directory: src
|
||||
run: touch .accepted && make
|
||||
- name: test
|
||||
working-directory: tests
|
||||
run: make test
|
||||
- name: publish test results
|
||||
uses: dorny/test-reporter@v1
|
||||
if: always()
|
||||
with:
|
||||
name: Unity Tests
|
||||
path: tests/test-results/*.xml
|
||||
reporter: java-junit
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL Advanced"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
schedule:
|
||||
- cron: '42 10 * * 4'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners (GitHub.com only)
|
||||
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
permissions:
|
||||
# required for all workflows
|
||||
security-events: write
|
||||
|
||||
# required to fetch internal or private CodeQL packs
|
||||
packages: read
|
||||
|
||||
# only required for workflows in private repositories
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: actions
|
||||
build-mode: none
|
||||
- language: c-cpp
|
||||
build-mode: manual
|
||||
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
|
||||
# Use `c-cpp` to analyze code written in C, C++ or both
|
||||
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
|
||||
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
||||
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
|
||||
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
|
||||
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
|
||||
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Add any setup steps before running the `github/codeql-action/init` action.
|
||||
# This includes steps like installing compilers or runtimes (`actions/setup-node`
|
||||
# or others). This is typically only required for manual builds.
|
||||
# - name: Setup runtime (example)
|
||||
# uses: actions/setup-example@v1
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
# If the analyze step fails for one of the languages you are analyzing with
|
||||
# "We were unable to automatically build your code", modify the matrix above
|
||||
# to set the build mode to "manual" for that language. Then modify this step
|
||||
# to build your code.
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
- name: Run manual build steps
|
||||
if: matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
run: |
|
||||
./configure
|
||||
cd src && touch .accepted && make
|
||||
exit
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
@@ -7,6 +7,7 @@ config.status
|
||||
src/Makefile
|
||||
src/conf.h
|
||||
src/util/Makefile
|
||||
tests/Makefile
|
||||
src/.accepted
|
||||
src/depend
|
||||
src/util/depend
|
||||
@@ -93,3 +94,10 @@ src/test/testfile
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Unit test binaries (built artifacts)
|
||||
tests/test_utils
|
||||
tests/test_random
|
||||
tests/test_interpreter
|
||||
tests/test_class
|
||||
tests/test-results/
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# To initialize the repository:
|
||||
|
||||
Run these commands from the project directory.
|
||||
|
||||
```shell
|
||||
./configure && touch src/.accepted # the src/.accepted file must exist to build.
|
||||
```
|
||||
|
||||
# To build the code:
|
||||
|
||||
```shell
|
||||
cd src # make must be run from the src dir
|
||||
make # builds all changed source files.
|
||||
```
|
||||
@@ -400,6 +400,7 @@ add_executable(circle ${SRC_FILES})
|
||||
target_link_libraries(circle ${EXTRA_LIBS})
|
||||
|
||||
add_subdirectory(src/util)
|
||||
add_subdirectory(tests)
|
||||
|
||||
if (MEMORY_DEBUG)
|
||||
message(STATUS "MEMORY_DEBUG is activated, setting up zmalloc")
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
Files for tbaMUD.
|
||||
|
||||
## Unit Tests
|
||||
|
||||
tbaMUD ships with a C unit-test suite located in the `tests/` directory.
|
||||
The suite uses the [Unity](https://github.com/ThrowTheSwitch/Unity) test
|
||||
framework (vendored under `tests/vendor/unity/`).
|
||||
|
||||
### Quick start
|
||||
|
||||
```
|
||||
./configure
|
||||
cd tests && make test
|
||||
```
|
||||
|
||||
`make test` builds each test binary, runs it, and writes JUnit XML results to
|
||||
`tests/test-results/`. A summary is printed to the terminal:
|
||||
|
||||
```
|
||||
[PASS] test_utils
|
||||
[PASS] test_random
|
||||
[PASS] test_interpreter
|
||||
[PASS] test_class
|
||||
```
|
||||
|
||||
### CI
|
||||
|
||||
The GitHub Actions workflow (`.github/workflows/build.yml`) runs `make test`
|
||||
on every push and pull request against `master` and publishes a formatted
|
||||
report via the `dorny/test-reporter` action.
|
||||
|
||||
See [doc/testing.md](doc/testing.md) for full details on adding new tests and
|
||||
understanding the test infrastructure.
|
||||
|
||||
|
||||
+1
-1
@@ -210,6 +210,6 @@ AC_CHECK_PROTO(unlink)
|
||||
AC_CHECK_PROTO(vsnprintf)
|
||||
AC_CHECK_PROTO(write)
|
||||
|
||||
AC_OUTPUT(src/Makefile src/util/Makefile)
|
||||
AC_OUTPUT(src/Makefile src/util/Makefile tests/Makefile)
|
||||
#
|
||||
echo "Configuration completed. To compile, type: cd src; make"
|
||||
|
||||
@@ -5711,7 +5711,7 @@ EOF
|
||||
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
CONFIG_FILES=\${CONFIG_FILES-"src/Makefile src/util/Makefile"}
|
||||
CONFIG_FILES=\${CONFIG_FILES-"src/Makefile src/util/Makefile tests/Makefile"}
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||
|
||||
+2
-2
@@ -700,8 +700,8 @@ trigger variables.
|
||||
4.15. I want to expand the ability to pk in my MUD, allowing ASSASSINS
|
||||
that'll be able to PK without getting flagged. How can I do this?
|
||||
|
||||
With tbaMUD simply enter Cedit (configuration editor) and select Game Play
|
||||
Options. Then enable Player Killing.
|
||||
With tbaMUD simply enter Cedit (configuration editor), select Game Play
|
||||
(G). Select Player Killing Allowed (A) and choose (3) 'Free for all!'.
|
||||
|
||||
4.16. Why does it say ``Connection closed by foreign host.'' and not
|
||||
display the ``Byebye!'' message I'm trying to send before cutting
|
||||
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
# tbaMUD Unit Testing
|
||||
|
||||
_Updated 2026-04_
|
||||
|
||||
## Overview
|
||||
|
||||
tbaMUD has a C unit-test suite built on the
|
||||
[Unity](https://github.com/ThrowTheSwitch/Unity) framework. Tests live in the
|
||||
`tests/` directory alongside the vendored Unity source.
|
||||
|
||||
```
|
||||
tests/
|
||||
Makefile.in – Autoconf template; processed by configure
|
||||
test_stubs.c – Weak-symbol stubs that satisfy mud headers
|
||||
unity_to_junit.py – Converts Unity output to JUnit XML
|
||||
test_class.c – Tests for src/class.c
|
||||
test_interpreter.c – Tests for src/interpreter.c
|
||||
test_random.c – Tests for src/random.c
|
||||
test_utils.c – Tests for src/utils.c
|
||||
vendor/unity/ – Vendored Unity test framework
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
| Requirement | Notes |
|
||||
|---|---|
|
||||
| C compiler (gcc or clang) | Same compiler used to build the mud |
|
||||
| GNU make | Any POSIX-compatible make works |
|
||||
| Python 3 | Required only for JUnit XML conversion (`unity_to_junit.py`) |
|
||||
| autoconf / configure | Already needed to build the mud |
|
||||
|
||||
## Running the tests
|
||||
|
||||
Run `./configure` from the repository root first (only needed once):
|
||||
|
||||
```sh
|
||||
./configure
|
||||
```
|
||||
|
||||
Then build and run all tests from the `tests/` directory:
|
||||
|
||||
```sh
|
||||
cd tests
|
||||
make test
|
||||
```
|
||||
|
||||
`make test` performs the following steps for each test binary:
|
||||
|
||||
1. Compiles the test binary (if not already up to date).
|
||||
2. Runs the binary and captures stdout/stderr to `test-results/<name>.out`.
|
||||
3. Measures wall-clock elapsed time.
|
||||
4. Converts the Unity output to JUnit XML via `unity_to_junit.py`, writing
|
||||
`test-results/<name>.xml`.
|
||||
5. Prints `[PASS] <name>` or `[FAIL] <name>` and exits non-zero if any
|
||||
binary failed.
|
||||
|
||||
To build the test binaries without running them:
|
||||
|
||||
```sh
|
||||
cd tests
|
||||
make
|
||||
```
|
||||
|
||||
To remove all test binaries and result files:
|
||||
|
||||
```sh
|
||||
cd tests
|
||||
make clean
|
||||
```
|
||||
|
||||
## Test suites
|
||||
|
||||
| Binary | Source under test | Test file |
|
||||
|---|---|---|
|
||||
| `test_utils` | `src/utils.c`, `src/random.c` | `test_utils.c` |
|
||||
| `test_random` | `src/random.c`, `rand_number`/`dice` in `src/utils.c` | `test_random.c` |
|
||||
| `test_interpreter` | `src/interpreter.c` | `test_interpreter.c` |
|
||||
| `test_class` | `src/class.c` | `test_class.c` |
|
||||
|
||||
## Writing a new test
|
||||
|
||||
### Adding a test case to an existing suite
|
||||
|
||||
1. Open the relevant `test_<name>.c` file.
|
||||
2. Write a function with the signature `void test_my_feature(void)`.
|
||||
3. Use Unity assertion macros such as `TEST_ASSERT_EQUAL_INT`,
|
||||
`TEST_ASSERT_NULL`, `TEST_ASSERT_TRUE`, etc.
|
||||
4. Register the function in the `main()` block:
|
||||
```c
|
||||
RUN_TEST(test_my_feature);
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```c
|
||||
void test_str_cmp_equal_strings(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(0, str_cmp("hello", "hello"));
|
||||
}
|
||||
```
|
||||
|
||||
### Creating a new test suite
|
||||
|
||||
1. Create `tests/test_<module>.c`. Copy the boilerplate from an existing
|
||||
suite: include `unity.h`, define `setUp`/`tearDown` (may be empty), write
|
||||
test functions, and provide a `main()` that calls `UNITY_BEGIN()`,
|
||||
`RUN_TEST(...)` for each function, and `return UNITY_END();`.
|
||||
|
||||
2. Add the binary to `tests/Makefile.in`:
|
||||
- Add the name to the `TESTS` variable.
|
||||
- Add a build rule:
|
||||
```make
|
||||
test_<module>: $(UNITY_SRC) $(STUBS_SRC) $(UTILS_SRC) \
|
||||
$(SRCDIR)/<module>.c test_<module>.c
|
||||
$(COMPILE) -o $@ $^ $(LIBS)
|
||||
```
|
||||
|
||||
3. Re-run `./configure` from the repository root to regenerate
|
||||
`tests/Makefile` from the updated `tests/Makefile.in`.
|
||||
|
||||
### Stubs
|
||||
|
||||
Many mud source files reference global variables and functions that are only
|
||||
meaningful at runtime (e.g. `descriptor_list`, `log()`). `test_stubs.c`
|
||||
provides zero-initialised definitions and `__attribute__((weak))` stub
|
||||
implementations for these symbols so that test binaries link without pulling
|
||||
in the full mud.
|
||||
|
||||
If a new test requires a function not yet stubbed, add a weak stub to
|
||||
`test_stubs.c`:
|
||||
|
||||
```c
|
||||
__attribute__((weak)) void my_function(void) { /* no-op */ }
|
||||
```
|
||||
|
||||
## JUnit XML output and CI
|
||||
|
||||
`unity_to_junit.py` reads Unity's line-oriented output on stdin and writes a
|
||||
JUnit-compatible XML file. It accepts an optional third argument with the
|
||||
elapsed wall-clock time in seconds (provided by the `make test` target):
|
||||
|
||||
```
|
||||
usage: unity_to_junit.py <suite_name> <output.xml> [elapsed_seconds]
|
||||
```
|
||||
|
||||
The GitHub Actions workflow (`.github/workflows/build.yml`) runs `make test`
|
||||
on every push and pull request against `master`. After the tests finish the
|
||||
`dorny/test-reporter` action reads `tests/test-results/*.xml` and publishes a
|
||||
formatted report as a GitHub Check with pass/fail counts and per-suite
|
||||
execution times.
|
||||
+75
-55
@@ -777,6 +777,15 @@ void weight_change_object(struct obj_data *obj, int weight)
|
||||
}
|
||||
}
|
||||
|
||||
#define DRINK_CON_MAX(cont) (GET_OBJ_VAL((cont), 0))
|
||||
#define DRINK_CON_NOW(cont) (GET_OBJ_VAL((cont), 1))
|
||||
#define DRINK_CON_TYPE(cont) (GET_OBJ_VAL((cont), 2))
|
||||
#define DRINK_CON_POISON(cont) (GET_OBJ_VAL((cont), 3))
|
||||
|
||||
#define LIMITED_DRINK_CONTAINER(cont) (DRINK_CON_MAX((cont)) >= 0 && DRINK_CON_NOW((cont)) >= 0)
|
||||
#define EMPTY_DRINK_CONTAINER(cont) (LIMITED_DRINK_CONTAINER((cont)) && DRINK_CON_NOW((cont)) < 1)
|
||||
|
||||
|
||||
void name_from_drinkcon(struct obj_data *obj)
|
||||
{
|
||||
const char *liqname;
|
||||
@@ -788,13 +797,12 @@ void name_from_drinkcon(struct obj_data *obj)
|
||||
if (obj->name == obj_proto[GET_OBJ_RNUM(obj)].name)
|
||||
obj->name = strdup(obj_proto[GET_OBJ_RNUM(obj)].name);
|
||||
|
||||
liqname = drinknames[GET_OBJ_VAL(obj, 2)];
|
||||
liqname = drinknames[DRINK_CON_TYPE(obj)];
|
||||
|
||||
remove_from_string(obj->name, liqname);
|
||||
new_name = right_trim_whitespace(obj->name);
|
||||
free(obj->name);
|
||||
obj->name = new_name;
|
||||
|
||||
}
|
||||
|
||||
void name_to_drinkcon(struct obj_data *obj, int type)
|
||||
@@ -813,6 +821,7 @@ void name_to_drinkcon(struct obj_data *obj, int type)
|
||||
obj->name = new_name;
|
||||
}
|
||||
|
||||
|
||||
ACMD(do_drink)
|
||||
{
|
||||
char arg[MAX_INPUT_LENGTH];
|
||||
@@ -873,7 +882,7 @@ ACMD(do_drink)
|
||||
send_to_char(ch, "Your stomach can't contain anymore!\r\n");
|
||||
return;
|
||||
}
|
||||
if (GET_OBJ_VAL(temp, 1) < 1) {
|
||||
if (EMPTY_DRINK_CONTAINER(temp)) {
|
||||
send_to_char(ch, "It is empty.\r\n");
|
||||
return;
|
||||
}
|
||||
@@ -884,33 +893,38 @@ ACMD(do_drink)
|
||||
if (subcmd == SCMD_DRINK) {
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
snprintf(buf, sizeof(buf), "$n drinks %s from $p.", drinks[GET_OBJ_VAL(temp, 2)]);
|
||||
snprintf(buf, sizeof(buf), "$n drinks %s from $p.", drinks[DRINK_CON_TYPE(temp)]);
|
||||
act(buf, TRUE, ch, temp, 0, TO_ROOM);
|
||||
|
||||
send_to_char(ch, "You drink the %s.\r\n", drinks[GET_OBJ_VAL(temp, 2)]);
|
||||
send_to_char(ch, "You drink the %s.\r\n", drinks[DRINK_CON_TYPE(temp)]);
|
||||
|
||||
if (drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] > 0)
|
||||
amount = (25 - GET_COND(ch, THIRST)) / drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK];
|
||||
if (drink_aff[DRINK_CON_TYPE(temp)][DRUNK] > 0)
|
||||
amount = (25 - GET_COND(ch, THIRST)) / drink_aff[DRINK_CON_TYPE(temp)][DRUNK];
|
||||
else
|
||||
amount = rand_number(3, 10);
|
||||
|
||||
} else {
|
||||
act("$n sips from $p.", TRUE, ch, temp, 0, TO_ROOM);
|
||||
send_to_char(ch, "It tastes like %s.\r\n", drinks[GET_OBJ_VAL(temp, 2)]);
|
||||
send_to_char(ch, "It tastes like %s.\r\n", drinks[DRINK_CON_TYPE(temp)]);
|
||||
amount = 1;
|
||||
}
|
||||
|
||||
amount = MIN(amount, GET_OBJ_VAL(temp, 1));
|
||||
/* For limited drink containers with remaining contents, don't drink more
|
||||
* than the amount currently in the container. Unlimited containers are
|
||||
* handled separately and are not clamped here.
|
||||
*/
|
||||
if (LIMITED_DRINK_CONTAINER(temp))
|
||||
amount = MIN(amount, DRINK_CON_NOW(temp));
|
||||
|
||||
/* You can't subtract more than the object weighs, unless its unlimited. */
|
||||
if (GET_OBJ_VAL(temp, 0) > 0) {
|
||||
if (LIMITED_DRINK_CONTAINER(temp)) {
|
||||
weight = MIN(amount, GET_OBJ_WEIGHT(temp));
|
||||
weight_change_object(temp, -weight); /* Subtract amount */
|
||||
}
|
||||
|
||||
gain_condition(ch, DRUNK, drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] * amount / 4);
|
||||
gain_condition(ch, HUNGER, drink_aff[GET_OBJ_VAL(temp, 2)][HUNGER] * amount / 4);
|
||||
gain_condition(ch, THIRST, drink_aff[GET_OBJ_VAL(temp, 2)][THIRST] * amount / 4);
|
||||
gain_condition(ch, DRUNK, drink_aff[DRINK_CON_TYPE(temp)][DRUNK] * amount / 4);
|
||||
gain_condition(ch, HUNGER, drink_aff[DRINK_CON_TYPE(temp)][HUNGER] * amount / 4);
|
||||
gain_condition(ch, THIRST, drink_aff[DRINK_CON_TYPE(temp)][THIRST] * amount / 4);
|
||||
|
||||
if (GET_COND(ch, DRUNK) > 10)
|
||||
send_to_char(ch, "You feel drunk.\r\n");
|
||||
@@ -921,7 +935,7 @@ ACMD(do_drink)
|
||||
if (GET_COND(ch, HUNGER) > 20)
|
||||
send_to_char(ch, "You are full.\r\n");
|
||||
|
||||
if (GET_OBJ_VAL(temp, 3) && GET_LEVEL(ch) < LVL_IMMORT) { /* The crap was poisoned ! */
|
||||
if (DRINK_CON_POISON(temp) && GET_LEVEL(ch) < LVL_IMMORT) { /* The crap was poisoned ! */
|
||||
send_to_char(ch, "Oops, it tasted rather strange!\r\n");
|
||||
act("$n chokes and utters some strange sounds.", TRUE, ch, 0, 0, TO_ROOM);
|
||||
|
||||
@@ -932,12 +946,13 @@ ACMD(do_drink)
|
||||
affect_join(ch, &af, FALSE, FALSE, FALSE, FALSE);
|
||||
}
|
||||
/* Empty the container (unless unlimited), and no longer poison. */
|
||||
if (GET_OBJ_VAL(temp, 0) > 0) {
|
||||
GET_OBJ_VAL(temp, 1) -= amount;
|
||||
if (!GET_OBJ_VAL(temp, 1)) { /* The last bit */
|
||||
if (LIMITED_DRINK_CONTAINER(temp)) {
|
||||
amount = MIN(amount, DRINK_CON_NOW(temp)); // never subtract more than the current amount
|
||||
DRINK_CON_NOW(temp) -= amount;
|
||||
if (!DRINK_CON_NOW(temp)) { /* The last bit */
|
||||
name_from_drinkcon(temp);
|
||||
GET_OBJ_VAL(temp, 2) = 0;
|
||||
GET_OBJ_VAL(temp, 3) = 0;
|
||||
DRINK_CON_TYPE(temp) = 0;
|
||||
DRINK_CON_POISON(temp) = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1064,7 +1079,7 @@ ACMD(do_pour)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (GET_OBJ_VAL(from_obj, 1) == 0) {
|
||||
if (EMPTY_DRINK_CONTAINER(from_obj)) {
|
||||
act("The $p is empty.", FALSE, ch, from_obj, 0, TO_CHAR);
|
||||
return;
|
||||
}
|
||||
@@ -1074,19 +1089,22 @@ ACMD(do_pour)
|
||||
return;
|
||||
}
|
||||
if (!str_cmp(arg2, "out")) {
|
||||
if (GET_OBJ_VAL(from_obj, 0) > 0) {
|
||||
if (!LIMITED_DRINK_CONTAINER(from_obj)) {
|
||||
send_to_char(ch, "You can't pour that out! There's simply too much in it.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* pour out */
|
||||
act("$n empties $p.", TRUE, ch, from_obj, 0, TO_ROOM);
|
||||
act("You empty $p.", FALSE, ch, from_obj, 0, TO_CHAR);
|
||||
|
||||
weight_change_object(from_obj, -GET_OBJ_VAL(from_obj, 1)); /* Empty */
|
||||
weight_change_object(from_obj, -DRINK_CON_NOW(from_obj)); /* Empty */
|
||||
|
||||
name_from_drinkcon(from_obj);
|
||||
GET_OBJ_VAL(from_obj, 1) = 0;
|
||||
GET_OBJ_VAL(from_obj, 2) = 0;
|
||||
GET_OBJ_VAL(from_obj, 3) = 0;
|
||||
}
|
||||
else
|
||||
send_to_char(ch, "You can't possibly pour that container out!\r\n");
|
||||
|
||||
DRINK_CON_NOW(from_obj) = 0;
|
||||
DRINK_CON_TYPE(from_obj) = 0;
|
||||
DRINK_CON_POISON(from_obj) = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1094,8 +1112,7 @@ ACMD(do_pour)
|
||||
send_to_char(ch, "You can't find it!\r\n");
|
||||
return;
|
||||
}
|
||||
if ((GET_OBJ_TYPE(to_obj) != ITEM_DRINKCON) &&
|
||||
(GET_OBJ_TYPE(to_obj) != ITEM_FOUNTAIN)) {
|
||||
if ((GET_OBJ_TYPE(to_obj) != ITEM_DRINKCON) && (GET_OBJ_TYPE(to_obj) != ITEM_FOUNTAIN)) {
|
||||
send_to_char(ch, "You can't pour anything into that.\r\n");
|
||||
return;
|
||||
}
|
||||
@@ -1104,59 +1121,62 @@ ACMD(do_pour)
|
||||
send_to_char(ch, "A most unproductive effort.\r\n");
|
||||
return;
|
||||
}
|
||||
if ((GET_OBJ_VAL(to_obj, 0) < 0) ||
|
||||
(!(GET_OBJ_VAL(to_obj, 1) < GET_OBJ_VAL(to_obj, 0)))) {
|
||||
if (!EMPTY_DRINK_CONTAINER(to_obj) && DRINK_CON_TYPE(to_obj) != DRINK_CON_TYPE(from_obj)) {
|
||||
send_to_char(ch, "There is already another liquid in it!\r\n");
|
||||
return;
|
||||
}
|
||||
if (!(GET_OBJ_VAL(to_obj, 1) < GET_OBJ_VAL(to_obj, 0))) {
|
||||
// Not allowed to fill an unlimited container, or a container that is already full.
|
||||
if (!LIMITED_DRINK_CONTAINER(to_obj) || DRINK_CON_NOW(to_obj) >= DRINK_CON_MAX(to_obj)) {
|
||||
send_to_char(ch, "There is no room for more.\r\n");
|
||||
return;
|
||||
}
|
||||
if (subcmd == SCMD_POUR)
|
||||
send_to_char(ch, "You pour the %s into the %s.", drinks[GET_OBJ_VAL(from_obj, 2)], arg2);
|
||||
send_to_char(ch, "You pour the %s into the %s.\r\n", drinks[DRINK_CON_TYPE(from_obj)], arg2);
|
||||
|
||||
if (subcmd == SCMD_FILL) {
|
||||
act("You gently fill $p from $P.", FALSE, ch, to_obj, from_obj, TO_CHAR);
|
||||
act("$n gently fills $p from $P.", TRUE, ch, to_obj, from_obj, TO_ROOM);
|
||||
}
|
||||
/* New alias */
|
||||
if (GET_OBJ_VAL(to_obj, 1) == 0)
|
||||
name_to_drinkcon(to_obj, GET_OBJ_VAL(from_obj, 2));
|
||||
if (EMPTY_DRINK_CONTAINER(to_obj))
|
||||
name_to_drinkcon(to_obj, DRINK_CON_TYPE(from_obj));
|
||||
|
||||
/* First same type liq. */
|
||||
GET_OBJ_VAL(to_obj, 2) = GET_OBJ_VAL(from_obj, 2);
|
||||
DRINK_CON_TYPE(to_obj) = DRINK_CON_TYPE(from_obj);
|
||||
|
||||
/* Then how much to pour */
|
||||
if (GET_OBJ_VAL(from_obj, 0) > 0) {
|
||||
GET_OBJ_VAL(from_obj, 1) -= (amount =
|
||||
(GET_OBJ_VAL(to_obj, 0) - GET_OBJ_VAL(to_obj, 1)));
|
||||
if (LIMITED_DRINK_CONTAINER(from_obj)) {
|
||||
amount = MIN(DRINK_CON_NOW(from_obj), DRINK_CON_MAX(to_obj) - DRINK_CON_NOW(to_obj));
|
||||
DRINK_CON_NOW(from_obj) -= amount;
|
||||
DRINK_CON_NOW(to_obj) += amount;
|
||||
|
||||
GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0);
|
||||
|
||||
if (GET_OBJ_VAL(from_obj, 1) < 0) { /* There was too little */
|
||||
GET_OBJ_VAL(to_obj, 1) += GET_OBJ_VAL(from_obj, 1);
|
||||
amount += GET_OBJ_VAL(from_obj, 1);
|
||||
if (DRINK_CON_NOW(from_obj) == 0) { /* It was emptied */
|
||||
name_from_drinkcon(from_obj);
|
||||
GET_OBJ_VAL(from_obj, 1) = 0;
|
||||
GET_OBJ_VAL(from_obj, 2) = 0;
|
||||
GET_OBJ_VAL(from_obj, 3) = 0;
|
||||
DRINK_CON_NOW(from_obj) = 0;
|
||||
DRINK_CON_TYPE(from_obj) = 0;
|
||||
DRINK_CON_POISON(from_obj) = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0);
|
||||
amount = GET_OBJ_VAL(to_obj, 0);
|
||||
} else {
|
||||
amount = DRINK_CON_MAX(to_obj) - DRINK_CON_NOW(to_obj);
|
||||
DRINK_CON_NOW(to_obj) = DRINK_CON_MAX(to_obj);
|
||||
}
|
||||
/* Poisoned? */
|
||||
GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3))
|
||||
;
|
||||
DRINK_CON_POISON(to_obj) = (DRINK_CON_POISON(to_obj) || DRINK_CON_POISON(from_obj));
|
||||
/* Weight change, except for unlimited. */
|
||||
if (GET_OBJ_VAL(from_obj, 0) > 0) {
|
||||
if (LIMITED_DRINK_CONTAINER(from_obj)) {
|
||||
weight_change_object(from_obj, -amount);
|
||||
}
|
||||
weight_change_object(to_obj, amount); /* Add weight */
|
||||
}
|
||||
|
||||
#undef DRINK_CON_MAX
|
||||
#undef DRINK_CON_NOW
|
||||
#undef DRINK_CON_TYPE
|
||||
#undef DRINK_CON_POISON
|
||||
|
||||
#undef LIMITED_DRINK_CONTAINER
|
||||
#undef EMPTY_DRINK_CONTAINER
|
||||
|
||||
static void wear_message(struct char_data *ch, struct obj_data *obj, int where)
|
||||
{
|
||||
const char *wear_messages[][2] = {
|
||||
|
||||
+5
-3
@@ -54,7 +54,7 @@ ACMD(do_assist)
|
||||
else if (!CAN_SEE(ch, opponent))
|
||||
act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR);
|
||||
/* prevent accidental pkill */
|
||||
else if (!CONFIG_PK_ALLOWED && !IS_NPC(opponent))
|
||||
else if (!pk_allowed(ch, opponent))
|
||||
send_to_char(ch, "You cannot kill other players.\r\n");
|
||||
else {
|
||||
send_to_char(ch, "You join the fight!\r\n");
|
||||
@@ -82,8 +82,10 @@ ACMD(do_hit)
|
||||
} else if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == vict))
|
||||
act("$N is just such a good friend, you simply can't hit $M.", FALSE, ch, 0, vict, TO_CHAR);
|
||||
else {
|
||||
if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch))
|
||||
check_killer(ch, vict);
|
||||
if (!pk_allowed(ch, vict)) {
|
||||
send_to_char(ch, "Player killing is not allowed.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) {
|
||||
if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */
|
||||
|
||||
+21
-4
@@ -154,6 +154,7 @@ ACMD(do_steal)
|
||||
send_to_char(ch, "You have no idea how to do that.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) {
|
||||
send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n");
|
||||
return;
|
||||
@@ -169,20 +170,26 @@ ACMD(do_steal)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if player stealing is allowed */
|
||||
if (!IS_NPC(vict)) {
|
||||
if (CONFIG_PT_SETTING == CONFIG_PT_OFF) {
|
||||
send_to_char(ch, "Stealing from players is not allowed.\r\n");
|
||||
return;
|
||||
}
|
||||
pcsteal = (CONFIG_PT_SETTING == CONFIG_PT_LIMITED);
|
||||
}
|
||||
|
||||
/* 101% is a complete failure */
|
||||
percent = rand_number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket;
|
||||
|
||||
if (GET_POS(vict) < POS_SLEEPING)
|
||||
percent = -1; /* ALWAYS SUCCESS, unless heavy object. */
|
||||
|
||||
if (!CONFIG_PT_ALLOWED && !IS_NPC(vict))
|
||||
pcsteal = 1;
|
||||
|
||||
if (!AWAKE(vict)) /* Easier to steal from sleeping people. */
|
||||
percent -= 50;
|
||||
|
||||
/* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */
|
||||
if (GET_LEVEL(vict) >= LVL_IMMORT || pcsteal || GET_MOB_SPEC(vict) == shop_keeper)
|
||||
if (GET_LEVEL(vict) >= LVL_IMMORT || GET_MOB_SPEC(vict) == shop_keeper)
|
||||
percent = 101; /* Failure */
|
||||
|
||||
if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) {
|
||||
@@ -221,6 +228,12 @@ ACMD(do_steal)
|
||||
if (percent > GET_SKILL(ch, SKILL_STEAL)) {
|
||||
ohoh = TRUE;
|
||||
send_to_char(ch, "Oops..\r\n");
|
||||
|
||||
/* Player got caught and stealing is limited via cedit */
|
||||
if ( (pcsteal) && (!PLR_FLAGGED(ch, PLR_THIEF))) {
|
||||
SET_BIT_AR(PLR_FLAGS(ch), PLR_THIEF);
|
||||
}
|
||||
|
||||
act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT);
|
||||
act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
|
||||
} else { /* Steal the item */
|
||||
@@ -242,6 +255,10 @@ ACMD(do_steal)
|
||||
} else { /* Steal some coins */
|
||||
if (AWAKE(vict) && (percent > GET_SKILL(ch, SKILL_STEAL))) {
|
||||
ohoh = TRUE;
|
||||
/* Player got caught and stealing is limited via cedit */
|
||||
if ( (pcsteal) && (!PLR_FLAGGED(ch, PLR_THIEF))) {
|
||||
SET_BIT_AR(PLR_FLAGS(ch), PLR_THIEF);
|
||||
}
|
||||
send_to_char(ch, "Oops..\r\n");
|
||||
act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, vict, TO_VICT);
|
||||
act("$n tries to steal gold from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ ACMD(do_action)
|
||||
if (!action->char_found)
|
||||
*arg = '\0';
|
||||
|
||||
if (action->char_found && argument)
|
||||
if (action->char_found)
|
||||
one_argument(argument, arg);
|
||||
else
|
||||
*arg = '\0';
|
||||
|
||||
+4
-1
@@ -2396,7 +2396,10 @@ ACMD(do_wizutil)
|
||||
act("A sudden fireball conjured from nowhere thaws $n!", FALSE, vict, 0, 0, TO_ROOM);
|
||||
break;
|
||||
case SCMD_UNAFFECT:
|
||||
if (vict->affected || AFF_FLAGS(vict)) {
|
||||
for (taeller = 0; taeller < AF_ARRAY_MAX; taeller++)
|
||||
if (AFF_FLAGS(vict)[taeller])
|
||||
break;
|
||||
if (vict->affected || taeller < AF_ARRAY_MAX) {
|
||||
while (vict->affected)
|
||||
affect_remove(vict, vict->affected);
|
||||
for(taeller=0; taeller < AF_ARRAY_MAX; taeller++)
|
||||
|
||||
+3
-3
@@ -374,9 +374,9 @@ SPECIAL(king_welmar)
|
||||
"$n proclaims 'principe dignos'."
|
||||
};
|
||||
|
||||
const char bedroom_path[] = "s33004o1c1S.";
|
||||
const char throne_path[] = "W3o3cG52211rg.";
|
||||
const char monolog_path[] = "ABCDPPPP.";
|
||||
static const char bedroom_path[] = "s33004o1c1S.";
|
||||
static const char throne_path[] = "W3o3cG52211rg.";
|
||||
static const char monolog_path[] = "ABCDPPPP.";
|
||||
|
||||
static const char *path;
|
||||
static int path_index;
|
||||
|
||||
+47
-13
@@ -79,8 +79,8 @@ static void cedit_setup(struct descriptor_data *d)
|
||||
|
||||
/* Copy the current configuration from the config_info to this one and copy
|
||||
* the game play options from the configuration info struct. */
|
||||
OLC_CONFIG(d)->play.pk_allowed = CONFIG_PK_ALLOWED;
|
||||
OLC_CONFIG(d)->play.pt_allowed = CONFIG_PT_ALLOWED;
|
||||
OLC_CONFIG(d)->play.pk_setting = CONFIG_PK_SETTING;
|
||||
OLC_CONFIG(d)->play.pt_setting = CONFIG_PT_SETTING;
|
||||
OLC_CONFIG(d)->play.level_can_shout = CONFIG_LEVEL_CAN_SHOUT;
|
||||
OLC_CONFIG(d)->play.holler_move_cost = CONFIG_HOLLER_MOVE_COST;
|
||||
OLC_CONFIG(d)->play.tunnel_size = CONFIG_TUNNEL_SIZE;
|
||||
@@ -183,8 +183,8 @@ static void cedit_save_internally(struct descriptor_data *d)
|
||||
/* see if we need to reassign spec procs on rooms */
|
||||
int reassign = (CONFIG_DTS_ARE_DUMPS != OLC_CONFIG(d)->play.dts_are_dumps);
|
||||
/* Copy the data back from the descriptor to the config_info structure. */
|
||||
CONFIG_PK_ALLOWED = OLC_CONFIG(d)->play.pk_allowed;
|
||||
CONFIG_PT_ALLOWED = OLC_CONFIG(d)->play.pt_allowed;
|
||||
CONFIG_PK_SETTING = OLC_CONFIG(d)->play.pk_setting;
|
||||
CONFIG_PT_SETTING = OLC_CONFIG(d)->play.pt_setting;
|
||||
CONFIG_LEVEL_CAN_SHOUT = OLC_CONFIG(d)->play.level_can_shout;
|
||||
CONFIG_HOLLER_MOVE_COST = OLC_CONFIG(d)->play.holler_move_cost;
|
||||
CONFIG_TUNNEL_SIZE = OLC_CONFIG(d)->play.tunnel_size;
|
||||
@@ -339,9 +339,9 @@ int save_config( IDXTYPE nowhere )
|
||||
);
|
||||
|
||||
fprintf(fl, "* Is player killing allowed on the mud?\n"
|
||||
"pk_allowed = %d\n\n", CONFIG_PK_ALLOWED);
|
||||
"pk_setting = %d\n\n", CONFIG_PK_SETTING);
|
||||
fprintf(fl, "* Is player thieving allowed on the mud?\n"
|
||||
"pt_allowed = %d\n\n", CONFIG_PT_ALLOWED);
|
||||
"pt_setting = %d\n\n", CONFIG_PT_SETTING);
|
||||
fprintf(fl, "* What is the minimum level a player can shout/gossip/etc?\n"
|
||||
"level_can_shout = %d\n\n", CONFIG_LEVEL_CAN_SHOUT);
|
||||
fprintf(fl, "* How many movement points does shouting cost the player?\n"
|
||||
@@ -608,8 +608,10 @@ static void cedit_disp_menu(struct descriptor_data *d)
|
||||
|
||||
static void cedit_disp_game_play_options(struct descriptor_data *d)
|
||||
{
|
||||
int m_opt;
|
||||
int m_opt, pk_setting, pt_setting;
|
||||
m_opt = OLC_CONFIG(d)->play.map_option;
|
||||
pk_setting = OLC_CONFIG(d)->play.pk_setting;
|
||||
pt_setting = OLC_CONFIG(d)->play.pt_setting;
|
||||
get_char_colors(d->character);
|
||||
clear_screen(d);
|
||||
|
||||
@@ -644,8 +646,8 @@ static void cedit_disp_game_play_options(struct descriptor_data *d)
|
||||
"%s8%s) Scripts on PC's : %s%s\r\n"
|
||||
"%sQ%s) Exit To The Main Menu\r\n"
|
||||
"Enter your choice : ",
|
||||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.pk_allowed),
|
||||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.pt_allowed),
|
||||
grn, nrm, cyn, pk_setting == 0 ? "Off" : (pk_setting == 1 ? "Limited" : (pk_setting == 2 ? "Free-for-all" : "Invalid!")),
|
||||
grn, nrm, cyn, pt_setting == 0 ? "Off" : (pt_setting == 1 ? "Limited" : (pt_setting == 2 ? "Free-for-all" : "Invalid!")),
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->play.level_can_shout,
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->play.holler_move_cost,
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->play.tunnel_size,
|
||||
@@ -883,13 +885,21 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
||||
switch (*arg) {
|
||||
case 'a':
|
||||
case 'A':
|
||||
TOGGLE_VAR(OLC_CONFIG(d)->play.pk_allowed);
|
||||
break;
|
||||
write_to_output(d, "1) No Player Killing\r\n");
|
||||
write_to_output(d, "2) Limited Player Killing\r\n");
|
||||
write_to_output(d, "3) Free-for-all!\r\n");
|
||||
write_to_output(d, "Enter choice: ");
|
||||
OLC_MODE(d) = CEDIT_PK_SETTING;
|
||||
return;
|
||||
|
||||
case 'b':
|
||||
case 'B':
|
||||
TOGGLE_VAR(OLC_CONFIG(d)->play.pt_allowed);
|
||||
break;
|
||||
write_to_output(d, "1) No Player Thieving\r\n");
|
||||
write_to_output(d, "2) Limited Player Thieving\r\n");
|
||||
write_to_output(d, "3) Free-for-all!\r\n");
|
||||
write_to_output(d, "Enter choice: ");
|
||||
OLC_MODE(d) = CEDIT_PT_SETTING;
|
||||
return;
|
||||
|
||||
case 'c':
|
||||
case 'C':
|
||||
@@ -1708,6 +1718,30 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
||||
}
|
||||
break;
|
||||
|
||||
case CEDIT_PK_SETTING:
|
||||
if (!*arg || (atoi(arg) < 0) || (atoi(arg) > 3) ) {
|
||||
write_to_output(d,
|
||||
"That is an invalid choice!\r\n"
|
||||
"Select 1, 2 or 3 (0 to cancel) :");
|
||||
} else {
|
||||
if ((atoi(arg) >= 1) && (atoi(arg) <= 3))
|
||||
OLC_CONFIG(d)->play.pk_setting = (atoi(arg) - 1);
|
||||
cedit_disp_game_play_options(d);
|
||||
}
|
||||
break;
|
||||
|
||||
case CEDIT_PT_SETTING:
|
||||
if (!*arg || (atoi(arg) < 0) || (atoi(arg) > 3) ) {
|
||||
write_to_output(d,
|
||||
"That is an invalid choice!\r\n"
|
||||
"Select 1, 2 or 3 (0 to cancel) :");
|
||||
} else {
|
||||
if ((atoi(arg) >= 1) && (atoi(arg) <= 3))
|
||||
OLC_CONFIG(d)->play.pt_setting = (atoi(arg) - 1);
|
||||
cedit_disp_game_play_options(d);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* We should never get here, but just in case... */
|
||||
cleanup_olc(d, CLEANUP_CONFIG);
|
||||
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: cedit_parse(): Reached default case!");
|
||||
|
||||
+18
-8
@@ -39,15 +39,25 @@
|
||||
/* Can Scripts be attached to players? */
|
||||
int script_players = NO;
|
||||
|
||||
/* pk_allowed sets the tone of the entire game. If pk_allowed is set to NO,
|
||||
* then players will not be allowed to kill, summon, charm, or sleep other
|
||||
* players, as well as a variety of other "asshole player" protections. However,
|
||||
* if you decide you want to have an all-out knock-down drag-out PK Mud, just
|
||||
* set pk_allowed to YES - and anything goes. */
|
||||
int pk_allowed = NO;
|
||||
/* pk_setting sets the tone of the entire game.
|
||||
*
|
||||
* CONFIG_PK_OFF 0 Players are prevented from damaging or fighting other players in code
|
||||
* CONFIG_PK_LIMITED 1 Players may damage and fight but will be flagged PLR_KILLER
|
||||
* CONFIG_PK_FREEFORALL 2 No restrictions or flags for player damaging or killing
|
||||
*
|
||||
* If pk_setting is set to 0, then players will not be allowed to kill, summon, charm, or sleep other
|
||||
* players, as well as a variety of other "asshole player" protections.
|
||||
* However, if you decide you want to have an all-out knock-down drag-out PK Mud, just
|
||||
* set pk_setting to 2 - and anything goes. */
|
||||
int pk_setting = 0;
|
||||
|
||||
/* Is playerthieving allowed? */
|
||||
int pt_allowed = NO;
|
||||
/* Is playerthieving allowed?
|
||||
*
|
||||
* CONFIG_PT_OFF 0 Players are prevented from stealing from other players in code
|
||||
* CONFIG_PT_LIMITED 1 Players may steal from other players but will be flagged PLR_THIEF if caught
|
||||
* CONFIG_PT_FREEFORALL 2 No restrictions or flags for player stealing
|
||||
*/
|
||||
int pt_setting = 0;
|
||||
|
||||
/* Minimum level a player must be to shout/holler/gossip/auction. */
|
||||
int level_can_shout = 1;
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@
|
||||
#define _CONFIG_H_
|
||||
|
||||
/* Global variable declarations, all settable by cedit */
|
||||
extern int pk_allowed;
|
||||
extern int pk_setting;
|
||||
extern int script_players;
|
||||
extern int pt_allowed;
|
||||
extern int pt_setting;
|
||||
extern int level_can_shout;
|
||||
extern int holler_move_cost;
|
||||
extern int tunnel_size;
|
||||
|
||||
@@ -3838,8 +3838,8 @@ static void load_default_config( void )
|
||||
/* This function is called only once, at boot-time. We assume config_info is
|
||||
* empty. -Welcor */
|
||||
/* Game play options. */
|
||||
CONFIG_PK_ALLOWED = pk_allowed;
|
||||
CONFIG_PT_ALLOWED = pt_allowed;
|
||||
CONFIG_PK_SETTING = pk_setting;
|
||||
CONFIG_PT_SETTING = pt_setting;
|
||||
CONFIG_LEVEL_CAN_SHOUT = level_can_shout;
|
||||
CONFIG_HOLLER_MOVE_COST = holler_move_cost;
|
||||
CONFIG_TUNNEL_SIZE = tunnel_size;
|
||||
@@ -4113,12 +4113,12 @@ void load_config( void )
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if (!str_cmp(tag, "pk_allowed"))
|
||||
CONFIG_PK_ALLOWED = num;
|
||||
if (!str_cmp(tag, "pk_setting"))
|
||||
CONFIG_PK_SETTING = num;
|
||||
else if (!str_cmp(tag, "protocol_negotiation"))
|
||||
CONFIG_PROTOCOL_NEGOTIATION = num;
|
||||
else if (!str_cmp(tag, "pt_allowed"))
|
||||
CONFIG_PT_ALLOWED = num;
|
||||
else if (!str_cmp(tag, "pt_setting"))
|
||||
CONFIG_PT_SETTING = num;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
|
||||
+17
-5
@@ -1024,17 +1024,27 @@ ACMD(do_mdoor)
|
||||
}
|
||||
|
||||
if ((rm = get_room(target)) == NULL) {
|
||||
mob_log(ch, "mdoor: invalid target");
|
||||
mob_log(ch, "mdoor: invalid target (arg == %s)", target);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||
mob_log(ch, "mdoor: invalid direction");
|
||||
char dirs_str[256];
|
||||
int di, doff = 0;
|
||||
dirs_str[0] = '\0';
|
||||
for (di = 0; *dirs[di] != '\n'; di++)
|
||||
doff += snprintf(dirs_str + doff, sizeof(dirs_str) - doff, "%s%s", doff ? " " : "", dirs[di]);
|
||||
mob_log(ch, "mdoor: invalid direction (arg == %s) not found in: [ %s ]", direction, dirs_str);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fd = search_block(field, door_field, FALSE)) == -1) {
|
||||
mob_log(ch, "odoor: invalid field");
|
||||
char fields_str[256];
|
||||
int fi, foff = 0;
|
||||
fields_str[0] = '\0';
|
||||
for (fi = 0; *door_field[fi] != '\n'; fi++)
|
||||
foff += snprintf(fields_str + foff, sizeof(fields_str) - foff, "%s%s", foff ? " " : "", door_field[fi]);
|
||||
mob_log(ch, "mdoor: invalid field (arg == %s) not found in: [ %s ]", field, fields_str);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1081,8 +1091,10 @@ ACMD(do_mdoor)
|
||||
case 5: /* room */
|
||||
if ((to_room = real_room(atoi(value))) != NOWHERE)
|
||||
newexit->to_room = to_room;
|
||||
else
|
||||
mob_log(ch, "mdoor: invalid door target");
|
||||
else {
|
||||
newexit->to_room = NOWHERE;
|
||||
mob_log(ch, "mdoor: invalid door target (arg == %s)", value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-5
@@ -625,17 +625,27 @@ static OCMD(do_odoor)
|
||||
}
|
||||
|
||||
if ((rm = get_room(target)) == NULL) {
|
||||
obj_log(obj, "odoor: invalid target");
|
||||
obj_log(obj, "odoor: invalid target (arg == %s)", target);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||
obj_log(obj, "odoor: invalid direction");
|
||||
char dirs_str[256];
|
||||
int di, doff = 0;
|
||||
dirs_str[0] = '\0';
|
||||
for (di = 0; *dirs[di] != '\n'; di++)
|
||||
doff += snprintf(dirs_str + doff, sizeof(dirs_str) - doff, "%s%s", doff ? " " : "", dirs[di]);
|
||||
obj_log(obj, "odoor: invalid direction (arg == %s) not found in: [ %s ]", direction, dirs_str);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fd = search_block(field, door_field, FALSE)) == -1) {
|
||||
obj_log(obj, "odoor: invalid field");
|
||||
char fields_str[256];
|
||||
int fi, foff = 0;
|
||||
fields_str[0] = '\0';
|
||||
for (fi = 0; *door_field[fi] != '\n'; fi++)
|
||||
foff += snprintf(fields_str + foff, sizeof(fields_str) - foff, "%s%s", foff ? " " : "", door_field[fi]);
|
||||
obj_log(obj, "odoor: invalid field (arg == %s) not found in: [ %s ]", field, fields_str);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -682,8 +692,10 @@ static OCMD(do_odoor)
|
||||
case 5: /* room */
|
||||
if ((to_room = real_room(atoi(value))) != NOWHERE)
|
||||
newexit->to_room = to_room;
|
||||
else
|
||||
obj_log(obj, "odoor: invalid door target");
|
||||
else {
|
||||
newexit->to_room = NOWHERE;
|
||||
obj_log(obj, "odoor: invalid door target (arg == %s)", value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -147,7 +147,7 @@ void greet_memory_mtrigger(char_data *actor)
|
||||
{
|
||||
trig_data *t;
|
||||
char_data *ch;
|
||||
struct script_memory *mem;
|
||||
struct script_memory *mem, *next_mem;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int command_performed = 0;
|
||||
|
||||
@@ -159,7 +159,8 @@ void greet_memory_mtrigger(char_data *actor)
|
||||
AFF_FLAGGED(ch, AFF_CHARM))
|
||||
continue;
|
||||
/* find memory line with command only */
|
||||
for (mem = SCRIPT_MEM(ch); mem && SCRIPT_MEM(ch); mem=mem->next) {
|
||||
for (mem = SCRIPT_MEM(ch); mem && SCRIPT_MEM(ch); mem = next_mem) {
|
||||
next_mem = mem->next;
|
||||
if (char_script_id(actor)!=mem->id) continue;
|
||||
if (mem->cmd) {
|
||||
command_interpreter(ch, mem->cmd); /* no script */
|
||||
@@ -245,7 +246,8 @@ void entry_memory_mtrigger(char_data *ch)
|
||||
for (actor = world[IN_ROOM(ch)].people; actor && SCRIPT_MEM(ch);
|
||||
actor = actor->next_in_room) {
|
||||
if (actor!=ch && SCRIPT_MEM(ch)) {
|
||||
for (mem = SCRIPT_MEM(ch); mem && SCRIPT_MEM(ch); mem = mem->next) {
|
||||
for (mem = SCRIPT_MEM(ch); mem && SCRIPT_MEM(ch); ) {
|
||||
struct script_memory *next_mem = mem->next;
|
||||
if (char_script_id(actor)==mem->id) {
|
||||
struct script_memory *prev;
|
||||
if (mem->cmd) command_interpreter(ch, mem->cmd);
|
||||
@@ -270,6 +272,7 @@ void entry_memory_mtrigger(char_data *ch)
|
||||
if (mem->cmd) free(mem->cmd);
|
||||
free(mem);
|
||||
}
|
||||
mem = next_mem;
|
||||
} /* for (mem =..... */
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -465,7 +465,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||
* will return the number of bags of gold.
|
||||
* Addition inspired by Jamie Nelson */
|
||||
else if (!str_cmp(var, "findmob")) {
|
||||
if (!field || !*field || !subfield || !*subfield) {
|
||||
if (!*field || !subfield || !*subfield) {
|
||||
script_log("findmob.vnum(mvnum) - illegal syntax");
|
||||
strcpy(str, "0");
|
||||
} else {
|
||||
@@ -486,7 +486,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||
}
|
||||
/* Addition inspired by Jamie Nelson. */
|
||||
else if (!str_cmp(var, "findobj")) {
|
||||
if (!field || !*field || !subfield || !*subfield) {
|
||||
if (!*field || !subfield || !*subfield) {
|
||||
script_log("findobj.vnum(ovnum) - illegal syntax");
|
||||
strcpy(str, "0");
|
||||
} else {
|
||||
|
||||
+17
-5
@@ -224,17 +224,27 @@ WCMD(do_wdoor)
|
||||
}
|
||||
|
||||
if ((rm = get_room(target)) == NULL) {
|
||||
wld_log(room, "wdoor: invalid target");
|
||||
wld_log(room, "wdoor: invalid target (arg == %s)", target);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||
wld_log(room, "wdoor: invalid direction");
|
||||
char dirs_str[256];
|
||||
int di, doff = 0;
|
||||
dirs_str[0] = '\0';
|
||||
for (di = 0; *dirs[di] != '\n'; di++)
|
||||
doff += snprintf(dirs_str + doff, sizeof(dirs_str) - doff, "%s%s", doff ? " " : "", dirs[di]);
|
||||
wld_log(room, "wdoor: invalid direction (arg == %s) not found in: [ %s ]", direction, dirs_str);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fd = search_block(field, door_field, FALSE)) == -1) {
|
||||
wld_log(room, "wdoor: invalid field");
|
||||
char fields_str[256];
|
||||
int fi, foff = 0;
|
||||
fields_str[0] = '\0';
|
||||
for (fi = 0; *door_field[fi] != '\n'; fi++)
|
||||
foff += snprintf(fields_str + foff, sizeof(fields_str) - foff, "%s%s", foff ? " " : "", door_field[fi]);
|
||||
wld_log(room, "wdoor: invalid field (arg == %s) not found in: [ %s ]", field, fields_str);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,8 +291,10 @@ WCMD(do_wdoor)
|
||||
case 5: /* room */
|
||||
if ((to_room = real_room(atoi(value))) != NOWHERE)
|
||||
newexit->to_room = to_room;
|
||||
else
|
||||
wld_log(room, "wdoor: invalid door target");
|
||||
else {
|
||||
newexit->to_room = NOWHERE;
|
||||
wld_log(room, "wdoor: invalid door target (arg == %s)", value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+33
-11
@@ -110,10 +110,13 @@ void update_pos(struct char_data *victim)
|
||||
|
||||
void check_killer(struct char_data *ch, struct char_data *vict)
|
||||
{
|
||||
if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF))
|
||||
if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF)) {
|
||||
return;
|
||||
if (PLR_FLAGGED(ch, PLR_KILLER) || IS_NPC(ch) || IS_NPC(vict) || ch == vict)
|
||||
}
|
||||
|
||||
if (PLR_FLAGGED(ch, PLR_KILLER) || IS_NPC(ch) || IS_NPC(vict) || ch == vict){
|
||||
return;
|
||||
}
|
||||
|
||||
SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
|
||||
send_to_char(ch, "If you want to be a PLAYER KILLER, so be it...\r\n");
|
||||
@@ -122,6 +125,22 @@ void check_killer(struct char_data *ch, struct char_data *vict)
|
||||
GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name);
|
||||
}
|
||||
|
||||
bool pk_allowed(struct char_data *ch, struct char_data *victim)
|
||||
{
|
||||
/* NPCs are never restricted */
|
||||
if (IS_NPC(ch) || IS_NPC(victim))
|
||||
return true;
|
||||
|
||||
if (CONFIG_PK_SETTING == CONFIG_PK_OFF)
|
||||
return false;
|
||||
|
||||
if (CONFIG_PK_SETTING == CONFIG_PK_LIMITED)
|
||||
check_killer(ch, victim);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* start one char fighting another (yes, it is horrible, I know... ) */
|
||||
void set_fighting(struct char_data *ch, struct char_data *vict)
|
||||
{
|
||||
@@ -133,6 +152,12 @@ void set_fighting(struct char_data *ch, struct char_data *vict)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!pk_allowed(ch, vict)) {
|
||||
send_to_char(ch, "Player killing is not permitted.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ch->next_fighting = combat_list;
|
||||
combat_list = ch;
|
||||
|
||||
@@ -142,8 +167,6 @@ void set_fighting(struct char_data *ch, struct char_data *vict)
|
||||
FIGHTING(ch) = vict;
|
||||
GET_POS(ch) = POS_FIGHTING;
|
||||
|
||||
if (!CONFIG_PK_ALLOWED)
|
||||
check_killer(ch, vict);
|
||||
}
|
||||
|
||||
/* remove a char from the list of fighting chars */
|
||||
@@ -603,6 +626,12 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
||||
return (-1); /* -je, 7/7/92 */
|
||||
}
|
||||
|
||||
/* Check for PK if this is not a PK MUD */
|
||||
if (!pk_allowed(ch, victim)) {
|
||||
send_to_char(ch, "Player killing is not permitted.\r\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* peaceful rooms */
|
||||
if (ch->nr != real_mobile(DG_CASTER_PROXY) &&
|
||||
ch != victim && ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) {
|
||||
@@ -650,13 +679,6 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
||||
if (AFF_FLAGGED(victim, AFF_SANCTUARY) && dam >= 2)
|
||||
dam /= 2;
|
||||
|
||||
/* Check for PK if this is not a PK MUD */
|
||||
if (!CONFIG_PK_ALLOWED) {
|
||||
check_killer(ch, victim);
|
||||
if (PLR_FLAGGED(ch, PLR_KILLER) && (ch != victim))
|
||||
dam = 0;
|
||||
}
|
||||
|
||||
/* Set the maximum damage per round and subtract the hit points */
|
||||
dam = MAX(MIN(dam, 100), 0);
|
||||
GET_HIT(victim) -= dam;
|
||||
|
||||
@@ -34,6 +34,7 @@ void set_fighting(struct char_data *ch, struct char_data *victim);
|
||||
int skill_message(int dam, struct char_data *ch, struct char_data *vict,
|
||||
int attacktype);
|
||||
void stop_fighting(struct char_data *ch);
|
||||
bool pk_allowed(struct char_data *ch, struct char_data *victim);
|
||||
|
||||
|
||||
/* Global variables */
|
||||
|
||||
+2
-2
@@ -367,7 +367,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||
s++;
|
||||
temp = *s;
|
||||
*s = '\0';
|
||||
char buf3[9];
|
||||
char buf3[13];
|
||||
sprintf(buf3, "%4d: ", (i - 1));
|
||||
strncat(buf, buf3, sizeof(buf) - strlen(buf) - 1);
|
||||
strncat(buf, t, sizeof(buf) - strlen(buf) - 1);
|
||||
@@ -421,7 +421,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||
strncat(buf, *d->str, sizeof(buf) - strlen(buf) - 1);
|
||||
*s = temp;
|
||||
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||
if (s && *s)
|
||||
if (*s)
|
||||
strncat(buf, s, sizeof(buf) - strlen(buf) - 1);
|
||||
RECREATE(*d->str, char, strlen(buf) + 3);
|
||||
|
||||
|
||||
+2
-1
@@ -1612,8 +1612,9 @@ void nanny(struct descriptor_data *d, char *arg)
|
||||
if (load_result == CLASS_UNDEFINED) {
|
||||
write_to_output(d, "\r\nThat's not a class.\r\nClass: ");
|
||||
return;
|
||||
} else
|
||||
} else {
|
||||
GET_CLASS(d->character) = load_result;
|
||||
}
|
||||
|
||||
if (d->olc) {
|
||||
free(d->olc);
|
||||
|
||||
+2
-2
@@ -473,7 +473,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
|
||||
break;
|
||||
|
||||
case SPELL_SLEEP:
|
||||
if (!CONFIG_PK_ALLOWED && !IS_NPC(ch) && !IS_NPC(victim))
|
||||
if ((CONFIG_PK_SETTING == CONFIG_PK_OFF) && !IS_NPC(ch) && !IS_NPC(victim))
|
||||
return;
|
||||
if (MOB_FLAGGED(victim, MOB_NOSLEEP))
|
||||
return;
|
||||
@@ -650,7 +650,7 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
|
||||
continue;
|
||||
if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT)
|
||||
continue;
|
||||
if (!CONFIG_PK_ALLOWED && !IS_NPC(ch) && !IS_NPC(tch))
|
||||
if ((CONFIG_PK_SETTING == CONFIG_PK_OFF) && !IS_NPC(ch) && !IS_NPC(tch))
|
||||
continue;
|
||||
if (!IS_NPC(ch) && IS_NPC(tch) && AFF_FLAGGED(tch, AFF_CHARM))
|
||||
continue;
|
||||
|
||||
@@ -380,6 +380,8 @@ extern const char *nrm, *grn, *cyn, *yel;
|
||||
#define CEDIT_MAP_SIZE 55
|
||||
#define CEDIT_MINIMAP_SIZE 56
|
||||
#define CEDIT_DEBUG_MODE 57
|
||||
#define CEDIT_PK_SETTING 58
|
||||
#define CEDIT_PT_SETTING 59
|
||||
|
||||
/* Hedit Submodes of connectedness. */
|
||||
#define HEDIT_CONFIRM_SAVESTRING 0
|
||||
|
||||
+1
-1
@@ -405,7 +405,7 @@ int load_char(const char *name, struct char_data *ch)
|
||||
|
||||
case 'P':
|
||||
if (!strcmp(tag, "Page")) GET_PAGE_LENGTH(ch) = atoi(line);
|
||||
else if (!strcmp(tag, "Pass")) strcpy(GET_PASSWD(ch), line);
|
||||
else if (!strcmp(tag, "Pass")) { strncpy(GET_PASSWD(ch), line, MAX_PWD_LENGTH); GET_PASSWD(ch)[MAX_PWD_LENGTH] = '\0'; }
|
||||
else if (!strcmp(tag, "Plyd")) ch->player.time.played = atoi(line);
|
||||
else if (!strcmp(tag, "PfIn")) POOFIN(ch) = strdup(line);
|
||||
else if (!strcmp(tag, "PfOt")) POOFOUT(ch) = strdup(line);
|
||||
|
||||
+6
-1
@@ -2102,9 +2102,11 @@ static void ExecuteMSDPPair( descriptor_t *apDescriptor, const char *apVariable,
|
||||
!strcmp(apDescriptor->pProtocol->pVariables[i]->pValueString, "Unknown") )
|
||||
{
|
||||
/* Store the new value if it's valid */
|
||||
char *pBuffer = alloca(VariableNameTable[i].Max+1);
|
||||
char *pBuffer = malloc(VariableNameTable[i].Max + 1);
|
||||
int j; /* Loop counter */
|
||||
|
||||
if ( pBuffer != NULL )
|
||||
{
|
||||
for ( j = 0; j < VariableNameTable[i].Max && *apValue != '\0'; ++apValue )
|
||||
{
|
||||
if ( isprint(*apValue) )
|
||||
@@ -2117,6 +2119,9 @@ static void ExecuteMSDPPair( descriptor_t *apDescriptor, const char *apVariable,
|
||||
free(apDescriptor->pProtocol->pVariables[i]->pValueString);
|
||||
apDescriptor->pProtocol->pVariables[i]->pValueString = AllocString(pBuffer);
|
||||
}
|
||||
|
||||
free(pBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* This variable only accepts numeric values */
|
||||
|
||||
+4
-2
@@ -410,8 +410,10 @@ void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
||||
break;
|
||||
case AQ_OBJ_RETURN:
|
||||
if (IS_NPC(vict) && (GET_MOB_VNUM(vict) == QST_RETURNMOB(rnum)))
|
||||
if (object && (GET_OBJ_VNUM(object) == QST_TARGET(rnum)))
|
||||
if (object && (GET_OBJ_VNUM(object) == QST_TARGET(rnum))) {
|
||||
generic_complete_quest(ch);
|
||||
extract_obj(object);
|
||||
}
|
||||
break;
|
||||
case AQ_ROOM_CLEAR:
|
||||
if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) {
|
||||
@@ -648,7 +650,7 @@ static void quest_show(struct char_data *ch, mob_vnum qm)
|
||||
send_to_char(ch, "There are no quests available here at the moment.\r\n");
|
||||
}
|
||||
|
||||
static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
||||
static void quest_stat(struct char_data *ch, char *argument)
|
||||
{
|
||||
qst_rnum rnum;
|
||||
mob_rnum qmrnum;
|
||||
|
||||
+1
-1
@@ -1052,7 +1052,7 @@ static void read_line(FILE *shop_f, const char *string, void *data)
|
||||
{
|
||||
char buf[READ_SIZE];
|
||||
|
||||
if (!get_line(shop_f, buf) || !sscanf(buf, string, data)) {
|
||||
if (!get_line(shop_f, buf) || sscanf(buf, string, data) != 1) {
|
||||
log("SYSERR: Error in shop #%d, near '%s' with '%s'", SHOP_NUM(top_shop), buf, string);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+2
-2
@@ -202,9 +202,9 @@ SPECIAL(mayor)
|
||||
{
|
||||
char actbuf[MAX_INPUT_LENGTH];
|
||||
|
||||
const char open_path[] =
|
||||
static const char open_path[] =
|
||||
"W3a3003b33000c111d0d111Oe333333Oe22c222112212111a1S.";
|
||||
const char close_path[] =
|
||||
static const char close_path[] =
|
||||
"W3a3003b33000c111d0d111CE333333CE22c222112212111a1S.";
|
||||
|
||||
static const char *path = NULL;
|
||||
|
||||
+2
-2
@@ -120,7 +120,7 @@ ASPELL(spell_summon)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CONFIG_PK_ALLOWED) {
|
||||
if (CONFIG_PK_SETTING == CONFIG_PK_OFF) {
|
||||
if (MOB_FLAGGED(victim, MOB_AGGRESSIVE)) {
|
||||
act("As the words escape your lips and $N travels\r\n"
|
||||
"through time and space towards you, you realize that $E is\r\n"
|
||||
@@ -265,7 +265,7 @@ ASPELL(spell_charm)
|
||||
else if (AFF_FLAGGED(victim, AFF_CHARM) || level < GET_LEVEL(victim))
|
||||
send_to_char(ch, "You fail.\r\n");
|
||||
/* player charming another player - no legal reason for this */
|
||||
else if (!CONFIG_PK_ALLOWED && !IS_NPC(victim))
|
||||
else if ((CONFIG_PK_SETTING == CONFIG_PK_OFF) && !IS_NPC(victim))
|
||||
send_to_char(ch, "You fail - shouldn't be doing it anyway.\r\n");
|
||||
else if (circle_follow(victim, ch))
|
||||
send_to_char(ch, "Sorry, following in circles is not allowed.\r\n");
|
||||
|
||||
+2
-2
@@ -1291,8 +1291,8 @@ struct recent_player
|
||||
* variables. */
|
||||
struct game_data
|
||||
{
|
||||
int pk_allowed; /**< Is player killing allowed? */
|
||||
int pt_allowed; /**< Is player thieving allowed? */
|
||||
int pk_setting; /**< Is player killing allowed? */
|
||||
int pt_setting; /**< Is player thieving allowed? */
|
||||
int level_can_shout; /**< Level player must be to shout. */
|
||||
int holler_move_cost; /**< Cost to holler in move points. */
|
||||
int tunnel_size; /**< Number of people allowed in a tunnel.*/
|
||||
|
||||
@@ -9,7 +9,6 @@ set(TOOLS
|
||||
sign
|
||||
split
|
||||
wld2html
|
||||
webster
|
||||
)
|
||||
|
||||
# common includes and flags
|
||||
|
||||
+8
-2
@@ -939,9 +939,15 @@ do \
|
||||
#define CONFIG_CONFFILE config_info.CONFFILE
|
||||
|
||||
/** Player killing allowed or not? */
|
||||
#define CONFIG_PK_ALLOWED config_info.play.pk_allowed
|
||||
#define CONFIG_PK_SETTING config_info.play.pk_setting
|
||||
#define CONFIG_PK_OFF 0 /* Players are prevented from damaging or fighting other players in code */
|
||||
#define CONFIG_PK_LIMITED 1 /* Players may damage and fight but will be flagged PLR_KILLER */
|
||||
#define CONFIG_PK_FREEFORALL 2 /* No restrictions or flags for player damaging or killing */
|
||||
/** Player thieving allowed or not? */
|
||||
#define CONFIG_PT_ALLOWED config_info.play.pt_allowed
|
||||
#define CONFIG_PT_SETTING config_info.play.pt_setting
|
||||
#define CONFIG_PT_OFF 0 /* Players are prevented from stealing from other players in code */
|
||||
#define CONFIG_PT_LIMITED 1 /* Players may steal from other players but will be flagged PLR_THIEF if caught */
|
||||
#define CONFIG_PT_FREEFORALL 2 /* No restrictions or flags for player stealing */
|
||||
/** What level to use the shout command? */
|
||||
#define CONFIG_LEVEL_CAN_SHOUT config_info.play.level_can_shout
|
||||
/** How many move points does holler cost? */
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# 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)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
|
||||
list(APPEND TEST_CFLAGS
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-function
|
||||
-Wno-unused-variable
|
||||
)
|
||||
endif()
|
||||
|
||||
# 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).
|
||||
# Reuse the crypt library detected by the top-level build when one is needed;
|
||||
# on platforms where crypt() is provided by libc, no extra link library is
|
||||
# required.
|
||||
if(CRYPT_LIBRARY)
|
||||
target_link_libraries(test_interpreter PRIVATE ${CRYPT_LIBRARY})
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 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
|
||||
)
|
||||
@@ -0,0 +1,96 @@
|
||||
# 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 and produce JUnit XML files in test-results/
|
||||
# ---------------------------------------------------------------------------
|
||||
test: $(TESTS)
|
||||
@echo "=========================================="
|
||||
@echo "Running tbaMUD unit tests"
|
||||
@echo "=========================================="
|
||||
@mkdir -p test-results
|
||||
@status=0; \
|
||||
for t in $(TESTS); do \
|
||||
t_start=$$(date +%s%3N); \
|
||||
./$$t > test-results/$$t.out 2>&1; \
|
||||
rc=$$?; \
|
||||
t_end=$$(date +%s%3N); \
|
||||
elapsed=$$(awk "BEGIN{printf \"%.3f\", ($$t_end - $$t_start)/1000}"); \
|
||||
cat test-results/$$t.out; \
|
||||
python3 unity_to_junit.py $$t test-results/$$t.xml "$$elapsed" < test-results/$$t.out; \
|
||||
if [ $$rc -eq 0 ]; then \
|
||||
echo "[PASS] $$t"; \
|
||||
else \
|
||||
echo "[FAIL] $$t"; \
|
||||
status=1; \
|
||||
fi; \
|
||||
done; \
|
||||
exit $$status
|
||||
|
||||
clean:
|
||||
rm -f $(TESTS)
|
||||
rm -rf test-results
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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 → 1622650073
|
||||
* ========================================================= */
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -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
|
||||
@@ -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();
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Convert Unity test-runner output to JUnit XML.
|
||||
|
||||
Usage:
|
||||
./test_binary | python3 unity_to_junit.py <suite_name> <output.xml> [elapsed_seconds]
|
||||
|
||||
Unity emits one result line per test:
|
||||
path/to/file.c:LINE:TEST_NAME:PASS
|
||||
path/to/file.c:LINE:TEST_NAME:FAIL:message
|
||||
path/to/file.c:LINE:TEST_NAME:IGNORE:message
|
||||
followed by a summary line:
|
||||
N Tests N Failures N Ignored
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
def parse_unity(lines):
|
||||
tests = []
|
||||
total = failures = ignored = 0
|
||||
for line in lines:
|
||||
line = line.rstrip("\n")
|
||||
m = re.match(
|
||||
r"^.+:\d+:([^:]+):(PASS|FAIL|IGNORE)(?::(.*))?$", line
|
||||
)
|
||||
if m:
|
||||
name, result, message = m.group(1), m.group(2), m.group(3) or ""
|
||||
tests.append((name, result, message))
|
||||
continue
|
||||
m2 = re.match(r"^(\d+) Tests (\d+) Failures (\d+) Ignored", line)
|
||||
if m2:
|
||||
total, failures, ignored = int(m2.group(1)), int(m2.group(2)), int(m2.group(3))
|
||||
if not total:
|
||||
total = len(tests)
|
||||
failures = sum(1 for _, r, _ in tests if r == "FAIL")
|
||||
ignored = sum(1 for _, r, _ in tests if r == "IGNORE")
|
||||
return tests, total, failures, ignored
|
||||
|
||||
|
||||
def build_xml(suite_name, tests, total, failures, ignored, elapsed):
|
||||
# Distribute total time evenly across tests for per-testcase timing.
|
||||
per_test = round(elapsed / total, 6) if total else 0.0
|
||||
suite = ET.Element(
|
||||
"testsuite",
|
||||
name=suite_name,
|
||||
tests=str(total),
|
||||
failures=str(failures),
|
||||
errors="0",
|
||||
skipped=str(ignored),
|
||||
time=f"{elapsed:.6f}",
|
||||
)
|
||||
for name, result, message in tests:
|
||||
case = ET.SubElement(
|
||||
suite, "testcase",
|
||||
name=name, classname=suite_name, time=f"{per_test:.6f}",
|
||||
)
|
||||
if result == "FAIL":
|
||||
f = ET.SubElement(case, "failure", message=message)
|
||||
f.text = message
|
||||
elif result == "IGNORE":
|
||||
ET.SubElement(case, "skipped", message=message)
|
||||
return ET.ElementTree(suite)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 3 or len(sys.argv) > 4:
|
||||
print(f"usage: {sys.argv[0]} <suite_name> <output.xml> [elapsed_seconds]", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
suite_name, output_file = sys.argv[1], sys.argv[2]
|
||||
elapsed = float(sys.argv[3]) if len(sys.argv) == 4 else 0.0
|
||||
tests, total, failures, ignored = parse_unity(sys.stdin.readlines())
|
||||
tree = build_xml(suite_name, tests, total, failures, ignored, elapsed)
|
||||
ET.indent(tree, space=" ")
|
||||
tree.write(output_file, encoding="unicode", xml_declaration=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Vendored
+2637
File diff suppressed because it is too large
Load Diff
Vendored
+698
@@ -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
|
||||
Vendored
+1283
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user