minor tweaks to README.md

This commit is contained in:
jlamothe 2023-11-22 22:50:05 +00:00
parent 7e0c088cf0
commit 9cdc474456

View File

@ -172,12 +172,15 @@ void run_test_compare(
## Test Contexts ## Test Contexts
It is useful to document what your tests are doing. This can be It is useful to document what your tests are doing. This can be
achieved using contexts. These are essentially just string values achieved using contexts. Contexts are essentially labelled
describing what the provided test(s) are for. Contexts can be nested collections of related tests. Contexts can be nested into
into hierarchies. This is useful both for organization purposes as hierarchies. This is useful both for organization purposes as well as
well as creating reusable test code. The following functions allow creating reusable test code. There are several functions written for
for the creation of test contexts as well as displaying information managing these contexts. Each of these functions takes as its first
about the tests as they're run. two arguments: a pointer to the current `TestState`, and a pointer to
a pointer to a string describing the context it defines. If the
pointer to the string is null, the tests are run as a part of the
existing context.
### `test_context()` ### `test_context()`
@ -191,7 +194,7 @@ void test_context(
This function takes a pointer to the current `TestState`, a string This function takes a pointer to the current `TestState`, a string
describing the context, and a function pointer that is used the same describing the context, and a function pointer that is used the same
way as the funciton pointer passed to `run_tests()`. way as the pointer passed to `run_tests()`.
### `test_context_with()` ### `test_context_with()`
@ -205,7 +208,7 @@ void test_context_with(
``` ```
This funciton allows for the passing of a `void` pointer into the test This funciton allows for the passing of a `void` pointer into the test
function, in much the same way as the `run_test_with()` function. Its function in much the same way as the `run_test_with()` function. Its
arguments are (in order), a pointer to the current state, the context arguments are (in order), a pointer to the current state, the context
description, a pointer to the test function, and the pointer being description, a pointer to the test function, and the pointer being
passed into that function. passed into that function.
@ -287,11 +290,11 @@ void append_test_log(
``` ```
This appends an arbitrary string to the end of the test log. The This appends an arbitrary string to the end of the test log. The
string is copied into the log, so the value pointed to by the second contents of the string are copied into the log, so the value pointed
argument does not need to persist in memory beyond the end of the call to by the second argument does not need to persist in memory beyond
to the function. Log entries are expected to be single lines. No the end of the call to the function. Log entries are expected to be
trailing newline should be present (but the trailing NUL character single lines. No trailing newline should be present (but the trailing
should (obviously)). NUL character should (obviously)).
### `log_test_context()` ### `log_test_context()`