Commit 198d36d
authored
dominoes: make test code more idiomatic (#2127)
I've had a mentee copy the "normalize" function from the test code. I
didn't notice at first and explained it's unidiomatic to use a match
statement only for the guards, because it's just a weird way of writing
an if-else-statement.
This version isn't an if-else-statement (which would've been fine too),
but I find it the most readable. I have confirmed that the generated
assemply is essentially the same, i.e. this doesn't generate _two_
comparison instructions.
[no important files changed]1 parent 5006ebd commit 198d36d
File tree
2 files changed
+6
-11
lines changed- exercises/practice/dominoes
- .meta
- tests
2 files changed
+6
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 56 | + | |
| 57 | + | |
61 | 58 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 151 | + | |
| 152 | + | |
155 | 153 | | |
0 commit comments