beep beeeeep | you're crushing my apartment with your vehicle, human | so to these asm boughs I shall give my soul to keep | petals, my shroud gently carry me to sleep | murmurs and other tales
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.8KB

Mintx86asm32 API

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.

Booleans

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).

test_assert(int32_t cond, char* title)

Asserts cond as true. Alias of test_assert_true().

test_assert_true(int32_t cond, char* title)

Asserts cond as true.

test_assert_false(int32_t cond, char* title)

Asserts cond as false.

Integers

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.

test_assert_equal(int32_t val, int32_t exp, char* title)

Alias of test_assert_equal_uint.

test_assert_equal_uint(int32_t val, int32_t exp, char* title)

Asserts the equality of val to exp. On failure, prints integers as unsigned integers in decimal.

test_assert_equal_bin(int32_t val, int32_t exp, char* title)

Asserts the equality of val to exp. On failure, prints integers in binary.

test_assert_equal_oct(int32_t val, int32_t exp, char* title)

Asserts the equality of val to exp. On failure, prints integers in octal.

test_assert_equal_hex(int32_t val, int32_t exp, char* title)

Asserts the equality of val to exp. On failure, prints integers in hexadecimal.

Strings

The functions below assert string values, or char arrays, testing the equality of the values in a string (s) against an expected string (exp).

test_assert_equal_string(char* s, char* exp, char* title)

Assert the equality of s to exp.

test_assert_equal_string_len(char* s, char* exp, int32_t n, char* title)

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.

Memory

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.

test_assert_equal_memory(void* ptr, void* exp, int32_t n, char* title)

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.