Przeglądaj źródła

Finishing up documentation

Luiserebii 1 rok temu
rodzic
commit
b711287e25
Podpisane przez: Luiserebii <luis@serebii.io> ID klucza GPG: 525A84BC981B7D3E
1 zmienionych plików z 20 dodań i 2 usunięć
  1. 20
    2
      docs/README.md

+ 20
- 2
docs/README.md Wyświetl plik

@@ -4,7 +4,7 @@ This section contains documentation on using the Mint test framework. Each funct
4 4
 
5 5
 Running an assertion function causes a line to print to the standard output stream describing the success or failure of the assertion.
6 6
 
7
-## Testing Boolean Value
7
+## Booleans
8 8
 
9 9
 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).
10 10
 
@@ -20,7 +20,7 @@ Asserts `cond` as true.
20 20
 
21 21
 Asserts `cond` as false.
22 22
 
23
-## Testing Integer Equality
23
+## Integers
24 24
 
25 25
 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.
26 26
 
@@ -44,4 +44,22 @@ Asserts the equality of `val` to `exp`. On failure, prints integers in octal.
44 44
 
45 45
 Asserts the equality of `val` to `exp`. On failure, prints integers in hexadecimal.
46 46
 
47
+## Strings
47 48
 
49
+The functions below assert string values, or `char` arrays, testing the equality of the values in a string (`s`) against an expected string (`exp`).
50
+
51
+#### test\_assert\_equal\_string(char\* s, char\* exp, char\* title)
52
+
53
+Assert the equality of `s` to `exp`.
54
+
55
+#### test\_assert\_equal\_string\_len(char\* s, char\* exp, int32\_t n, char\* title)
56
+
57
+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.
58
+
59
+## Memory
60
+
61
+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.
62
+
63
+#### test\_assert\_equal\_memory(void\* ptr, void\* exp, int32\_t n, char\* title)
64
+
65
+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.

Ładowanie…
Anuluj
Zapisz