original.name="While_Valid_18"
======
>>> main.whiley
type nat is (int x) where x >= 0
function match(byte[] data, nat offset, nat end) -> int:
nat pos = end
int len = 0
while offset < pos && pos < |data| && data[offset] == data[pos]
where (pos >= 0) && (offset >= 0):
//
offset = offset + 1
pos = pos + 1
len = len + 1
//
return len
public export method test() :
byte[] xs = [
0b0000_0000,
0b0000_0101,
0b0000_0000,
0b0000_0110,
0b0000_0000,
0b0000_0101
]
int x = match(xs, 0, |xs| - 2)
assume x == 2
---