isSameMemory checks if two slices contain the same memory pointer (meaning one is a subslice of the other, with possibly differing lengths/capacities). Test helper for SYS-REQ-014.
(a, b []byte)
| 154 | // subslice of the other, with possibly differing lengths/capacities). |
| 155 | // Test helper for SYS-REQ-014. |
| 156 | func isSameMemory(a, b []byte) bool { |
| 157 | if cap(a) == 0 || cap(b) == 0 { |
| 158 | return cap(a) == cap(b) |
| 159 | } else if a, b = a[:1], b[:1]; a[0] != b[0] { |
| 160 | return false |
| 161 | } else { |
| 162 | a[0]++ |
| 163 | same := (a[0] == b[0]) |
| 164 | a[0]-- |
| 165 | return same |
| 166 | } |
| 167 | |
| 168 | } |
| 169 | |
| 170 | // Verifies: SYS-REQ-014 [malformed] |
| 171 | // MCDC SYS-REQ-014: N/A |