Luiserebii 49e27f2ec1 Minor changes, minor additions | 1 anno fa | |
---|---|---|
.. | ||
README.md | 1 anno fa |
This section contains documentation on using the Mint test framework. Each function is documented with its prototype and a brief description. Similar functions will be grouped together and described for brevity.
Running an assertion function causes a line to print to the standard output stream describing the success or failure of the assertion. Each assertion function takes a title
argument, which is printed as the name of the assertion which succeeded or failed.
The functions below assert a particular boolean value, which parallels the way expressions are evaluated and determine the behavior of control structures in C (i.e. true
as non-zero and false
otherwise).
Alias of test_assert_true()
.
Asserts cond
as true.
Asserts cond
as false.
The functions below assert integer values, testing the equality of a value (val
) against an expected value (exp
). All of these functions perform the same logic in equality, but differ in terms of the formatting of the values when printing them on failure.
Alias of test_assert_equal_uint
.
Asserts the equality of val
to exp
. On failure, prints integers as unsigned integers in decimal.
Asserts the equality of val
to exp
. On failure, prints integers in binary.
Asserts the equality of val
to exp
. On failure, prints integers in octal.
Asserts the equality of val
to exp
. On failure, prints integers in hexadecimal.
The functions below assert string values, or char
arrays, testing the equality of the values in a string (s
) against an expected string (exp
).
Assert the equality of s
to exp
.
Assert the equality of the first n
chars from both s
and exp
. In other words, the equality of the values in the range [a, a + n)
and [b, b + n)
is asserted.
This function asserts the equality of values along two regions of memory, comparing them byte-by-byte. If an unexpected byte is found, the index of the byte is printed alongside the byte expected, and the byte found.
Assert the equality of the first n
bytes from both ptr
and exp
. In other words, the equality of the values in the range [a, a + n)
and [b, b + n)
is asserted.
Prints a line summarizing the number of tests passed, and the number of tests failed. Returns an exit code to forward to the exit
syscall.