Browse Source

Minor changes, minor additions

Luiserebii 11 months ago
parent
commit
49e27f2ec1
Signed by: Luiserebii <luis@serebii.io> GPG Key ID: 525A84BC981B7D3E
2 changed files with 22 additions and 17 deletions
  1. 4
    5
      README.md
  2. 18
    12
      docs/README.md

+ 4
- 5
README.md View File

@@ -26,8 +26,8 @@ test_assert_equal_oct(int32_t val, int32_t exp, char* title)
26 26
 test_assert_equal_hex(int32_t val, int32_t exp, char* title)
27 27
 
28 28
 test_assert_equal_string(char* s, char* exp, char* title)
29
-test_assert_equal_string_len(char* s, char* exp, int32_t len, char* title)
30
-test_assert_equal_memory(void* ptr, void* exp, int32_t el, char* title)
29
+test_assert_equal_string_len(char* s, char* exp, int32_t n, char* title)
30
+test_assert_equal_memory(void* ptr, void* exp, int32_t n, char* title)
31 31
 
32 32
 test_end()
33 33
 ```
@@ -41,7 +41,6 @@ Documentation can be found by checking the [`docs/`](docs) directory.
41 41
 
42 42
 The general formatting of each function follows these patterns:
43 43
 ```
44
-  [SUCCESS] strlen() returns num
45 44
   [SUCCESS] strlen() returns num
46 45
   [FAIL] strlen() returns num: Expected true, found false ("[NUM]")
47 46
   [FAIL] isbool() returns true: Expected false, found true ("[NUM]")
@@ -49,10 +48,10 @@ The general formatting of each function follows these patterns:
49 48
   [FAIL] sums are equal: Expected "01010", found "01111"
50 49
   [FAIL] sums are equal: Expected "0[NUM]", found "0[NUM]"
51 50
   [FAIL] sums are equal: Expected "0x[NUM]", found "0x[NUM]"
52
-  [FAIL] memory arrs are equal: Expected "0x[NUM]" on [N]th byte, found "0x[NUM]"
53 51
   [FAIL] strings are equal: Expected "[STR]", found "[STR]"
52
+  [FAIL] memory arrs are equal: Expected "0x[NUM]" on [N]th byte, found "0x[NUM]"
54 53
 
55
-[FAIL] 8 tests failing with 2 tests passing.
54
+[FAIL] [NUM] tests failing with [NUM] tests passing.
56 55
 [SUCCESS] All tests ([NUM]) passing with no tests failing.
57 56
 ```
58 57
 For a particular set of test cases, output may look as follows:

+ 18
- 12
docs/README.md View File

@@ -8,15 +8,15 @@ Running an assertion function causes a line to print to the standard output stre
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
 
11
-### test\_assert(int32\_t cond, char\* title)
11
+- #### void test\_assert(int32\_t cond, char\* title)
12 12
 
13
-Asserts `cond` as true. Alias of `test_assert_true()`.
13
+Alias of `test_assert_true()`.
14 14
 
15
-### test\_assert\_true(int32\_t cond, char\* title)
15
+- #### void test\_assert\_true(int32\_t cond, char\* title)
16 16
 
17 17
 Asserts `cond` as true.
18 18
 
19
-### test\_assert\_false(int32\_t cond, char\* title)
19
+- #### void test\_assert\_false(int32\_t cond, char\* title)
20 20
 
21 21
 Asserts `cond` as false.
22 22
 
@@ -24,23 +24,23 @@ Asserts `cond` as false.
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
 
27
-### test\_assert\_equal(int32\_t val, int32\_t exp, char\* title)
27
+- #### void test\_assert\_equal(int32\_t val, int32\_t exp, char\* title)
28 28
 
29 29
 Alias of `test_assert_equal_uint`.
30 30
 
31
-### test\_assert\_equal\_uint(int32\_t val, int32\_t exp, char\* title)
31
+- #### void test\_assert\_equal\_uint(int32\_t val, int32\_t exp, char\* title)
32 32
 
33 33
 Asserts the equality of `val` to `exp`. On failure, prints integers as unsigned integers in decimal.
34 34
 
35
-### test\_assert\_equal\_bin(int32\_t val, int32\_t exp, char\* title)
35
+- #### void test\_assert\_equal\_bin(int32\_t val, int32\_t exp, char\* title)
36 36
 
37 37
 Asserts the equality of `val` to `exp`. On failure, prints integers in binary.
38 38
 
39
-### test\_assert\_equal\_oct(int32\_t val, int32\_t exp, char\* title)
39
+- #### void test\_assert\_equal\_oct(int32\_t val, int32\_t exp, char\* title)
40 40
 
41 41
 Asserts the equality of `val` to `exp`. On failure, prints integers in octal.
42 42
 
43
-### test\_assert\_equal\_hex(int32\_t val, int32\_t exp, char\* title)
43
+- #### void test\_assert\_equal\_hex(int32\_t val, int32\_t exp, char\* title)
44 44
 
45 45
 Asserts the equality of `val` to `exp`. On failure, prints integers in hexadecimal.
46 46
 
@@ -48,11 +48,11 @@ Asserts the equality of `val` to `exp`. On failure, prints integers in hexadecim
48 48
 
49 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 50
 
51
-### test\_assert\_equal\_string(char\* s, char\* exp, char\* title)
51
+- #### void test\_assert\_equal\_string(char\* s, char\* exp, char\* title)
52 52
 
53 53
 Assert the equality of `s` to `exp`.
54 54
 
55
-### test\_assert\_equal\_string\_len(char\* s, char\* exp, int32\_t n, char\* title)
55
+- #### void test\_assert\_equal\_string\_len(char\* s, char\* exp, int32\_t n, char\* title)
56 56
 
57 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 58
 
@@ -60,6 +60,12 @@ Assert the equality of the first `n` chars from both `s` and `exp`. In other wor
60 60
 
61 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 62
 
63
-### test\_assert\_equal\_memory(void\* ptr, void\* exp, int32\_t n, char\* title)
63
+- #### void test\_assert\_equal\_memory(void\* ptr, void\* exp, int32\_t n, char\* title)
64 64
 
65 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.
66
+
67
+## Other
68
+
69
+- #### int test\_end()
70
+
71
+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.

Loading…
Cancel
Save