Commit 3c8c7f9
authored
Update reverse.rs
1. macro_rules! test_cases:
This macro is designed to reduce repetition by defining multiple test cases at once.
It takes a list of test names and test case tuples ((input, expected)).
2. $name:ident:
The test function name. For example, test_simple_palindrome is generated as the test function name.
3. $test_case:expr:
This represents a tuple of (input, expected) for each test.
4. Generated Test Functions:
Each entry inside test_cases! expands into a separate test function.
For example, the test_simple_palindrome macro expands into a function that tests if reversing "racecar" returns "racecar"1 parent 0dbaff5 commit 3c8c7f9
1 file changed
+21
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
12 | 20 | | |
13 | 21 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
22 | 32 | | |
23 | 33 | | |
0 commit comments